more tmux and vim navigation and color

This commit is contained in:
Andrei Stoica 2024-02-03 21:28:55 -05:00
parent 7325ef4410
commit 05e2f3ea8d
3 changed files with 24 additions and 23 deletions

View File

@ -17,12 +17,7 @@ M.general = {
["n"] = {"nzz", "find next"}, ["n"] = {"nzz", "find next"},
["N"] = {"Nzz", "find prev"}, ["N"] = {"Nzz", "find prev"},
-- navigation ["Zm"] = {":ZenMode<CR>", "Enter ZenMode"}
["<c-h>"] = {"<cmd> TmuxNavigateLeft<cr>", "window left" },
["<c-j>"] = {"<cmd> TmuxNavigateDown<cr>", "window down" },
["<c-k>"] = {"<cmd> TmuxNavigateUp<cr>", "window up" },
["<c-l>"] = {"<cmd> TmuxNavigateRight<cr>", "window right" },
["<c-\\>"] = {"<cmd> TmuxNavigatePrevious<cr>", "window previous" },
}, },
} }

View File

@ -29,6 +29,13 @@ local plugins = {
"TmuxNavigateRight", "TmuxNavigateRight",
"TmuxNavigatePrevious", "TmuxNavigatePrevious",
}, },
kesy = {
{ "<c-h>", "<cmd><C-U>TmuxNavigateLeft<cr>" },
{ "<c-j>", "<cmd><C-U>TmuxNavigateDown<cr>" },
{ "<c-k>", "<cmd><C-U>TmuxNavigateUp<cr>" },
{ "<c-l>", "<cmd><C-U>TmuxNavigateRight<cr>" },
{ "<c-\\>", "<cmd><C-U>TmuxNavigatePrevious<cr>" },
},
lazy = false, lazy = false,
}, },
-- Override plugin definition options -- Override plugin definition options

View File

@ -3,7 +3,6 @@ set -g @plugin 'alexghergh/nvim-tmux-navigation'
run '~/.tmux/plugins/tpm/tpm' run '~/.tmux/plugins/tpm/tpm'
# remap prefix from 'C-b' to 'C-a' # remap prefix from 'C-b' to 'C-a'
unbind C-b unbind C-b
set-option -g prefix C-a set-option -g prefix C-a
@ -33,9 +32,9 @@ unbind h
bind h attach-session -t . -c "#{pane_current_path}" bind h attach-session -t . -c "#{pane_current_path}"
# status bar # status bar
set -g status-right '#[fg=black]#[bg=black fg=colour135] %H:%m #[fg=default]%b %d %Y' set -g status-right '#[fg=black]#[bg=black fg=colour135] %H:%m #[fg=default]%b %d %Y'
if-shell 'test "$(acpi -t)"' { if-shell 'test "$(acpi -t)"' {
set -g status-right '#[fg=black]#[bg=black fg=colour135] %H:%m #[fg=default]%b %d %Y #[fg=pink] ♥#(acpi | cut -d ',' -f 2)' set -g status-right '#[fg=black]#[bg=black fg=colour135] %H:%m #[fg=default]%b %d %Y #[fg=pink] ♥#(acpi | cut -d ',' -f 2)'
} }
# Start windows and panes at 1, not 0 # Start windows and panes at 1, not 0
@ -48,40 +47,40 @@ set-option -g renumber-windows on
# See: https://github.com/christoomey/vim-tmux-navigator # See: https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|l?n?vim?x?|fzf)(diff)?$'" | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|l?n?vim?x?|fzf)(diff)?$'"
bind-key -n -r 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L' bind-key -n -r 'C-h' if-shell "${is_vim}" 'send-keys C-h' 'select-pane -L'
bind-key -n -r 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D' bind-key -n -r 'C-j' if-shell "${is_vim}" 'send-keys C-j' 'select-pane -D'
bind-key -n -r 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U' bind-key -n -r 'C-k' if-shell "${is_vim}" 'send-keys C-k' 'select-pane -U'
bind-key -n -r 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R' bind-key -n -r 'C-l' if-shell "${is_vim}" 'send-keys C-l' 'select-pane -R'
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \ if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'" "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \ if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'" "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"
bind-key -T copy-mode-vi 'C-h' select-pane -L
bind-key -T copy-mode-vi 'C-j' select-pane -D
bind-key -T copy-mode-vi 'C-k' select-pane -U
bind-key -T copy-mode-vi 'C-l' select-pane -R
bind-key -T copy-mode-vi 'C-\' select-pane -l
# resize # resize
bind-key -r -T prefix M-k resize-pane -U bind-key -r -T prefix M-k resize-pane -U
bind-key -r -T prefix M-j resize-pane -D bind-key -r -T prefix M-j resize-pane -D
bind-key -r -T prefix M-h resize-pane -L bind-key -r -T prefix M-h resize-pane -L
bind-key -r -T prefix M-l resize-pane -R bind-key -r -T prefix M-l resize-pane -R
bind-key -r -T prefix k select-pane -U
bind-key -r -T prefix j select-pane -D
bind-key -r -T prefix h select-pane -L
bind-key -r -T prefix l select-pane -R
bind C-l send-keys 'C-l' bind C-l send-keys 'C-l'
bind C-\\ send-keys 'C-\'
set-option -g allow-passthrough on set-option -g allow-passthrough on
set -g default-terminal "xterm-256color" set -g default-terminal "xterm-256color"
set-option -ga terminal-overrides "xterm-256color" set-option -ga terminal-overrides "xterm-256color"
# status and culors
set -g status-left-length 85 set -g status-left-length 85
set -g status-left "#[bg=black]working on#[fg=colour135] #S #[bg=default fg=black]" set -g status-left "#[bg=black]working on#[fg=colour135] #S #[bg=default fg=black]"
set -g window-status-current-format "#[fg=colour135]#W" set -g window-status-current-format "#[fg=colour135]#W"
set -g status-style bg=default set -g status-style bg=default
set -g pane-active-border-style fg=colour135 set -g pane-active-border-style fg=colour135
set -g status-justify centre set -g status-justify centre
set-option -s status-interval 1
set-option -g clock-mode-color colour135
set-option -g message-style fg=colour135,bg=black