Skip to content
tracyone edited this page Feb 13, 2022 · 36 revisions

Keymapping

Leader key is <SPC>(is short for Space).

<SPC>vc : open vimrc.

<SPC><SPC>: open fuzzy searcher

<SPC>ch : check vim health info

Keymapping with space prefix

Application

mode key description
n <SPC>ab thumbnali
n <SPC>ac vim calculator
n <SPC>ad open calendar
n <SPC>af open current file's position with default file explorer
n <SPC>aF open project's(pwd) position with default file explorer
n <SPC>ah hex to ascii convert
n <SPC>al (LiveEasyAlign)
x <SPC>al (LiveEasyAlign)
n <SPC>am make
n <SPC>as Open vimshell or buildin terminal emulator
n <SPC>at open current file's position in default terminal
n <SPC>aT open project's(pwd) position in default terminal
n <SPC>ay YouDao translate
v <SPC>ay YouDao translate (visual mode)
n <SPC>aw DrawIt
n <SPC>ar lock screen and rest

Buffer

mode key description
n <SPC>bh Open startify windows
n <SPC>bk delete buffer
n <SPC>bn next buffer or tab
n <SPC>bp previous buffer or tab
n <SPC>bo delete all buffers except current buffer

Comment operating

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

Easymotion mapping

mode key description
n <SPC>jf MultiWindow easymotion for char
n <SPC>jl MultiWindow easymotion for line
n <SPC>js MultiChar easymotion
n <SPC>jt (easymotion-tn)
n <SPC>jw MultiWindow easymotion for word

File releate

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

fuzzy searcher or vim-plug

ctrlp or leaderf:

mode key description
n <SPC>pc colorschemecmd
n <SPC>pk function
n <SPC>pb buffer
n <SPC>pp file
n <SPC>pr mru
n <SPC>pt tmux session
n <SPC>ps Open plug status windows
n <SPC>pu Update plugins
n <SPC>pl list plugins
n <SPC>pf search on fly

Git relate

mode key description
n <SPC>gb Open git blame windows
n <SPC>gd git diff current file (vimdiff)
n <SPC>gh Open github url
n <SPC>gi list git issue
n <SPC>gl Open git log( browser mode)
n <SPC>gL Open git log(file mode)
v <SPC>gL Open git log(file mode)
n <SPC>gp git push origin master
n <SPC>gg git push to gerrit
n <SPC>gm git merge(use git rebase)
n <SPC>gf git fetch all
n <SPC>gs Open git status window
n,x,s gho open git url with line info using default web browser.
n,x,s ghc opy git url with line info to system clipboard

github

Help relate

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

Session

mode key description
n <SPC>sl Session load
n <SPC>sd Session delete
n <SPC>ss Session save

Markdown

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

Quit

mode key description
n <SPC>qq quit current window
n <SPC>qa quit all and prompt
n <SPC>qQ quit all without save
n <SPC>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 <SPC>tb background dark or light toggle (Can be save)
n <SPC>td dos to unix or unix to dos
n <SPC>tf Convert file's encode
n <SPC>tg menu and toolbar toogle (Can be save)
n <SPC>tm Mouse mode toggle (Can be save)
n <SPC>te Open nerd tree
n <SPC>tn toggle line number (Can be save)
n <SPC>to toggle free writing in vim (Goyo)
n <SPC>tt Open tagbar
n <SPC>th realtime underline word toggle
n <SPC>tu undo tree window toggle
n <SPC>tc toggle cursorline
n <SPC>tp toggle paste option
n <SPC>tj whether use cache in ctrlp
n <SPC>ts toggle between long statusline and short statusline

searcher

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

Windows operatting

mode key description
n <SPC>1 tab or buffer 1
n <SPC>2 tab or buffer 2
n <SPC>3 tab or buffer 3
n <SPC>4 tab or buffer 4
n <SPC>5 tab or buffer 5
n <SPC>6 tab or buffer 6
n <SPC>7 tab or buffer 7
n <SPC>8 tab or buffer 8
n <SPC>9 tab or buffer 9
n <SPC>tab switch to last opened tab or buf
n <SPC>wc Choose windows
n <SPC>wd hide current windows
n <SPC>wh move to left win
n <SPC>wj move down win
n <SPC>wk move up win
n <SPC>wl move to right win
n <SPC>wm maxsize of current windows
n <SPC>w= :resize +10
n <SPC>w- :resize -10
n <SPC>ws horizontal open window
n <SPC>wS horizontal open window then focus the new one
n <SPC>w, :vertical resize -10
n <SPC>w. :vertical resize +10
n <SPC>wv vertical open window
n <SPC>wV vertical open window then focus the new one
n <SPC>ww switch between two windows
n <SPC>wH move window to the very right
n <SPC>wL move window to the very left
n <SPC>wJ move window to the very bottom
n <SPC>wK move window to the very up
n <SPC>w<TAB> switch between two windows alternately

Mark

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

Others

mode key description
n <SPC>d :YcmShowDetailedDiagnostic
n <SPC>iav Open c family header in new tab
n <SPC>jl jume to definition (YCM)
n <SPC>o open url on cursor with default browser
n <SPC>vc open the vimrc in tab
n <SPC>so update the _vimrc
n <SPC>sc syntax check
n <SPC>fml Open Leader mappings in new window
n <SPC>yr run cunrrent file
v <SPC>yr run selection text
n <SPC>yy Open Yanking windows or ctrlp-register
n <SPC>lo save vim setting
n <SPC>cf format code,support c,c++,python,html
n <SPC>ns open vimshell or buildin terminal in a new tab
n <SPC>nt open new tab
n <SPC>nf locate current file in nerdtree

Fuzzy files search & string search

ctrlpvim

ctrlp-funky

ShortCut Key mode Description
Ctrl-p or SPC SPC 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

ShortCut Key mode Description
SPC+gk normal Generate database for linux kernel
SPC+gt normal Generate cctree database
,u normal Generate database
,a normal add database under the cur dir
,g,split view:<C-\>g normal GotoDefinition under the cursor
,c,split view:<C-\>c normal Find functions calling this function under the cursor

vinux will automatically add cscope.out under the current directory.

vinux 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 vinux will ask whether Generate database for specified path in .project.

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

keymapping with alt prefix

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

quickfix

mode key description
n SPC qf open quick fix window
n SPC ql open location list window(for syntax check plug ie.neomake)
n SPC qc open history command line window
n SPC q/ open history search window
In quick fix window ctrl-o older result
In quick fix window ctrl-i newer result
In quick fix window ctrl-t jump to the result in a new tab
In quick fix window ctrl-x jump to the result in a split window
In quick fix window ctrl-v jump to the result in a vertical split window
In quick fix window down or up open result preview window
In quick fix window r open qreplace window

terminal

mode key description
n <leader>af open a new terminal in floating window
n <leader>as open a new terminal in split window
n <leader>av open a new terminal in vertical split window
n <leader>at open a new terminal in tab window
n <leader>jt open last hide terminal window
n <leader>jf Lunch fuzzy finder to select terminal win
n & t alt-h jump to left win (terminal win or normal win)
n & t alt-l jump to right win (terminal win or normal win)
n & t alt-j jump to up win (terminal win or normal win)
n & t alt-k jump to down win (terminal win or normal win)
t <Ctrl-q>q hide terminal win
t <Ctrl-q>a create a new terminal win
t <Ctrl-q>h move terminal win to left side(only in floating win)
t <Ctrl-q>l move terminal win to right side(only in floating win)
t <Ctrl-q>j move terminal win to bottom side(only in floating win)
t <Ctrl-q>k move terminal win to top side(only in floating win)
t <Ctrl-q>m move terminal win to middle(only in floating win)
t <Ctrl-q>n switch to next terminal win
t <Ctrl-q>p switch to previous terminal win
t <Ctrl-q>r rename the terminal
t <Ctrl-q>t move current terminal win to a new tab
t <Ctrl-q>s move current terminal win to a split window
t <Ctrl-q>v move current terminal win to a vertical split window
t <Ctrl-q>f move current terminal win to a floating window
t <Ctrl-q>w jump to last terminal win
n <leader>tr send current line to terminal win, lunch fuzzy finder if possible
n <leader>ta send current file to terminal win, lunch fuzzy finder if possible
n <leader>re open repl window for current filetype
n <leader>rr open ranger window
n <leader>rt open tig window
n <leader>rg open tig status window
n <Ctrl-v> paste

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,v ss substitute
n KK find help on vim document or man page.
n K LSP hover