nvim+tmux smart-splits
This commit is contained in:
+20
-16
@@ -1201,22 +1201,26 @@ local function makespec_todocomments()
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
local function makespec_tmuxnav()
|
local function makespec_smartsplits()
|
||||||
return {
|
return {
|
||||||
-- tmux / vim interop
|
"mrjones2014/smart-splits.nvim",
|
||||||
"alexghergh/nvim-tmux-navigation",
|
lazy = false,
|
||||||
config = function()
|
-- stylua: ignore
|
||||||
require("nvim-tmux-navigation").setup({
|
keys = {
|
||||||
disable_when_zoomed = true, -- defaults to false
|
{ "<M-h>", function() require("smart-splits").move_cursor_left() end, { desc = "Go to Left Window", remap = true } },
|
||||||
keybindings = {
|
{ "<M-j>", function() require("smart-splits").move_cursor_down() end, { desc = "Go to Left Window", remap = true } },
|
||||||
left = "<M-h>",
|
{ "<M-k>", function() require("smart-splits").move_cursor_up() end, { desc = "Go to Left Window", remap = true } },
|
||||||
down = "<M-j>",
|
{ "<M-l>", function() require("smart-splits").move_cursor_right() end, { desc = "Go to Left Window", remap = true } },
|
||||||
up = "<M-k>",
|
{ "<M-\\>", function() require("smart-splits").move_cursor_previous() end, { desc = "Go to Previous Window", remap = true } },
|
||||||
right = "<M-l>",
|
{ "<C-h>", function() require("smart-splits").resize_left() end, { desc = "Resize Window Left", remap = true } },
|
||||||
last_active = "<M-\\>",
|
{ "<C-j>", function() require("smart-splits").resize_down() end, { desc = "Resize Window Down", remap = true } },
|
||||||
},
|
{ "<C-k>", function() require("smart-splits").resize_up() end, { desc = "Resize Window Up", remap = true } },
|
||||||
})
|
{ "<C-l>", function() require("smart-splits").resize_right() end, { desc = "Resize Window Right", remap = true } },
|
||||||
end,
|
{ "<leader><leader>h", function() require("smart-splits").swap_buf_left() end, { desc = "Swap Buffer Left", remap = true } },
|
||||||
|
{ "<leader><leader>j", function() require("smart-splits").swap_buf_down() end, { desc = "Swap Buffer Down", remap = true } },
|
||||||
|
{ "<leader><leader>k", function() require("smart-splits").swap_buf_up() end, { desc = "Swap Buffer Up", remap = true } },
|
||||||
|
{ "<leader><leader>l", function() require("smart-splits").swap_buf_right() end, { desc = "Swap Buffer Right", remap = true } },
|
||||||
|
},
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1479,7 +1483,7 @@ for _, spec in ipairs({
|
|||||||
makespec_orgmode(),
|
makespec_orgmode(),
|
||||||
-- navigation
|
-- navigation
|
||||||
makespec_whichkey(),
|
makespec_whichkey(),
|
||||||
makespec_tmuxnav(),
|
makespec_smartsplits(),
|
||||||
makespec_hlslens(),
|
makespec_hlslens(),
|
||||||
makespec_flash(),
|
makespec_flash(),
|
||||||
makespec_grugfar(),
|
makespec_grugfar(),
|
||||||
|
|||||||
+32
-32
@@ -79,12 +79,6 @@ bind i display-panes
|
|||||||
# Config Reloads
|
# Config Reloads
|
||||||
bind r source-file ~/.config/tmux/tmux.conf \; refresh-client \; display-message "Config reloaded"
|
bind r source-file ~/.config/tmux/tmux.conf \; refresh-client \; display-message "Config reloaded"
|
||||||
|
|
||||||
# resize controls
|
|
||||||
bind -r h resize-pane -L 10 \; display-message "Resize left"
|
|
||||||
bind -r l resize-pane -R 10 \; display-message "Resize right"
|
|
||||||
bind -r k resize-pane -U 10 \; display-message "Resize up"
|
|
||||||
bind -r j resize-pane -D 10 \; display-message "Resize down"
|
|
||||||
|
|
||||||
# zoom control
|
# zoom control
|
||||||
bind -n M-o resize-pane -Z
|
bind -n M-o resize-pane -Z
|
||||||
|
|
||||||
@@ -141,27 +135,6 @@ bind q confirm-before -p "kill-pane #P? (y/n)" kill-pane
|
|||||||
# clear selected pane
|
# clear selected pane
|
||||||
bind b send-keys -R \; clear-history \; send-keys Enter
|
bind b send-keys -R \; clear-history \; send-keys Enter
|
||||||
|
|
||||||
# Smart pane switching with awareness of Vim splits.
|
|
||||||
# See: https://github.com/christoomey/vim-tmux-navigator
|
|
||||||
is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
|
|
||||||
bind -n M-h if-shell "$is_vim" "send-keys M-h" "select-pane -L"
|
|
||||||
bind -n M-j if-shell "$is_vim" "send-keys M-j" "select-pane -D"
|
|
||||||
bind -n M-k if-shell "$is_vim" "send-keys M-k" "select-pane -U"
|
|
||||||
bind -n M-l if-shell "$is_vim" "send-keys M-l" "select-pane -R"
|
|
||||||
bind M-h "select-pane -L"
|
|
||||||
bind M-j "select-pane -D"
|
|
||||||
bind M-k "select-pane -U"
|
|
||||||
bind M-l "select-pane -R"
|
|
||||||
#bind -n M-\ if-shell "$is_vim" "send-keys M-\\" "select-pane -l"
|
|
||||||
bind -T copy-mode-vi M-h select-pane -L
|
|
||||||
bind -T copy-mode-vi M-j select-pane -D
|
|
||||||
bind -T copy-mode-vi M-k select-pane -U
|
|
||||||
bind -T copy-mode-vi M-l select-pane -R
|
|
||||||
#bind -T copy-mode-vi M-\ select-pane -l
|
|
||||||
|
|
||||||
# fzf binding
|
|
||||||
set -g @tmux-fzf-launch-key 'f'
|
|
||||||
|
|
||||||
######################
|
######################
|
||||||
### PLUGINS ###
|
### PLUGINS ###
|
||||||
######################
|
######################
|
||||||
@@ -170,10 +143,34 @@ set -g @tmux-fzf-launch-key 'f'
|
|||||||
set -g @plugin 'tmux-plugins/tpm'
|
set -g @plugin 'tmux-plugins/tpm'
|
||||||
set -g @plugin 'tmux-plugins/tmux-sensible'
|
set -g @plugin 'tmux-plugins/tmux-sensible'
|
||||||
set -g @plugin 'tmux-plugins/tmux-yank'
|
set -g @plugin 'tmux-plugins/tmux-yank'
|
||||||
# set -g @plugin 'arcticicestudio/nord-tmux'
|
|
||||||
# set -g @plugin 'seebi/tmux-colors-solarized'
|
|
||||||
# set -g @plugin 'jimeh/tmux-themepack'
|
######################
|
||||||
# set -g @plugin 'wfxr/tmux-power'
|
### PANE CONTROL ###
|
||||||
|
######################
|
||||||
|
|
||||||
|
set -g @plugin 'mrjones2014/smart-splits.nvim'
|
||||||
|
|
||||||
|
# Optional configurations with their default values if omitted:
|
||||||
|
|
||||||
|
set -g @smart-splits_no_wrap '' # to disable wrapping. (any value disables wrapping)
|
||||||
|
|
||||||
|
set -g @smart-splits_move_left_key 'M-h' # key-mapping for navigation.
|
||||||
|
set -g @smart-splits_move_down_key 'M-j' # --"--
|
||||||
|
set -g @smart-splits_move_up_key 'M-k' # --"--
|
||||||
|
set -g @smart-splits_move_right_key 'M-l' # --"--
|
||||||
|
|
||||||
|
set -g @smart-splits_resize_left_key 'C-h' # key-mapping for resizing.
|
||||||
|
set -g @smart-splits_resize_down_key 'C-j' # --"--
|
||||||
|
set -g @smart-splits_resize_up_key 'C-k' # --"--
|
||||||
|
set -g @smart-splits_resize_right_key 'C-l' # --"--
|
||||||
|
|
||||||
|
set -g @smart-splits_resize_step_size '3' # change the step-size for resizing.
|
||||||
|
|
||||||
|
######################
|
||||||
|
### THEME ###
|
||||||
|
######################
|
||||||
|
|
||||||
set -g @plugin 'niksingh710/minimal-tmux-status'
|
set -g @plugin 'niksingh710/minimal-tmux-status'
|
||||||
set -g @minimal-tmux-justify "centre"
|
set -g @minimal-tmux-justify "centre"
|
||||||
set -g @minimal-tmux-indicator-str " tmux "
|
set -g @minimal-tmux-indicator-str " tmux "
|
||||||
@@ -206,5 +203,8 @@ set -g @minimal-tmux-left-arrow ""
|
|||||||
set -g status-right-length 20
|
set -g status-right-length 20
|
||||||
set -g status-left-length 20
|
set -g status-left-length 20
|
||||||
|
|
||||||
# keep at bottom
|
######################
|
||||||
|
### KEEP AT BOTTOM ###
|
||||||
|
######################
|
||||||
|
|
||||||
run -b '~/.config/tmux/plugins/tpm/tpm'
|
run -b '~/.config/tmux/plugins/tpm/tpm'
|
||||||
|
|||||||
Reference in New Issue
Block a user