My main takeaways from the text above.
*
to search the word under the cursorset incsearch
to jump to the matching /pattern
set hlsearch
to highlight the matching /pattern
%
to jump from an open brace to its matching closing brace[{
and ]}
to jump to the opening/closing brace of the current code blockgd
to jump to the declaration of local variableThree basic steps of learning a new shortcut movement on vim:
[There's a mention to the ctags
program. And I think I should be more familiar with it.]
.
command to repeat last changeqa
to start recording into register 'a', do your commands, and then q
to stop recording.@a
when you want to repeat those commands.:help text-objects
).ctrl-n
to get a list of suggestions of words to completeTip to quickly fix typos:
:abbr Lunix Linux
:abbr hte the
:abbr accross across
Use syntax highlight.
In Vim it [ortographic correction] is implemented with scripts and you can further tune it for your own use: for example, to only check the comments in a program for spelling errors.
[Unfortunately the author doesn't mention any direction about how to achieve that (not even a doc).]
You should be able to take advantage of your editor to make working with several files more efficient.
[ This is a field that I think I'm inefficient. Maybe this content about ctags can be useful: https://kulkarniamit.github.io/whatwhyhow/howto/use-vim-ctags.html ]
The usual approach is to generate a tags file for the whole project you are working on. You can then quickly jump between all files in the project to find the definitions of functions, structures, typedefs, etc. The time you save compared with manually searching is tremendous; creating a tags file is the first thing I do when browsing a program.
:grep
command[I
with the cursor under a function name to show a list of all matches for the function name in included files.You can send the contents selected text (with Visual mode) to an external program.
" sort the selected text
:!sort
" send the selected text to the sort in
" a different buffer (don't change selection)
:w !sort
Unfortunately it's not that simple to bring the Vim power to every other application. But it's possible to do it with VSCode/NeoVim (which is life changing). Looks like it's also possible to embed neovim in browsers: https://github.com/glacambre/firenvim.
:make
commanderrorformat
optionLearn in small chunks.