Skip to content

Commit 0da0a98

Browse files
Merge pull request #1 from Leo-Leo-Leo-Leo-Leo/feat/tmux-navigation
tmux and enable base plugins
2 parents 1860184 + 5ce2827 commit 0da0a98

File tree

3 files changed

+45
-8
lines changed

3 files changed

+45
-8
lines changed

init.lua

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -880,19 +880,19 @@ require('lazy').setup({
880880
-- Here are some example plugins that I've included in the Kickstart repository.
881881
-- Uncomment any of the lines below to enable them (you will need to restart nvim).
882882
--
883-
-- require 'kickstart.plugins.debug',
884-
-- require 'kickstart.plugins.indent_line',
885-
-- require 'kickstart.plugins.lint',
886-
-- require 'kickstart.plugins.autopairs',
887-
-- require 'kickstart.plugins.neo-tree',
888-
-- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
883+
require 'kickstart.plugins.debug',
884+
require 'kickstart.plugins.indent_line',
885+
require 'kickstart.plugins.lint',
886+
require 'kickstart.plugins.autopairs',
887+
require 'kickstart.plugins.neo-tree',
888+
require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
889889

890890
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
891891
-- This is the easiest way to modularize your config.
892892
--
893893
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
894894
-- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins`
895-
-- { import = 'custom.plugins' },
895+
{ import = 'custom.plugins' },
896896
}, {
897897
ui = {
898898
-- If you are using a Nerd Font: set icons to an empty table which will use the

lua/custom/plugins/init.lua

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,22 @@
22
-- I promise not to create any merge conflicts in this directory :)
33
--
44
-- See the kickstart.nvim README for more information
5-
return {}
5+
return {
6+
{
7+
'christoomey/vim-tmux-navigator',
8+
cmd = {
9+
'TmuxNavigateLeft',
10+
'TmuxNavigateDown',
11+
'TmuxNavigateUp',
12+
'TmuxNavigateRight',
13+
'TmuxNavigatePrevious',
14+
},
15+
keys = {
16+
{ '<c-h>', '<cmd><C-U>TmuxNavigateLeft<cr>' },
17+
{ '<c-j>', '<cmd><C-U>TmuxNavigateDown<cr>' },
18+
{ '<c-k>', '<cmd><C-U>TmuxNavigateUp<cr>' },
19+
{ '<c-l>', '<cmd><C-U>TmuxNavigateRight<cr>' },
20+
{ '<c-\\>', '<cmd><C-U>TmuxNavigatePrevious<cr>' },
21+
},
22+
},
23+
}

lua/custom/plugins/tmux.conf

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Smart pane switching with awareness of Vim splits.
2+
# See: https://github.com/christoomey/vim-tmux-navigator
3+
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
4+
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|l?n?vim?x?|fzf)(diff)?$'"
5+
bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
6+
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
7+
bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
8+
bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R'
9+
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
10+
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
11+
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
12+
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
13+
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"
14+
15+
bind-key -T copy-mode-vi 'C-h' select-pane -L
16+
bind-key -T copy-mode-vi 'C-j' select-pane -D
17+
bind-key -T copy-mode-vi 'C-k' select-pane -U
18+
bind-key -T copy-mode-vi 'C-l' select-pane -R
19+
bind-key -T copy-mode-vi 'C-\' select-pane -l

0 commit comments

Comments
 (0)