By reading the contents of this repository I realized that this is the things to do after finishing the vimtutor:
ctrl-]
to follow a vimdoc linkctrl-o
or ctrl-t
to go back:help Q_to
cheatsheet:help text-objects
- verbose:help quickref
skim over quickref just to know it exists and what's there (it's like a cheatsheet).vimrc
, a one-sentence description of the options assigned with set
can be seen in :help option-list
gq
(break lines at column 80) in the whole file and keep the cursor position.text objects and macros in vim: https://cloudacademy.com/course/text-objects-macros-vim-1413/text-objects/
ctags: https://kulkarniamit.github.io/whatwhyhow/howto/use-vim-ctags.html
https://thoughtbot.com/upcase/onramp-to-vim - the best video series I found to get started with vim.
Vim: tutorial on customization and configuration - by Leeren - advanced, very well reviewed
Vim as an IDE - by Leeren - VimConf talk
https://thoughtbot.com/upcase/the-art-of-vim - some useful vim tips
https://alldrops.info - useful vim drops
From the neovim tutor
vim-seven-habits-of-effective-text-editing
video in portuguese: https://www.youtube.com/watch?v=hdZMqMeruSQ
.vimrc
This is personal. I'm not taking notes of things I already memorized.
The commands are usually composed of a verb and a noun. Example: dw
, stands for delete a word.
Tip: usually the same key used two times in a row applies the verb in the whole line. Examples: dd
deletes the whole line, cc
change the whole line.
See :h motion
for more info.
mapping | summary |
---|---|
f<char> |
(f)ind a char forward in a line and move to it (F goes backward) |
t<char> |
find a char forward in a line and move un(t)il it (T goes backward) |
; |
repeat last f , F , t or T command |
, |
repeat last f , F , t or T command, but in opposite direction |
H , M , L |
move (H)igh, (M)iddle, or (L)ow within the viewport |
C-u , C-d |
move (u)p or (d)own |
Tip: prefer using text-objects rather than motions in order to increase repeatability.
See :h text-objects
for more options.
mapping | operation |
---|---|
iw , aw |
"inner word", "a word" (a word includes the space) |
is , as |
"inner sentece", "a sentece" |
ip , ap |
"inner paragraph", "a paragraph" |
i) , a) |
"inner parenthesis", "a parenthesis" |
i' , a' |
"inner single quote", "a single quote" |
it , at |
"inner tag", "a tag" (HTML tag) |
:set nu
or :set number
- line numbers
:set ai
| :set noai
- enable/disable autoindent
:set visualbell
- blink screen instead of sound
:ab md mydomain.intranet.com
- when you type md
it becomes mydomain.intranet.com
visualy select part of the text and :'<,'>$!sort
- sort the lines
:noh
- disables search highlight
set a default font in gvim: :set guifont=*
, choose the font config in the dialog box, then use :set guifont?
to see what you should put in your .vimrc
.
colorscheme evening
set number
set tabstop=2
set showcmd
set cursorline " gutter
Avoid too much configurations, but take a look at this one (which claims to be "defaults everyone can agree on"):
https://github.com/tpope/vim-sensible
It enables things like <C-L>
to clear hlsearch
, <C-W>
to delete previous word when in INSERT mode, etc.
The vim-plug is useful to install/update vim plugins.
Here's a way to install it at startup:
.vimrc
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
4:35 the language (basics)
5:36 repeatable & undoable
6:48 verbs/operators in vim
8:21 nouns in vim - motions
9:05 nouns in vim - text objects
12:18 nouns in vim - parameterized text objects (find/search)
16:33 where to learn/read
18:35 tips for mastering the language
20:35 relative number
22:45 visual mode is a smell
24:18 custom operators (from plugins)
29:52 custom nouns (objects)
33:30 Finding more custom text objects
Syntax of the language: Verb + Noun
Example:
Some verbs:
d
: deletec
: change (delete and enter insert mode)>
: indentv
: visually selecty
: yank (copy)Some nouns related to motions:
w
: wordb
: back2j
: down 2 linesSome nouns related to text objects:
iw
: inner word (works from anywhere in a word)it
: inner tag (the contents of an HTML tag)i"
: inner quotesip
: inner paragraphas
: a sentenceSome nouns related to parameterized text objects
f
, F
: find the next character, including it.t
, T
: find the next character, excluding it./
, ?
: search the string, not including the string.:set relativenumber
ds"
: delete surrounding quotescs("
: change surrounding parens to quotesysiw"
: add double quotes around the wordcst<h2>
: change surrounding tag to <h2>
Questions to be answered:
.md
extension when creating a new wiki page with <Enter>
?:w
?mynotes
)