Vim
The best text editing experience you will ever get. It is worth learning it as you will start thinking about text editing differently.
I use some kind of vim bindings in any app I use and if there is a vim plugin for the app, I often use it. I use vim editor often when connecting to remote sessions and when I need a console editor.
I use Neovim instead of vim and my vimrc can be found here. And here are all the plugins I use with it.
I switch between Ayu Light and Ayu Mirage themes as I change between macOS appearances.
Ayu Light
Ayu Mirage
I also use a little trick where I change the cursor from thin block in insert mode to underline when in normal mode. This lets me quickly know which mode I am in.

Notes

  • I can profile vim startup time with startuptime.
  • I can run :CheckHealth to see if there is anything wrong with my installation (only Neovim).
  • Get plugins that meet your needs.
  • You're more likely to find useful plugins if you approach it the other way around: I want to do X, vim can't do it nicely by itself, which plugin can help me do it.
  • If something doesn't work in vimrc, put the binding in the bottom of vimrc (perhaps something overrides it).

Code

1
" Insert text in the end of each line
2
" s/ - substitute.
3
" $ - the end of the line.
4
" / - change it to.
5
" , - a comma.
6
:%s/$/,
Copied!
1
" Lowercase line
2
Vu
Copied!
1
" Find char backwards
2
F<char>
Copied!
1
" Delete backwards until char
2
dT<char>
Copied!
1
" Visually select until char
2
v/<char><return>
Copied!
1
" Delete all lines in file
2
:%d
Copied!
1
" Yank two inner words
2
" Yanks first and second words (with the trailing space) in the unnamed register
3
y2aw
Copied!
1
" Delete until start of line
2
d0
Copied!
1
" Yank entire file
2
:%y+
Copied!
1
" Select entire block
2
Vat
Copied!
1
" Visually select until end of line
2
v$
Copied!
1
" Visually select paragraph or function
2
V}
Copied!
1
" See whats in a buffer
2
" See insides of q buffer
3
:echo @q
Copied!
1
" See registers
2
:registers
Copied!
1
" Delete until end of file
2
VGx
Copied!
1
" Visually select block
2
V%
Copied!
1
" Start recording macro
2
" Record to register d
3
qd
Copied!
1
" Delete char under cursor
2
x
Copied!
1
" Yank inside tag. Can yank an XML tag for example
2
yat
Copied!
1
" Make multi line search. https://vim.fandom.com/wiki/Search_across_multiple_lines
2
" Will carry over to new line
3
\_s
Copied!
1
" Inclusive search
2
/foo/e
Copied!
1
" Delete until searched string. Won't delete string itself.
2
d/string
Copied!
1
" Search and replace
2
:%s/<search>/<replace>/g
Copied!
1
" Run command on startup
2
" Run ':Goyo' on startup. Put it in .vimrc
3
autocmd VimEnter * Goyo"
Copied!
1
" Insert text at start of each line in file
2
" Insert // at start of each line in file
3
:%s!^!//!
Copied!
1
" Replay last macro
2
@@
Copied!
1
" Delete until character
2
df<char>
Copied!
1
" Centre current line
2
zz
Copied!
1
" Put results of command into a register
2
" In normal mode, will put results of d$ command into _ (black hole register)
3
"_d$
Copied!
1
" Run macro on whole file
2
:%normal @x " will run macro x
Copied!

Links

Last modified 1mo ago
Copy link