viml
[!NOTE|label:references:]
expr
[!NOTE|label:references:]
equal
==
==#
==?
not equal
!=
!=#
!=?
greater than
>
>#
>?
greater than or equal
>=
>=#
>=?
smaller than
<
<#
<?
smaller than or equal
<=
<=#
<=?
regexp matches
=~
=~#
=~?
regexp doesn't match
!~
!~#
!~?
same instance
is
is#
is?
different instance
isnot
isnot#
isnot?
math
assert
list
system info
exists
file
returns the character index of the column position
line length
env
execute
path
others
buffer name
buffer number
others
autocmd
[!TIP|label:references:]
Listing 1. Event sequence in a simple Vim editing session
BufWinEnter: create a default window
BufEnter: create a default buffer
VimEnter: start the Vim session):edit demo.txt
BufNew: create a new buffer to contain demo.txt
BufAdd: add that new buffer to the session’s buffer list
BufLeave: exit the default buffer
BufWinLeave: exit the default window
BufUnload: remove the default buffer from the buffer list
BufDelete: deallocate the default buffer
BufReadCmd: read the contexts of demo.txt into the new buffer
BufEnter: activate the new buffer
BufWinEnter: activate the new buffer's window
InsertEnter: swap into Insert mode
stop gitblame in diff mode
[!NOTE|label:references:]
disable line number in terminal
[!NOTE|label:references:]
automatic cleanup tailing space when save
automatic save
[!NOTE|label:references:]
clean way to handle multiple autocommands
BufWritePost
[!NOTE|label:references:]
[!NOTE|label:manual:]
set option and value in autocmd
simple version
system
system file path
[!TIP]
slice string
show path of current file
[!TIP] references:
:echo @%
tricky.md
directory/name of file (relative to the current working directory)
:echo expand('%:t')
tricky.md
name of file ('tail')
:echo expand('%:p')
/Users/marslo/ibook/docs/vim/tricky.md
full path
:echo expand('%:p:h')
/Users/marslo/ibook/docs/vim
directory containing file ('head')
:echo expand('%:p:h:t')
vim
direct folder name
:echo expand('%:r')
tricky
name of file less one extension ('root')
:echo expand('%:e')
md
name of file's extension ('extension')
others
ctrl + g
:f
[!NOTE|label:references:]
[!NOTE|label:references:]
:map
:noremap
:unmap
Normal, Visual, Select, Operator-pending
:nmap
:nnoremap
:nunmap
Normal
:vmap
:vnoremap
:vunmap
Visualm Select
:smap
:snoremap
:sunmap
Select
:xmap
:xnoremap
:xunmap
Visual
:omap
:onoremap
:ounmap
Operator-pending
:map!
:noremap!
:unmap!
Insert, Command-line
:imap
:inoremap
:iunmap
Insert
:lmap
:lnoremap
:lunmap
Insert, Command-line, Lang-Arg
:cmap
:cnoremap
:cunmap
Command-line
:tmap
:tnoremap
:tunmap
Terminal-Job
[nore]map
yes
-
-
yes
yes
yes
-
-
n[nore]map
yes
-
-
-
-
-
-
-
[nore]map!
-
yes
yes
-
-
-
-
-
i[nore]map
-
yes
-
-
-
-
-
-
c[nore]map
-
-
yes
-
-
-
-
-
v[nore]map
-
-
-
yes
yes
-
-
-
x[nore]map
-
-
-
yes
-
-
-
-
s[nore]map
-
-
-
-
yes
-
-
-
o[nore]map
-
-
-
-
-
yes
-
-
t[nore]map
-
-
-
-
-
-
yes
-
l[nore]map
-
yes
yes
-
-
-
-
yes
:map
:noremap
:unmap
:mapclear
yes
yes
yes
:nmap
:nnoremap
:nunmap
:nmapclear
yes
-
-
:vmap
:vnoremap
:vunmap
:vmapclear
-
yes
-
:omap
:onoremap
:ounmap
:omapclear
-
-
yes
[!NOTE]
MACHTYPEA string that fully describes the system type on which Bash is executing, in the standard GNU cpu-company-system format
git bash
wsl
centos
more for
system()
time
functions
yank highlight
paste highlight
[!TIP|label:references:]
examples:
:s/a\|b/xxx\0xxx/g: modifies "a b" to "xxxaxxx xxxbxxx"`:s/([abc])([efg])/\2\1/g modifies "af fa bg" to "fa fa gb"
:s/abcde/abc^Mde/: modifies "abcde"to "abc", "de" (two lines)
:s/$/\^M/: modifies "abcde" to "abcde^M"
:s/\w\+/\u\0/g: modifies "bla bla" to "Bla Bla"
:s/\w\+/\L\u\0/g: modifies "BLA bla" to "Bla Bla"cmd:
:s/\<\(\w\)\(\w*\)\>/\u\1\L\2/g
:s/\<\(\w\)\(\S*\)/\u\1\L\2/g
:s#\v(\w)(\S*)#\u\1\L\2#g

[!NOTE|label:references:]
MacOS
IgnoreSpells
IgnoreCamelCaseSpell
TabMessage
TriggerYCM
DeleteCurBufferNotCloseWindow
[!NOTE]
AdjustWindowHeight
[!NOTE]
search
[!NOTE|label:references:]
commands
[!NOTE|label:references:]
execute
doctocin vim via command:Toc
get path
[!NOTE|label:references:]
:p
expand to full path
:h
head (last path component removed)
:t
tail (last path component only)
:r
root (one extension removed)
:e
extension only
:p
/home/mool/vim/src/version.c
:p:.
src/version.c
:p:~
~/vim/src/version.c
:h
src
:p:h
/home/mool/vim/src
:p:h:h
/home/mool/vim
:t
version.c
:p:t
version.c
:r
src/version
:p:r
/home/mool/vim/src/version
:t:r
version
:e
c
:s?version?main?
src/main.c
:s?version?main?:p
/home/mool/vim/src/main.c
:p:gs?/?\\?
\home\mool\vim\src\version.c
%
current file name
%<
current file name without extension
#
alternate file name for current window
#<
idem, without extension
#31
alternate file number 31
#31<
idem, without extension
<cword>
word under the cursor
<cWORD>
WORD under the cursor (see WORD )
<cfile>
path name under the cursor
<cfile><
idem, without extension
get home
[!NOTE|label:references:]
settings
[!NOTE|label:sample dot-vimrc]
theme
solarized
tricky
Last updated
Was this helpful?