Operator | Object Range Indicator | Object Range Symbol |
---|---|---|
c d v |
i |
w s p t (tag)[ ( { < b B ' " |
t (until) |
a character matched | |
/ |
word to search |
- Toggling boolean options
:set <name>
and:set no<name>
or:set <name>!
- Checking options state
:set <name>?
- Options with values
:set <name>
:set <name>=4
:set <name>?
- Setting multiple options at once
:set <name1> <name2>=6
- Setting options without '=' operation is setting boolean option
- Basic mapping
:map
- works in normal mode
- Special keys such as
<space>
and<c-d>
can be used
- Modal Mapping
*
map:nmap, :vmap, :imap
- http://learnvimscriptthehardway.stevelosh.com/chapters/04.html
- Unmapping
*
unmap:nunmap, :vunmap, :iunmap
:numap dd
- Be careful not to make recursive mapping
- Nonrecursive Mapping
*
noremap:noremap, :nnoremap, :vnoremap, :inoremap
- Use nonrecursive mapping
Always. No, seriously, always.
- Mapping key sequences using leader
- to avoid using keys that are being used already
- put leader which is a prefix key to map key sequences such as ',' and '-'
- Operator-Pending Mapping
:onoremap p i(
:normal >>
- will shift the sentense two times from the cursor
- https://stackoverflow.com/a/48952
- :scriptnames : list all plugins,
_vimrcs
loaded (super) - :verbose set history? : reveals value of history and where set
- :function : list functions
- :func SearchCompl : List particular function
- :scriptnames : list all plugins,
- will let you edit things through pipe
echo 'how things are going?' | EDITOR='vim' vipe
- to let someone edit an existing file and then save the result
cat test.txt | EDITOR='vim' vipe | tee test.txt
- When
vipe
is executed, it will open $EDITOR with the input entered through the pipe
vim -c "redir! > vimout | scriptnames | redir END | q"
vim -c ':set t_ti= t_te= nomore' -c 'scriptnames|q!'
echo '%s/blah/blahblahblah/g | write' | vim -e blah.txt
cat test.vim
%s/blah/blahblahblah/g
write
vim -e blah.txt < test.vim
- Autocommands can be duplicated
- The problem is that sourcing your ~/.vimrc file rereads the entire file, including any autocommands you've defined! This means that every time you source your ~/.vimrc you'll be duplicating autocommands, which will make Vim run slower because it executes the same commands over and over.
- Running VIM command on command line
vim -c smile
,vim -c ':smile'
orvim +smile
- Script like execution
vim -c '%s/words_to_change/words_to_be_replaced/g | write | quit' target_file.txt
- Learn Vimscript the Hard Way
- Combination of command and object
- Cheat Sheet
- neovim
- https://neovim.io/
- Forked from vim 7.?
- Tries to make vim light weight and well organized in code-wide?
- Has not yet reached its major release, 1.0 but the contributions and requests are very robust.