ctrlhjkl.vim


Ⅰ. 插件描述

VIM window / tab / buffer navigation via / / /

Ⅱ. 基本信息

创建日期:  2017-07-06
使用用户:  1
Github星:  3
插件作者:  Anthony Astige

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'anthonyastige/ctrlhjkl-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'anthonyastige/ctrlhjkl-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'anthonyastige/ctrlhjkl-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/anthonyastige/ctrlhjkl.vim

Ⅳ. 文档说明

# 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 <c-x> 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

添加新评论