Improved tmux config and pane movement/resizing
This commit is contained in:
parent
994c0ac0b8
commit
64637b19ea
|
@ -44,7 +44,7 @@
|
|||
"playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" },
|
||||
"schemastore.nvim": { "branch": "main", "commit": "bb52c530698654355bbddb9f0035dc35cea401a5" },
|
||||
"smart-splits.nvim": { "branch": "master", "commit": "4a231987665d3c6e02ca88833d050e918afe3e1e" },
|
||||
"smart-splits.nvim": { "branch": "master", "commit": "5ef94ca23b28148187846fc46f10184aad4d17b0" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "dae2eac9d91464448b584c7949a31df8faefec56" },
|
||||
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "415af52339215926d705cccc08145f3782c4d132" },
|
||||
|
|
|
@ -1,34 +1,25 @@
|
|||
-- https://github.com/mrjones2014/smart-splits.nvim
|
||||
return {
|
||||
"mrjones2014/smart-splits.nvim",
|
||||
dependencies = {
|
||||
"kwkarlwang/bufresize.nvim",
|
||||
},
|
||||
config = function()
|
||||
vim.keymap.set("n", "<M-h>", require("smart-splits").move_cursor_left)
|
||||
vim.keymap.set("n", "<M-j>", require("smart-splits").move_cursor_down)
|
||||
vim.keymap.set("n", "<M-k>", require("smart-splits").move_cursor_up)
|
||||
vim.keymap.set("n", "<M-l>", require("smart-splits").move_cursor_right)
|
||||
|
||||
vim.keymap.set("n", "<C-w>r", require("smart-splits").start_resize_mode, { desc = "Enter resize mode" })
|
||||
|
||||
vim.keymap.set("n", "<C-w>h", require("smart-splits").swap_buf_left, { desc = "Swap buffer to the left" })
|
||||
vim.keymap.set("n", "<C-w>j", require("smart-splits").swap_buf_down, { desc = "Swap buffer to the bottom" })
|
||||
vim.keymap.set("n", "<C-w>k", require("smart-splits").swap_buf_up, { desc = "Swap buffer to the top" })
|
||||
vim.keymap.set("n", "<C-w>l", require("smart-splits").swap_buf_right, { desc = "Swap buffer to the right" })
|
||||
|
||||
vim.keymap.set("n", "<M-left>", require("smart-splits").resize_left, { desc = "Resize buffer to the left" })
|
||||
vim.keymap.set("n", "<M-down>", require("smart-splits").resize_down, { desc = "Resize buffer to the bottom" })
|
||||
vim.keymap.set("n", "<M-up>", require("smart-splits").resize_up, { desc = "Resize buffer to the top" })
|
||||
vim.keymap.set("n", "<M-right>", require("smart-splits").resize_right, { desc = "Resize buffer to the right" })
|
||||
|
||||
require("smart-splits").setup({
|
||||
at_edge = "stop",
|
||||
cursor_follows_swapped_bufs = true,
|
||||
resize_mode = {
|
||||
silent = true,
|
||||
hooks = {
|
||||
on_enter = function()
|
||||
vim.notify("Entering resize mode...")
|
||||
end,
|
||||
on_leave = require("bufresize").register,
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
# Plugins
|
||||
set -g @plugin 'mrjones2014/smart-splits.nvim'
|
||||
set -g @plugin 'tmux-plugins/tmux-sensible'
|
||||
|
||||
# Settings
|
||||
set -g default-terminal "xterm-256color"
|
||||
set -ag terminal-overrides ",xterm-256color:RGB"
|
||||
setw -g monitor-activity on
|
||||
setw -g aggressive-resize on
|
||||
setw -g automatic-rename on
|
||||
set -s escape-time 0
|
||||
set-window-option -g xterm-keys on
|
||||
set-option -g focus-events on
|
||||
|
||||
# Setup vi-mode with better keybindings
|
||||
# TODO: Escape does not work properly for leaving
|
||||
|
@ -20,29 +20,27 @@ unbind C-b
|
|||
set -g prefix C-a
|
||||
|
||||
# Improve navigation between tmux and nvim
|
||||
# TODO: Disable pane selection wrap
|
||||
bind-key -n M-h if -F "#{@pane-is-vim}" 'send-keys M-h' "run '#{select_pane_no_wrap} L'"
|
||||
bind-key -n M-j if -F "#{@pane-is-vim}" 'send-keys M-j' "run '#{select_pane_no_wrap} D'"
|
||||
bind-key -n M-k if -F "#{@pane-is-vim}" 'send-keys M-k' "run '#{select_pane_no_wrap} U'"
|
||||
bind-key -n M-l if -F "#{@pane-is-vim}" 'send-keys M-l' "run '#{select_pane_no_wrap} R'"
|
||||
set -g @smart-splits_no_wrap '' # to disable wrapping. (any value disables wrapping)
|
||||
|
||||
bind-key -T copy-mode-vi 'M-h' select-pane -L
|
||||
bind-key -T copy-mode-vi 'M-j' select-pane -D
|
||||
bind-key -T copy-mode-vi 'M-k' select-pane -U
|
||||
bind-key -T copy-mode-vi 'M-l' select-pane -R
|
||||
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 'M-left' # key-mapping for resizing.
|
||||
set -g @smart-splits_resize_down_key 'M-down' # --"--
|
||||
set -g @smart-splits_resize_up_key 'M-up' # --"--
|
||||
set -g @smart-splits_resize_right_key 'M-right' # --"--
|
||||
|
||||
# Custom keybinds
|
||||
bind '"' split-window -c "#{pane_current_path}"
|
||||
bind % split-window -h -c "#{pane_current_path}"
|
||||
bind s split-window -c "#{pane_current_path}"
|
||||
bind v split-window -h -c "#{pane_current_path}"
|
||||
bind -n C-j new-window -c "#{pane_current_path}"
|
||||
bind -n C-h prev
|
||||
bind -n C-l next
|
||||
bind -n C-M-l swap-window -t +1 \; next
|
||||
bind -n C-M-h swap-window -t -1 \; prev
|
||||
|
||||
# Keybind for reloading config
|
||||
bind r source-file $DOTFILES/tmux/dot-tmux.conf \; display-message "Config reloaded..."
|
||||
|
||||
bind -T root F12 \
|
||||
set prefix None \;\
|
||||
set key-table off \;\
|
||||
|
@ -59,6 +57,4 @@ wg_is_keys_off="#([ $(tmux show-option -qv key-table) = 'off' ] && echo 'TRUE' )
|
|||
# Load theme
|
||||
source-file "$DOTFILES/tmux/gruvbox.conf"
|
||||
|
||||
set -g @plugin "dalejung/tmux-select-pane-no-wrap"
|
||||
|
||||
run "$DOTFILES/tmux/tpm/tpm"
|
||||
|
|
Loading…
Reference in New Issue
Block a user