- Dot formula: one keystroke to move, on keystroke to execute
- Start vim without loading the vimrc
vim -u NONE -N
- Start with minimal built-in vim plugings
# vim file to source vim/essential.vim
set nocompatible
filetype plugin on
# Source with
vim -u vim/essential.vim
- Jump to last edited position:
g;
<C-h>
Delete back one character<C-w>
Delete back one word<C-u>
Delete back to start of the line
One needs to run a normal command when in insert mode and get back to insert mode right after.
When in insert mode, type <C-o>
.
- Center buffer when in insert mode:
<C-o>zz
- Yank a pasted word from insert mode:
<C-r>0
- Previous yanked words are rotated into registered
0-9
# Paste last yanked thing
Normal mode: 0p
Insert Mode: <C-r>0
-
When searching,
\n
is a newline -
When replacing,
\r
is a newline -
Perform substitution
:s/target/replacement
- Repeat
&
- Reverse
u
- Confirm a substitution
:s/target/replacement/gc
Redo
One can continue with a numbered or named registered:
a - z
the named registers"
the unnamed register, containing the text of the last delete or yank%
the current file name#
the alternate file name*
the clipboard contents (X11: primary selection)+
the clipboard contents/
the last search pattern:
the last command-line.
the last inserted text-
the last small (less than a line) delete=5*5
insert 25 into text (mini-calculator)
To list registers: :reg
or :registers
or :di
- Target (HEAD):
//2
-> Left side - Merge:
//3
-> Right side - Working copy: middle
- Vertical split 3 way merge
:Gvdiff
- Horizontal split 3 way merge
:Gsdiff
- Changeset Navigation
]c
: next changeset[c
: previous changeset
- Select from target: On working copy run
:diffget //2
- Select from merge: On working copy run
:diffget //3
- Put from target to working copy:
diffput $working-copy-identifier
- Chain commands:
diffput demo | diffupdate
- Mark the patch complete:
diffupdate
- When all conflicts have been resolved, close all but working copy with
:only
- Stage the working copy with
:Gwrite
- Keep Target / Merge entirely and adds it to the index:
Gwrite!
- Warning: It will lose the working copy
Action | Command |
---|---|
Show jump list | :ju[mps] |
Previous jump | <C-o> |
Next jump | <C-i> |
Action | Command |
---|---|
Show change list | :changes |
Jump to location of older change | g; |
Jump to location of newer change | g, |
Action | Command |
---|---|
Open quickfix list | :cope[n] |
Close quickfix list | :ccl[ose] |
Previous location | :cp[revious] / [q* |
Next location | :cn[ext] / ]q* |
First location | :cfir[st] / [Q* |
Last location | :cla[st] / ]Q* |
Action | Command |
---|---|
Open location list | :lope[n] |
Close location list | :lcl[ose] |
Previous location | :lp[revious] / [l* |
Next location | :lne[xt] / ]l* |
First location | :lfir[st] / [L* |
Last location | :lla[st] / ]L* |
Action | Command |
---|---|
Show buffer list | :buffers / :ls |
Previous buffer | :bp[revious] / [b* |
Next buffer | :bn[ext] / ]b* |
First buffer | :bf[irst] / [B* |
Last buffer | :bl[ast] / ]B* |
Neovim needs the neovim
and pynvm
packages available to function properly.
Here is how to configure an environment and make it available to neovim:
- Create a conda environment
$ conda create -n pynvim python=3.7
- Install the dependencies
$ conda activate pynvim
$ conda install pynvim neovim
- Set the
python3_host_prog
neovim variable to the env path:
$ which python
let g:python3_host_prog='RESULT_OF_PREVIOUS_COMMAND'