Vim
Next Steps
Projects
Incubating Links To Read
- VimLog – a ChangeLog for Vim
- vimrc tips · myitcv/govim Wiki
- History and effective use of Vim
- .vim/xxd.vim at 7138beef974b3510f0dc92b7629ad236ddd39ec9 · the9ball/.vim
- Style and Diction - GNU Project - Free Software Foundation (FSF)
Reference
- Learn Vimscript the Hard Way
- How I'm able to take notes in mathematics lectures using LaTeX and Vim | Gilles Castel
Ex Ranges
- source
- place cursor on line 4
:1,+1p
(line 1 through line 5):1;+2p
(line 1 through line 2, note that this moves the cursor)
'clipboard
:set clipbboard=unnamedplus
to make default yank etc go to"+
- Handy when doing lots of migrating from one doc to another
"0
/ "1
/ "_
"0
is populated by yank, not delete."1
is populated by change or delete unless a register is specified."_
can be used to disable the population of any register.
Regex Tricks
\V
~~grep -F
%(
~~ perl's(?:
\zs
/\ze
controls matchs/foo \zsbar\ze baz/biff/
replacesfoo bar baz
withfoo biff baz
q:
/ q/
- relevant blog post
- edit search or command history in command window
- press
<C-f>
to upgrade to this - press
<Enter>
to exit
:t
/ :m
- Allows "remote" copying (ie no moving cursor)
- Examples:
:t .
==yyp
:1t 2
== copy line one to line 3 (or to the end of line 2):m
does the same thing, except moves instead of copies
:g
/ :vg
- Runs an ex command for each match
:g/\v^\s*#/delete
:vg
inverts the match (likegrep -v
)
:makeprg
/ 'errorformat
- Investigate using these for more automation
Wild Mode
When tab completing files (etc) use C-N or C-P to go forward or back in the list, respectively.
Profiling
Profiling TL;DR:
- Start a profile to a file with
:profile start <filename>
- Pick what you profile with a pattern:
:profile! file {pattern}
Here's how I debugged an issue with :Done
being too slow:
#!/bin/sh
exec vim --cmd 'profile start prof.result' \
--cmd 'profile! file *' \
-S ~/.vvar/sessions/wnotes \
-c 'Done'