tricky
[!TIP|label:references:]
mode
diff
mode
diff
mode[!NOTE|label:references:]
example
terminal
mode
terminal
mode[!NOTE|label:references:]
Options: 'modified', 'scrollback'
Highlight groups: hl-TermCursor, hl-TermCursorNC
<empty>
: normal buffer
acwrite
: buffer will always be written withBufWriteCmd
s
help
: help buffer (do not set this manually)
nofile
: buffer is not related to a file, will not be written
nowrite
: buffer will not be written
quickfix
: list of errors:cwindow
or locations:lwindow
terminal
:terminal-emulator
buffer
prompt
: buffer where only the last line can be edited, meant to be used by a plugin, see |prompt-buffer|
usage:
open
top
command line in vsplit
shortcuts
combine multiple lines with or without space
with space:
J
without space:
gJ
or:j!
gcw
capitalize word (from cursor position to end of word)
gcW
capitalize WORD (from cursor position to end of WORD)
gciw
capitalize inner word (from start to end)
gciW
capitalize inner WORD (from start to end)
gcis
capitalize inner sentence
gc$
capitalize until end of line (from cursor postition)
gcgc
capitalize whole line (from start to end)
gcc
capitalize whole line
{Visual}gc
capitalize highlighted text
[!NOTE|label:references:]
lowercase
uppercase
reverse
more
g~3w
: toggle case of the next three wordsg~$
: toggle case to the end of lineg~iw
: toggle case of the current word (inner word – cursor anywhere in word)g~~
==g~g~
: toggle case of the current line (same as V~ - cursor anywhere in the line)gUU
==gUgU
: to uppercase of the current line (same as V~ - cursor anywhere in the line)guu
==gugu
: to lowercase of the current line (same as V~ - cursor anywhere in the line)
counter
[!NOTE|label:references]
[!NOTE|label:references:]
or
~/.vimrc
commands
[!NOTE|label:references:]
[!NOTE|label:reference:]
CMD
ignorecase
smartcase
MATCHES
foo
off
-
foo
foo
on
-
foo Foo FOO
foo
on
on
foo Foo FOO
Foo
on
on
Foo
Foo
on
-
foo Foo FOO
\cfoo
-
-
foo Foo FOO
foo\C
-
-
foo
search with \V
/a.k.a<CR>
backward a.k.a
/a\.k\.a<CR>
backward a.k.a
/Va.k.a<CR>
backward a.k.a
search in visual mode
[!NOTE]
v
go to visual mode/KEYWORDS
search next KEYWORDS |?KEYWORDS
search previous KEYWORDSenter
[!NOTE|label:references:]
sort
sort and unique
or
or and use:
for f in GetFiletypes() | echo f | endfor
reference:
- [Vim documentation: pattern](http://vimdoc.sourceforge.net/htmldoc/pattern.html#/%5Cr) : - `\n` matches an end of line (newline) - `\r` matches a carriage return (more precisely it’s treated as the input `CR`))
redirect cmd
[!NOTE|label:references:]
to new window
format json in vim
[!NOTE|label:references:]
related commands:
:argdo
: all files in argument list
:bufdo
: all buffers
:tabdo
: all tabs
:windo
: all windowsreference:
replace
force the
bufdo
to continue without saving files via:bufdo!
close buffer when close window
commands
autocmd
switch in buffers
next buffer: ctrl + ^
previous buffer: ctrl + 6
first:
:1b<CR>
last:
:$b<CR>
show ascii under cursor
[!NOTE|label:references:]
keyboard
ga
commands
open vim with specific line Number
[!NOTE|label:reference]
jumplist
[!TIP|label:tips:]
:help ''
`:help ```
relative path: ctrl + g or
print full path
encryption with Vim
encrypt
decrypt
config
get platform
[!NOTE|label:references:]
disable vim beep
pastetoggle
[!NOTE|label:references:]
:set paste
:set nopaste
:set pastetoggle=<F2>
details
When the 'paste' option is switched on (also when it was already on):
mapping in Insert mode and Command-line mode is disabled
abbreviations are disabled
'autoindent' is reset
'expandtab' is reset
'hkmap' is reset
'revins' is reset
'ruler' is reset
'showmatch' is reset
'smarttab' is reset
'softtabstop' is set to 0
'textwidth' is set to 0
'wrapmargin' is set to 0
'varsofttabstop' is made empty These options keep their value, but their effect is disabled:
'formatoptions' is used like it is empty
run vim commands in terminal
[!NOTE|label:manual:]
additional highlight
reference:
overview of multi items
/star
*
\*
0 or more (as many as possible)
/\+
\+
\+
1 or more (as many as possible)
/\=
\=
\=
0 or 1 (as many as possible)
/\?
\?
\?
0 or 1 (as many as possible)
/\{
\{n,m}
\{n,m}
n to m (as many as possible)
\{n}
\{n}
n exactly
\{n,}
\{n,}
at least n (as many as possible)
\{,m}
\{,m}
0 to m (as many as possible)
\{}
\{}
0 or more (as many as possible. same as *
)
/\{-
\{-n,m}
\{-n,m}
n to m (as few as possible)
\{-n}
\{-n}
n exactly
\{-n,}
\{-n,}
at least n (as few as possible)
\{-,m}
\{-,m}
0 to m (as few as possible)
\{-}
\{-}
0 or more (as few as possible)
overview of ordinary atoms
/^
^
^
start-of-line (at start of pattern) /zero-width
/\^
\^
\^
literal '^'
/\_^
\_^
\_^
start-of-line (used anywhere) /zero-width
/$
$
$
end-of-line (at end of pattern) /zero-width
/\$
\$
\$
literal '$'
/\_$
\_$
\_$
end-of-line (used anywhere) /zero-width
/.
.
\.
any single character (not an end-of-line)
/\_.
\_.
\_.
any single character or end-of-line
/\<
\<
\<
beginning of a word /zero-width
/\>
\>
\>
end of a word /zero-width
/\zs
\zs
\zs
anything, sets start of match
/\ze
\ze
\ze
anything, sets end of match
/\%^
\%^
\%^
beginning of file /zero-width E71
/\%$
\%$
\%$
end of file /zero-width
/\%V
\%V
\%V
inside Visual area /zero-width
/\%#
\%#
\%#
cursor position /zero-width
/\%'m
\%'m
\%'m
mark m position /zero-width
/\%l
\%23l
\%23l
in line 23 /zero-width
/\%c
\%23c
\%23c
in column 23 /zero-width
/\%v
\%23v
\%23v
in virtual column 23 /zero-width
every 3rd
the 3rd
\v
: the following chars in the pattern are "very magic":
^\(.\{-}\zsPATTERN\)\{N}
== >\v^(.{-}\zsPATTERN){N}
^\(.\{-}\zs=\)\{N}
== >\v^(.{-}\zs\=){N}
NOTICE: after using \v
the =
should using \=
instead
characters
[!NOTE|label:references:]
(none)
decimal
3
255
-
o
or O
octal
3
377
(255)
x
or X
hexadecimal
2
ff
(255)
u
hexadecimal
4
ffff
(65535)
U
hexadecimal
8
7fffffff
(2147483647)
insert unicode
via hex
[!NOTE|label:references:]
i.e.:
steps:
esc : return to normal mode ( optional )
i || o || a || ... : insert mode
ctrl + v
insert
u2b38
oru2911
: 4 digits usingu
emoji
1F926
: 🤦 : Face Palm Emojisteps:
esc : return to normal mode ( optional )
i || o || a || ... : insert mode
ctrl + v
insert
U2b38
orU2911
: >4 digits usingU
via digraph char
[!NOTE|label:refrences:]
i.e.:
3c ㈢ 12834
4c ㈣ 12835
5c ㈤ 12836
steps:
esc : return to normal mode ( optional )
i || o || a || ... : insert mode
ctrl + k
insert
3c
or4c
or5c
![i_ctrl-k](../screenshot/vim/digraphs -i_ck-1.gif)
micro
[!NOTE|label:references:]
stop macro at the end of line
others
[!NOTE|label:references:]
[!NOTE|label:references:]
binary mode by
-b
binary
ontextwidth
0modeline
offexpandtab
off
or
comments
[!NOTE|label:references:]
statueline
[!NOTE|label:references:]
sample
ctags
[!NOTE|label:references:]
Last updated