Skip to content
tracyone edited this page Mar 5, 2017 · 25 revisions

Keymapping

Leader key is space.

<leader>hk : show all the keybinding that with space prefix

<leader>vc : open vimrc.

Keymapping with space prefix

Application

mode key description
n |       ac | vim calculator
n |       ad | open calendar
n |       af | open current file's position with default file explorer
n |       aF | open project's(pwd) position with default file explorer
n |       ah | hex to ascii convert
n |       al | <Plug>(LiveEasyAlign)
x |       al | <Plug>(LiveEasyAlign)
n |       am | make
n |       ap | Open plug status windows
n |       as | Open vimshell or neovim's emulator
n |       at | open current file's position in default terminal
n |       aT | open project's(pwd) position in default terminal
n |       ay | YouDao translate
v |       ay | YouDao translate (visual mode)
n |       aw | DrawIt

Buffer

mode key description
n |       bh | Open startify windows
n |       bk | delete buffer
n |       bn | next buffer or tab
n |       bp | previous buffer or tab

Comment operating

mode key description
n |       ca | <Plug>NERDCommenterAltDelims
n |       cA | <Plug>NERDCommenterAppend
v |       cA | <Plug>NERDCommenterAppend
n |       cb | <Plug>NERDCommenterAlignBoth
v |       cb | <Plug>NERDCommenterAlignBoth
n |       cc | <Plug>NERDCommenterComment
v |       cc | <Plug>NERDCommenterComment
n |       ci | <Plug>NERDCommenterInvert
v |       ci | <Plug>NERDCommenterInvert
n |       cl | <Plug>NERDCommenterAlignLeft
v |       cl | <Plug>NERDCommenterAlignLeft
n |       cm | <Plug>NERDCommenterMinimal
v |       cm | <Plug>NERDCommenterMinimal
n |       cn | <Plug>NERDCommenterNest
v |       cn | <Plug>NERDCommenterNest
n |       c$ | <Plug>NERDCommenterToEOL
v |       c$ | <Plug>NERDCommenterToEOL
n | c<Space> | <Plug>NERDCommenterToggle
v | c<Space> | <Plug>NERDCommenterToggle
n |       cs | <Plug>NERDCommenterSexy
v |       cs | <Plug>NERDCommenterSexy
n |       cu | <Plug>NERDCommenterUncomment
v |       cu | <Plug>NERDCommenterUncomment
n |       cy | <Plug>NERDCommenterYank
v |       cy | <Plug>NERDCommenterYank

Easymotion mapping

mode key description
n |       ef | MultiWindow easymotion for char
n |       el | MultiWindow easymotion for line
n |       es | MultiChar easymotion
n |       et | <Plug>(easymotion-tn)
n |        F | MultiWindow easymotion for word

File releate

mode key description
n |       fc | cd to current buffer's path
n |       fg | run Ag command
n |       fj | Open Vim File Explorer
n |       fR | rename multi file name
n |       fS | save all
n |       fs | save file
n |       fU | CtrlP function

Ctrlp

mode key description
n |       pc | CtrlP cmd 
n |       pk | CtrlP function
n |       pl | ctrlp buffer
n |       pp | CtrlP file
n |       pr | CtrlP mru
n |       pt | CtrlP tmux session

Git relate

mode key description
n |       gb | Open git blame windows
n |       gd | git diff current file (vimdiff)
n |       gh | Open github url
n |       gi | list git issue
n |       gl | Open git log( browser mode)
n |       gL | Open git log(file mode)
v |       gL | Open git log(file mode)
n |       gp | git push origin master
n |       gg | git push to gerrit
n |       gm | git merge(use git rebase)
n |       gf | git fetch all
n |       gs | Open git status window

Help relate

mode key description
n |       hk | **list leader's map**
n |       ?  | **list leader's map**
n |       hm | **manpage or vimhelp on current curosr word**
n |       he | open eval.txt in new tab
n |       hf | open vim function-list in new tab
n |       hp | open vim script manual in new tab

Session

mode key description
n |       ll | **Session load**
n |       lo | **Save basic setting**
n |       ls | **Session save**

Markdown

mode key description
n |       mp | Markdown preview in browser
n |       mt | generate markdown TOC
n |       mu | update markdown TOC
n |       ms | show toc in sidebar

Quit

mode key description
n |       qq | quit all
n |       qQ | quit all without save
n |       qs | save and quit all

Toggle something

Can be save mean after toggle you can press SPC+lo to save your setting without modify any config.

mode key description
n |       tb | background dark or light toggle (**Can be save**)
n |       td | dos to unix or unix to dos
n |       tf | Convert file's encode
n |       tg | **menu and toolbar toogle** (**Can be save**)
n |       tm | Mouse mode toggle (**Can be save**)
n |       te | Open nerd tree
n |       tn | toggle line number (**Can be save**)
n |       to | toggle free writing in vim (Goyo)
n |       tt | Open tagbar
n |       th | realtime underline word toggle
n |       tu | undo tree window toggle
n |       tc | toggle between tab or space,8 or 4 (**Can be save**)
n |       tp | toggle paste option
n |       tj | whether use cache in ctrlp
n |       ts | toggle between long statusline and short statusline

Ag searcher

mode key description
n |       vf | ag search c family function
n |       vt | ag search :TODO or FIXME
n |       vv | ag search for the word on current curosr
v |       vv | ag search for the word on current curosr

Windows operatting

mode key description
n |        1 | tab 1
n |        2 | tab 2
n |        3 | tab 3
n |        4 | tab 4
n |        5 | tab 5
n |        6 | tab 6
n |        7 | tab 7
n |        8 | tab 8
n |        9 | tab 9
n |       wc | **Choose windows**
n |       wd | hide current windows
n |       wh | move to left win
n |       wj | move down win
n |       wk | move up win
n |       wl | move to right win
n |       wm | maxsize of current windows
  |       w= | :resize +10<CR>
  |       w- | :resize -10<CR>
n |       ws | horizontal open window
n |       wS | horizontal open window then focus the new one
  |       w, | :vertical resize -10<CR>
  |       w. | :vertical resize +10<CR>
n |       wv | vertical open window
n |       wV | vertical open window then focus the new one
n |       ww | switch between two windows

Mark

mode key description
n | mm   | <Plug>MarkSet
x | mm   | <Plug>MarkSet
n | mn   | <Plug>MarkClear
n | m/   | <Plug>MarkSearchAnyNext
n | m?   | <Plug>MarkSearchAnyPrev
n | *    | <Plug>MarkSearchCurrentNext
n | #    | <Plug>MarkSearchCurrentPrev
n | r    | <Plug>MarkRegex
x | r    | <Plug>MarkRegex
n | mi   | bookmark annotate
n | mc   | clear current bookmark
n | mb   | bookmark browser
n | ma   | add bookmark use current line as annotate

Others

mode key description
n |        d | :YcmShowDetailedDiagnostic<CR>
n |      iav | Open c family header in new tab
n |       jl | jume to definition (YCM)
n |        o | open url on cursor with default browser
n |       vc | **open the vimrc in tab**
n |       so | **update the _vimrc**
n |      fml | Open Leader mappings in new window
n |       yr | run cunrrent file
v |       yr | run selection text
n |       yy | Open Yanking windows or ctrlp-register

Fuzzy files search & string search

ctrlpvim

ctrlp-funky

ShortCut Key mode Description
Ctrl-p normal fuzzy search files
Ctrl-k normal fuzzy search functions for current file
Ctrl-j normal fuzzy search buffers
Ctrl-l normal fuzzy search recent open files(MRU)
<leader>vv normal,visual global search string under cursor
<leader>vf normal global search string c function under cursor
<leader>vt normal global search TODO or FIXME

For speed up the search process,recommand you install the silver searcher.

You can substitute in the search result of ag.

Press r in the quickfix windows,it will enter to the qfreplace mode,press ctrl-n on the cursor word it will enter to the multi-cursor mode,modify then save.

FunctionKey

ShortCut Key mode Description
F1 all Open vim help
F2 all Open rename windows
F3 all Open Gstatus windows
F4 all Open shell,or terminal emulator
F5 all Execute make then open quickfix
F6 normal,visual execute current file or selection code
F7 normal perform dos2unix or unix2dos for current open file.
F8 all save current session
F9 normal open tagbar windows
F10 normal,visual YouDao dict translate the word under the cursor
F11 normal Open vim file manager
F12 normal,insert open nerdtree

Source code reading and GoToDefinition

Function ShortCut Key
Generate database ,u
add database under the cur dir ,a,split view:<C-\>a
GotoDefinition under the cursor ,g,split view:<C-\>g
Find functions calling this function under the cursor ,c,split view:<C-\>c

t-vim will automatically add cscope.out under the current directory.

t-vim will add all cscope.out which path is specified by file .project under the current directory.

File .project format:

/home/tracyone/work/ctest/
/usr/inculde/

if file .project is exist at the current directory,when press ,u t-vim will ask whether Generate database for specified path in .project.

When press ,g,t-vim will try to use the function of YouCompleteMe GoToDefinition,if it failed,then use cscope.

keymapping with alt prefix

mode key description
n 1 tab 1
n 2 tab 2
n 3 tab 3
n 4 tab 4
n 5 tab 5
n 6 tab 6
n 7 tab 7
n 8 tab 8
n 9 tab 9
n t new tab
n q nohls
n a select all
n = select all then align
n h move to left win
n l move to right win
n j move to down win
n k move to up win
i h equal to <left> in insert mode
i l equal to <right> in insert mode
i j equal to <down> in insert mode
i k equal to <up> in insert mode
i b words backward.
i f words forward.
c h characters to the left.
c l characters to the right.
c j characters to the down.
c k characters to the up.
c b words backward.
c f words forward.
n m mouse enable toggle

Other keymapping

mode key description
n,i C-y Yanking win or ctrlp-register
n C-h substitute the cursor word
n C-n Multicusor mode toggle
n C-y open yankring windows or ctrlp-register in neovim.
i C-j ultisnips expand or jump forward to next selection in ultisnips
i C-k jump backward to the selection in ultisnips
n sj equal to za,toggle fold
n sk equal to zM,fold all
n si fold enable toggle
n k find help on vim document or man page.
Clone this wiki locally