mirror of
https://github.com/namibia/awesome-cheatsheets.git
synced 2024-12-18 16:41:58 +00:00
Vim: cheatsheet reorganization
This commit is contained in:
parent
9014e77b04
commit
54a5df7c84
245
tools/vim.txt
245
tools/vim.txt
@ -1,10 +1,12 @@
|
|||||||
*************
|
##############################################################################
|
||||||
* Vim *
|
# VIM CHEATSHEET
|
||||||
*************
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
CURSOR MOVEMENT
|
##############################################################################
|
||||||
===============
|
# CURSOR MOVEMENTS
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
h move left
|
h move left
|
||||||
j move down
|
j move down
|
||||||
@ -46,8 +48,10 @@ tx search line forward before 'x'
|
|||||||
Tx search line backward before 'x'
|
Tx search line backward before 'x'
|
||||||
|
|
||||||
|
|
||||||
BOOKMARKS
|
##############################################################################
|
||||||
=========
|
# BOOKMARKS
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
:marks list all the current marks
|
:marks list all the current marks
|
||||||
ma make a bookmark named a at the current cursor position
|
ma make a bookmark named a at the current cursor position
|
||||||
@ -56,8 +60,10 @@ ma make a bookmark named a at the current cursor position
|
|||||||
`. go to the line that you last edited
|
`. go to the line that you last edited
|
||||||
|
|
||||||
|
|
||||||
INSERT MODE
|
##############################################################################
|
||||||
===========
|
# INSERT MODE
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
i start insert mode at cursor
|
i start insert mode at cursor
|
||||||
I insert at the beginning of the line
|
I insert at the beginning of the line
|
||||||
@ -68,8 +74,10 @@ O open blank line above current line
|
|||||||
Esc exit insert mode
|
Esc exit insert mode
|
||||||
|
|
||||||
|
|
||||||
EDITING
|
##############################################################################
|
||||||
=======
|
# EDITING
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
r replace a single character (does not use insert mode)
|
r replace a single character (does not use insert mode)
|
||||||
R enter Insert mode, replacing characters rather than inserting
|
R enter Insert mode, replacing characters rather than inserting
|
||||||
@ -99,8 +107,10 @@ ddkp swap current line with previous
|
|||||||
:r !{cmd} execute {cmd} and insert its standard output below the cursor.
|
:r !{cmd} execute {cmd} and insert its standard output below the cursor.
|
||||||
|
|
||||||
|
|
||||||
DELETING TEXT
|
##############################################################################
|
||||||
=============
|
# DELETING TEXT
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
x delete current character
|
x delete current character
|
||||||
X delete previous character
|
X delete previous character
|
||||||
@ -110,8 +120,10 @@ D delete from cursor to end of line
|
|||||||
:[range]d delete [range] lines
|
:[range]d delete [range] lines
|
||||||
|
|
||||||
|
|
||||||
COPYING AND MOVING TEXT
|
##############################################################################
|
||||||
=======================
|
# COPYING AND MOVING TEXT
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
yw yank word
|
yw yank word
|
||||||
yy yank (copy) a line
|
yy yank (copy) a line
|
||||||
@ -120,7 +132,6 @@ y$ yank to end of line
|
|||||||
p put (paste) the clipboard after cursor/current line
|
p put (paste) the clipboard after cursor/current line
|
||||||
P put (paste) before cursor/current line
|
P put (paste) before cursor/current line
|
||||||
:set paste avoid unexpected effects in pasting
|
:set paste avoid unexpected effects in pasting
|
||||||
|
|
||||||
:registers display the contents of all registers
|
:registers display the contents of all registers
|
||||||
"xyw yank word into register x
|
"xyw yank word into register x
|
||||||
"xyy yank line into register x
|
"xyy yank line into register x
|
||||||
@ -132,8 +143,10 @@ P put (paste) before cursor/current line
|
|||||||
:[line]put x put the text from register x after [line]
|
:[line]put x put the text from register x after [line]
|
||||||
|
|
||||||
|
|
||||||
MACROS
|
##############################################################################
|
||||||
======
|
# MACROS
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
qa start recording macro 'a'
|
qa start recording macro 'a'
|
||||||
q end recording macro
|
q end recording macro
|
||||||
@ -141,8 +154,10 @@ q end recording macro
|
|||||||
@: replay last command
|
@: replay last command
|
||||||
|
|
||||||
|
|
||||||
VISUAL MODE
|
##############################################################################
|
||||||
===========
|
# VISUAL MODE
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
v start visual mode, mark lines, then do command (such as y-yank)
|
v start visual mode, mark lines, then do command (such as y-yank)
|
||||||
V start linewise visual mode
|
V start linewise visual mode
|
||||||
@ -157,8 +172,9 @@ ib inner () block
|
|||||||
ib inner {} block
|
ib inner {} block
|
||||||
Esc exit visual mode
|
Esc exit visual mode
|
||||||
|
|
||||||
Visual mode commands
|
VISUAL MODE COMMANDS
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
> shift right
|
> shift right
|
||||||
< shift left
|
< shift left
|
||||||
c change (replace) marked text
|
c change (replace) marked text
|
||||||
@ -167,8 +183,10 @@ d delete marked text
|
|||||||
~ switch case
|
~ switch case
|
||||||
|
|
||||||
|
|
||||||
SPELLING
|
##############################################################################
|
||||||
========
|
# SPELLING
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
]s next misspelled word
|
]s next misspelled word
|
||||||
[s previous misspelled word
|
[s previous misspelled word
|
||||||
@ -177,8 +195,10 @@ zug undo last add word
|
|||||||
z= suggest word
|
z= suggest word
|
||||||
|
|
||||||
|
|
||||||
EXITING
|
##############################################################################
|
||||||
=======
|
# EXITING
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
:q quit Vim. This fails when changes have been made.
|
:q quit Vim. This fails when changes have been made.
|
||||||
:q! quit without writing.
|
:q! quit without writing.
|
||||||
@ -192,8 +212,10 @@ ZZ write current file, if modified, and exit.
|
|||||||
ZQ quit current file and exit (same as ":q!").
|
ZQ quit current file and exit (same as ":q!").
|
||||||
|
|
||||||
|
|
||||||
SEARCH/REPLACE
|
##############################################################################
|
||||||
==============
|
# SEARCH/REPLACE
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
/pattern search for pattern
|
/pattern search for pattern
|
||||||
?pattern search backward for pattern
|
?pattern search backward for pattern
|
||||||
@ -207,9 +229,10 @@ N repeat search in opposite direction
|
|||||||
with new in every file with confirmation, save and quit
|
with new in every file with confirmation, save and quit
|
||||||
|
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
# MULTIPLE FILES
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
MULTIPLE FILES
|
|
||||||
==============
|
|
||||||
|
|
||||||
:e filename edit a file in a new buffer
|
:e filename edit a file in a new buffer
|
||||||
:tabe filename edit a file in a new tab (Vim7, gVim)
|
:tabe filename edit a file in a new tab (Vim7, gVim)
|
||||||
@ -221,8 +244,10 @@ MULTIPLE FILES
|
|||||||
:b vimrc show buffer whose filename begins with "vimrc"
|
:b vimrc show buffer whose filename begins with "vimrc"
|
||||||
|
|
||||||
|
|
||||||
WINDOWS
|
##############################################################################
|
||||||
=======
|
# WINDOWS
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
:sp f split open f
|
:sp f split open f
|
||||||
:vsp f vsplit open f
|
:vsp f vsplit open f
|
||||||
@ -241,8 +266,10 @@ CTRL-w = equal window
|
|||||||
CTRL-w o close other windows
|
CTRL-w o close other windows
|
||||||
|
|
||||||
|
|
||||||
QUICKFIX WINDOW
|
##############################################################################
|
||||||
===============
|
# QUICKFIX WINDOW
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
copen open quickfix window
|
copen open quickfix window
|
||||||
cclose close quickfix window
|
cclose close quickfix window
|
||||||
@ -253,8 +280,10 @@ clast display the last error
|
|||||||
[count]cp display [count] previous error
|
[count]cp display [count] previous error
|
||||||
|
|
||||||
|
|
||||||
PROGRAMMING
|
##############################################################################
|
||||||
===========
|
# PROGRAMMING
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
% show matching brace, bracket, or parenthese
|
% show matching brace, bracket, or parenthese
|
||||||
gf edit the file whose name is under or after the cursor
|
gf edit the file whose name is under or after the cursor
|
||||||
@ -265,14 +294,10 @@ CTRL-o move to previous position you were at
|
|||||||
CTRL-i move to more recent position you were at
|
CTRL-i move to more recent position you were at
|
||||||
|
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
# PLUGINS > ACK
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
*************
|
|
||||||
* PLUGINS *
|
|
||||||
*************
|
|
||||||
|
|
||||||
|
|
||||||
ACK (plugin)
|
|
||||||
============
|
|
||||||
|
|
||||||
:Ack Search recursively in directory
|
:Ack Search recursively in directory
|
||||||
o to open (same as enter)
|
o to open (same as enter)
|
||||||
@ -282,49 +307,62 @@ T to open in new tab silently
|
|||||||
q to close the quickfix window
|
q to close the quickfix window
|
||||||
|
|
||||||
|
|
||||||
CHEAT (plugin)
|
##############################################################################
|
||||||
==============
|
# PLUGINS > CHEAT
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
:Cheat open cheat sheet (with autocomplete)
|
:Cheat open cheat sheet (with autocomplete)
|
||||||
<leader>ch open cheat sheet for word under the cursor
|
<leader>ch open cheat sheet for word under the cursor
|
||||||
|
|
||||||
|
|
||||||
GIST (plugin)
|
##############################################################################
|
||||||
=============
|
# PLUGINS > GIST
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
:Gist post whole text to gist
|
:Gist post whole text to gist
|
||||||
:Gist XXXXX get gist XXXXX
|
:Gist XXXXX get gist XXXXX
|
||||||
:Gist -l list my gists
|
:Gist -l list my gists
|
||||||
|
|
||||||
|
|
||||||
GUNDO (plugin)
|
##############################################################################
|
||||||
==============
|
# PLUGINS > GUNDO
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
:GundoToggle show undo tree
|
:GundoToggle show undo tree
|
||||||
|
|
||||||
|
|
||||||
LUSTYJUGGLER (plugin)
|
##############################################################################
|
||||||
=====================
|
# PLUGINS > LUSTYJUGGLER
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
<Leader>lj show open buffers
|
<Leader>lj show open buffers
|
||||||
|
|
||||||
|
|
||||||
NERDCOMMENTER (plugin)
|
##############################################################################
|
||||||
======================
|
# PLUGINS > NERDCOMMENTER
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
<leader>cc comment out line(s)
|
<leader>cc comment out line(s)
|
||||||
<leader>c<space> toggle the comment state of the selected line(s)
|
<leader>c<space> toggle the comment state of the selected line(s)
|
||||||
|
|
||||||
|
|
||||||
NERDTREE (plugin)
|
##############################################################################
|
||||||
=================
|
# PLUGINS > NERDTREE
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
:NERDTreeToggle show / hide file browser
|
:NERDTreeToggle show / hide file browser
|
||||||
:NERDTreeFind show current file in file browser
|
:NERDTreeFind show current file in file browser
|
||||||
:Bookmark name bookmark the current node as "name"
|
:Bookmark name bookmark the current node as "name"
|
||||||
|
|
||||||
File
|
FILE
|
||||||
----
|
----
|
||||||
|
|
||||||
o open in prev window
|
o open in prev window
|
||||||
go preview
|
go preview
|
||||||
t open in new tab
|
t open in new tab
|
||||||
@ -334,23 +372,26 @@ gi preview split
|
|||||||
s open vsplit
|
s open vsplit
|
||||||
gs preview vsplit
|
gs preview vsplit
|
||||||
|
|
||||||
Directory
|
DIRECTORY
|
||||||
---------
|
---------
|
||||||
|
|
||||||
o open & close node
|
o open & close node
|
||||||
O recursively open node
|
O recursively open node
|
||||||
x close parent of node
|
x close parent of node
|
||||||
X close all child nodes of current node recursively
|
X close all child nodes of current node recursively
|
||||||
e explore selected dir
|
e explore selected dir
|
||||||
|
|
||||||
Bookmark
|
BOOKMARK
|
||||||
--------
|
--------
|
||||||
|
|
||||||
o open bookmark
|
o open bookmark
|
||||||
t open in new tab
|
t open in new tab
|
||||||
T open in new tab silently
|
T open in new tab silently
|
||||||
D delete bookmark
|
D delete bookmark
|
||||||
|
|
||||||
Tree navigation
|
TREE NAVIGATION
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
P go to root
|
P go to root
|
||||||
p go to parent
|
p go to parent
|
||||||
K go to first child
|
K go to first child
|
||||||
@ -358,8 +399,9 @@ J go to last child
|
|||||||
CTRL-j go to next sibling
|
CTRL-j go to next sibling
|
||||||
CTRL-k go to prev sibling
|
CTRL-k go to prev sibling
|
||||||
|
|
||||||
Filesystem
|
FILESYSTEM
|
||||||
----------
|
----------
|
||||||
|
|
||||||
C change tree root to the selected dir
|
C change tree root to the selected dir
|
||||||
u move tree root up a dir
|
u move tree root up a dir
|
||||||
U move tree root up a dir but leave old root open
|
U move tree root up a dir but leave old root open
|
||||||
@ -368,47 +410,59 @@ R refresh current root
|
|||||||
m show menu
|
m show menu
|
||||||
cd change the CWD to the selected dir
|
cd change the CWD to the selected dir
|
||||||
|
|
||||||
Tree filtering
|
TREE FILTERING
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
I hidden files
|
I hidden files
|
||||||
f file filters
|
f file filters
|
||||||
F files
|
F files
|
||||||
B bookmarks
|
B bookmarks
|
||||||
|
|
||||||
Other
|
OTHER
|
||||||
-----
|
-----
|
||||||
|
|
||||||
q close the NERDTree window
|
q close the NERDTree window
|
||||||
A zoom (maximize-minimize) the NERDTree window
|
A zoom (maximize-minimize) the NERDTree window
|
||||||
? toggle help
|
? toggle help
|
||||||
|
|
||||||
|
|
||||||
PDV (plugin)
|
##############################################################################
|
||||||
============
|
# PLUGINS > PDV
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
CTRL-P generate PHP DOC
|
CTRL-P generate PHP DOC
|
||||||
|
|
||||||
|
|
||||||
PICKACOLOR (plugin)
|
##############################################################################
|
||||||
===================
|
# PLUGINS > PICKACOLOR
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
:PickHEX choose color in system color picker
|
:PickHEX choose color in system color picker
|
||||||
|
|
||||||
|
|
||||||
SNIPMATE (plugin)
|
##############################################################################
|
||||||
=================
|
# PLUGINS > SNIPMATE
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
<tab> expand snippet
|
<tab> expand snippet
|
||||||
|
|
||||||
|
|
||||||
SPARKUP (plugin)
|
##############################################################################
|
||||||
================
|
# PLUGINS > SPARKUP
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
CTRL-e execute sparkup (zen coding expansion)
|
CTRL-e execute sparkup (zen coding expansion)
|
||||||
CTRL-n jump to the next empty tag / attribute
|
CTRL-n jump to the next empty tag / attribute
|
||||||
|
|
||||||
|
|
||||||
SURROUND (plugin)
|
##############################################################################
|
||||||
=================
|
# PLUGINS > SURROUND
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
cs'" change surrounding quotes to double-quotes
|
cs'" change surrounding quotes to double-quotes
|
||||||
cs(} change surrounding parens to braces
|
cs(} change surrounding parens to braces
|
||||||
@ -419,22 +473,28 @@ ysiw[ surround inner word with brackets
|
|||||||
vees' surround 2 words (ee) with quotes '
|
vees' surround 2 words (ee) with quotes '
|
||||||
|
|
||||||
|
|
||||||
TABULAR (plugin)
|
##############################################################################
|
||||||
================
|
# PLUGINS > TABULAR
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
:Tabularize /, line the selected lines up on the commas
|
:Tabularize /, line the selected lines up on the commas
|
||||||
|
|
||||||
|
|
||||||
TAGLIST (plugin)
|
##############################################################################
|
||||||
================
|
# PLUGINS > TAGLIST
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
:TlistToggle open / close taglist window
|
:TlistToggle open / close taglist window
|
||||||
<enter> jump to tag or file
|
<enter> jump to tag or file
|
||||||
<space> display the tag prototype
|
<space> display the tag prototype
|
||||||
|
|
||||||
|
|
||||||
UNIMPAIRED (plugin)
|
##############################################################################
|
||||||
===================
|
# PLUGINS > UNIMPAIRED
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
[space new line above
|
[space new line above
|
||||||
]space new line below
|
]space new line below
|
||||||
@ -448,8 +508,10 @@ UNIMPAIRED (plugin)
|
|||||||
]Q jump to last quickfix item
|
]Q jump to last quickfix item
|
||||||
|
|
||||||
|
|
||||||
VIM-FUGITIVE (plugin)
|
##############################################################################
|
||||||
=====================
|
# PLUGINS > VIM-FUGITIVE
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
:Git run a git command
|
:Git run a git command
|
||||||
:Gstatus git status : - to (un)stage , p to patch, C to commit
|
:Gstatus git status : - to (un)stage , p to patch, C to commit
|
||||||
@ -464,20 +526,26 @@ VIM-FUGITIVE (plugin)
|
|||||||
:Gbrowse open github
|
:Gbrowse open github
|
||||||
|
|
||||||
|
|
||||||
VIM-MARKDOWN-PREVIEW (plugin)
|
##############################################################################
|
||||||
=============================
|
# PLUGINS > VIM-MARKDOWN-PREVIEW
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
:Mm preview markdown document in webbrowser
|
:Mm preview markdown document in webbrowser
|
||||||
|
|
||||||
|
|
||||||
VIM-PEEPOPEN (plugin)
|
##############################################################################
|
||||||
=====================
|
# PLUGINS > VIM-PEEPOPEN
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
<Leader>p open the current directory with the peepopen application (fuzzy search)
|
<Leader>p open the current directory with the peepopen application (fuzzy search)
|
||||||
|
|
||||||
|
|
||||||
VIM-SYMFONY (plugin)
|
##############################################################################
|
||||||
====================
|
# PLUGINS > VIM-SYMFONY
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
:Sview open template file
|
:Sview open template file
|
||||||
:Saction open action file
|
:Saction open action file
|
||||||
@ -490,10 +558,9 @@ VIM-SYMFONY (plugin)
|
|||||||
:Symfony execute task
|
:Symfony execute task
|
||||||
|
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
*********************
|
# PERSONAL .VIMRC
|
||||||
* PERSONAL .VIMRC *
|
##############################################################################
|
||||||
*********************
|
|
||||||
|
|
||||||
|
|
||||||
<leader>ev edit vimrc file
|
<leader>ev edit vimrc file
|
||||||
|
Loading…
Reference in New Issue
Block a user