Skip to content

VIM window / tab / buffer navigation via <c-h> / <c-j> /<c-k> / <c-l>

Notifications You must be signed in to change notification settings

AnthonyAstige/ctrlhjkl.vim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 

Repository files navigation

CtrlHJKL v0.1.2

Context sensitive workspace navigation

Guiding principals

  • <c-h> / <c-j> / <c-k> / <c-l> moves cursor around in windows/tabs/buffers
    • Workspace context sensitive: Fall through: Windows > Tabs > Buffers
    • Mode context sensitive
      • Normal mode moves cursor
      • Visual mode moves selected (line of) text
  • <c-x> in normal mode closes where cursor is: Window > Tab > Buffer

Configuration

Mapping your own keys

let g:ctrlhjkl_suppress_keymaps = 1

nmap <s-j> <Plug>CtrlHJKLGoJn
nmap <s-k> <Plug>CtrlHJKLGoKn
nmap <s-h> <Plug>CtrlHJKLGoHn
nmap <s-l> <Plug>CtrlHJKLGoLn

nmap <s-l> <Plug>CtrlHJKLClose

xmap <s-j> <Plug>CtrlHJKLMoveJ
xmap <s-k> <Plug>CtrlHJKLMoveK
xmap <s-h> <Plug>CtrlHJKLMoveH
xmap <s-l> <Plug>CtrlHJKLMoveL

Disable buffer cycling

let g:ctrlhjkl_suppress_buffercycling = 1

Why cycle when you can fly?

Disable buffer closing

let g:ctrlhjkl_suppress_bufferclosing = 1

Issues & potential optomizations

  • Move in my .vimrc tab mappings?
    • Add tab movement mappings
      • Tab to right & tab to left, cycling
      • <ctrl-t><ctrl-h>
      • <ctrl-t><ctrl-l>
    • Add tab initialization mapping
      • Initialize tab to far right?
      • Same <ctrl-t><ctrl-t>
  • Add my related Ctrl-P/Ack!/NerdTree unified mappings for opening in windows/tabs
    • Just in docs, not in actual plugin
  • Think about making kill buffers in window/tab context?
    • Window: Close window & kill buffer if this is only place it's open
    • Tab: Close tab & kill buffer if this is only place it's open
  • Rename from CtrlHJKL?
    • We now have CtrlX also for closing
  • Create a /doc/ctrlp.txt
    • And update ctags?
  • Create real screencast .gif and place in README
  • Promote this plugin looking for beta testers
  • Release to places as needed

Related .vimrc plugins & settings (Optional)

" 'qpkorr/vim-bufkill'
let g:BufKillCreateMappings = 0 " My own keymappings
:nnoremap <C-x> :BD<cr>

" matze/vim-move to work as <s-j> and <s-k>
" Works with shift '>'
let g:move_key_modifier = 'S'

Inspirations

About

VIM window / tab / buffer navigation via <c-h> / <c-j> /<c-k> / <c-l>

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published