FakeVim Modes and Commands
In the FakeVim mode, most keystrokes in the main editor are intercepted and interpreted in a way that resembles Vim. Most of the supported commands can be followed by a motion command or executed in visual mode, or they work with registers, or can be prefixed with a number of repetitions.
The following sections describe the commands emulated in the supported modes and how they diverge from Vim in functionality:
- Normal
- Visual
- Command line (:)
- Insert and replace
For more information about using Vim, see Documentation on the Vim web site.
Normal and Visual Modes
- Basic movement, such as
h/j/k/l,<C-U>,<C-D>,<C-F>,<C-B>,gg,G,0,^,$ - Word movement, such as
w,e,b - Inner/a movement, such as
ciw,3daw, ya{ fandtmovement[ and \c ]movement- { and } paragraph movement
- Delete/change/yank/paste with register
- Undo and redo
<C-A>and<C-X>increase or decrease a number in decimal, octal, or hexadecimal format (for example128<C-A>on or before"0x0ff"changes it to"0x17f").repeats the last change/search,?search,*,#,n,N- most of regular expression syntax is used in Vim except that\<and\>are the same as\bin QRegExp@andq(macro recording and execution) special keys are saved as<S-Left>- Marks
gvgoes to last visual selection; can differ if text is edited around it- Indentation using
=,<<,>>, with movement, count, and in visual mode - to upper/lower, such as
~,gU,gu i,a,o,I,A, andOenter insert mode- Scroll window, such as
zt,zb,zz - Wrap line movement, such as
gj,gk,g0,g^,g$
Command-Line Mode
:map,:unmap,:inoremap, and so on:sourcesources vimrc files line-by-line:substitutesubstitutes an expression in a range:'<,'>!cmdfilters through an external command (for example, sorts the lines in a file with:%!sort):<range>sor[t][!]:.!cmdinserts the standard output of an external command:read:yank,:delete,:change:move,:join:20goes to an address:history:registers,:display:nohlsearch:undo,:redo:normal:<,:>set formatoptions=, see:h fo-tablein the Vim documentation. Currently supported letters:fo-j
Insert Mode
<C-O>executes a single command and returns to insert mode<C-V>inserts a raw character<insert>toggles replace mode
Options
Use :set ... to set the options listed in the following table:
| Long Name | Short Name | Arguments |
|---|---|---|
autoindent | ai | |
backspace | bs | indent, eol, start |
blinkingcursor | bc | |
clipboard | cb | |
expandtab | et | |
hlsearch | hls | |
ignorecase | ic | |
incsearch | is | |
iskeyword | isk | A combination of the following characters: @, 48-57, _, 192-255, a-z, A-Z |
relativenumber | rnu | |
scrolloff | so | |
shiftwidth | sw | |
showcmd | sc | |
smartcase | scs | |
smartindent | si | |
smarttab | sta | |
startofline | sol | |
tabstop | ts | |
tildeop | top | |
usecoresearch | ucs | |
wrapscan | ws |
Vimrc Example
" highlight matched set hlsearch " case insensitive search set ignorecase set smartcase " search while typing set incsearch " wrap-around when searching set wrapscan " show pressed keys in lower right corner set showcmd " tab -> spaces set expandtab set tabstop=4 set shiftwidth=4 " keep a 5 line buffer for the cursor from top/bottom of window set scrolloff=5 " X11 clipboard set clipboard=unnamed " use ~ with movement set tildeop " mappings nnoremap ; : inoremap jj <Esc> " clear highlighted search term on space noremap <silent> <Space> :nohls<CR> " reselect visual block after indent vnoremap < <gv vnoremap > >gv " MOVE LINE/BLOCK nnoremap <C-S-J> :m+<CR>== nnoremap <C-S-K> :m-2<CR>== inoremap <C-S-J> <Esc>:m+<CR>==gi inoremap <C-S-K> <Esc>:m-2<CR>==gi vnoremap <C-S-J> :m'>+<CR>gv=gv vnoremap <C-S-K> :m-2<CR>gv=gv
See also Edit like in Vim and FakeVim.