List of defined shortcuts and (some) commands and some useful native Vim shortcuts/commands:
Between Files
-
<Ctrl-P>to start navigation in current project<Ctrl-P>to recall last fuzzy search text- enter text to fuzzy filter file names
<Ctrl-z>allows to select multiple files<Ctrl-k>/<Ctrl-j>or arrows move up/down in the list<Ctrl-v>opens selected files in vertical split<Ctrl-s>opens selected files in horizontal split
-
<Leader>ttfinds and opens correlative source/test file. See more shortcuts in ExUnit section below.
In file
<F1>shows Elixir docs for function under cursor.<Ctrl-@>opens functions list for fuzzy search<Leader>lopens all lines in the file for fuzzy search<Ctrl-]>jump to definition of function/module under cursor<Ctrl-T>return from previous jump<Leader>;;search word under cursor, show match list and propmt to jump<Ctrl-Enter>same as above, but only in GVim%jumps to matching do/end tag, brackets, braces, etc. Also can be used after<Ctrl-V>orvto select function/text block.
Use Vim marks :help marks to navigate quickly between several positions in
file or between files.
ma..mzset mark which is available only in current filemA..mZset global mark which is available across files.a`` ..z`` jumps between marks in current file (so many files may havemamark)A`` ..Z`` jumps between global marks and switches buffers if necessary.- ```.`` jumps to last edited position
-
In file using Tagbar
<F4>opens/closes Tagbar window.<Enter>or click on function name takes you to function definition.<p>on function name takes you to function definition, but focus stays in tagbar.<P>on function name opens function in preview window.<Ctrl-W><Ctrl-Z>or:pcclose preview window.
More on tagbar page.
-
<F2>to save current file to disk. -
ZZto save current file and close it. In GVim it keeps editor open. -
:bddcloses current buffer, but keeps window split. -
<F3>to toggle current fold open/close. -
zRto open all folds. -
zMto close all folds. -
<Ctrl-K><Ctrl-L>highlight word under cursor in whole file. -
<Ctrl-K><Ctrl-I>will toggle indent lines if you need to copy text. -
<Ctrl-K><Ctrl-P>toggles comment on current line/selection -
<Ctrl-K><Ctrl-[>adds comment on current line/selection -
<Ctrl-K><Ctrl-]>removes comment from current line/selection It is impossible at all to map<Ctrl-/>in Vim :(. So please get used to these shortcuts. -
<Leader>=to align vertically=>map keys. -
<Leader>-to align vertically->function/case clauses. -
<Leader>:to align vertically:map or Keyword list keys. -
<Leader>eqto align vertically=assignment signs. -
<Leader>$or<Leader>trailingto remove trailing spaces from all lines.
:maketo compile changed files and show only errors<Leader>xcto compile changed files and show errors+warnings<Leader>x!to compile whole project and show errors+warnings:cwto open quickfix window]ego to next error/warning[ego to previous error/warning
-
<Leader>xaruns ExUnit tests on whole project -
<Leader>xfruns ExUnit tests on current file -
<Leader>xlruns ExUnit tests on current line of current file -
<Leader>xxrepeats last executed command -
<Leader>waruns in background ExUnit tests on whole project -
<Leader>wfruns in background ExUnit tests on current file -
<Leader>wlruns in background ExUnit tests on current file:line -
<Leader>wwruns again in background last executed command -
<Leader>wsor<Leader>wcstop automatic test execution on save. -
:cwto open quickfix window -
]ego to next error -
[ego to previous error -
<Leader>ttopens correlative source/test file -
<Leader>tsopens correlative source/test file in horizontal split -
<Leader>tvopens correlative source/test file in vertical split -
<Leader>t!opens correlative source/test, creates directories if necessary -
<Leader>tgor<Leader>gtopens last auto-run test file
Commands wf, wl, xf and xl will jump to corresponding test file if
issued in source file buffer.
<Leader>teexecute ExUnit test under cursor with tracing and window with trace output (mnemonics: Trace Exunit)<Leader>tyexecute selected text with tracing and show trace (mnemonics: Trace Yanked).
In trace window
<Enter>opens file with module/function under cursor and changes windowpopens file with module/function under cursor and stays in trace window%jumps to matching call/return lines;,,jumps back/forward to same function call(,)jumps back/forward to next function call/return (skips messages){,}jumps back/forward over repeated function callsF3opens arguments fold; also when cursor is on function call/ret line
More on vim-elixir-smarttrace page.
:Gstatus- show modified files and staged status-(in normal mode) on file name moves between staged/unstaged modep(in normal mode) on file name allows to stage/unstage only parts of the file.d(in normal mode) on file name opens diff between working copy and repository:Gcommitstarts commit of staged files (use save/exit to commit, clear message to abort)
:Gdiff- shows diff between current file and repository
More on vim-figutive page.
<Ctrl-X>opens XTerm in current directory