Skip to content

Commit

Permalink
[nvim] Add tmux-navigator mappings for terminal buffers
Browse files Browse the repository at this point in the history
  • Loading branch information
frasercrmck committed May 15, 2024
1 parent abeb029 commit 400c695
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion xdg_cfg/nvim/init.vim
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ execute 'set backupdir='.g:editor_root.'/backup'
set clipboard=unnamed " Use the '*' register
let g:clipbrdDefaultReg = '*' " set clipboard register to '*'


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Mappings "
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Expand Down Expand Up @@ -226,6 +225,20 @@ vnoremap <silent> <leader>y "+y
vnoremap <silent> <leader>p "+p
vnoremap <silent> <leader>P "+P
function s:AddTerminalNavigation()
tnoremap <buffer> <silent> <Esc> <C-\><C-n>
if &filetype ==# ''
tnoremap <buffer> <silent> <C-h> <C-\><C-n>:TmuxNavigateLeft<CR>
tnoremap <buffer> <silent> <C-j> <C-\><C-n>:TmuxNavigateDown<CR>
tnoremap <buffer> <silent> <C-k> <C-\><C-n>:TmuxNavigateUp<CR>
tnoremap <buffer> <silent> <C-l> <C-\><C-n>:TmuxNavigateRight<CR>
endif
endfunction

augroup TerminalNavigation
autocmd!
autocmd TermOpen * call s:AddTerminalNavigation()
augroup END

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ack.vim "
Expand Down

0 comments on commit 400c695

Please sign in to comment.