- Run vim without loading ~/.vimrc:
vim -u NONE
- Add quotes around a select word (Requires vim-surround):
S"
- Select entire word no matter where the cursor is:
viw
- Select entire word including trailing space no matter where the cursor is:
vaw
- Enclose entire line in quotes (Needs vim-surround plugin):
yss”
- Comment out paragraph (Requires vim-commentary):
gcap
- Delete quotes around a string:
ds"
- Convert buffers to tabs:
:tab ball
- Close buffer:
:bd
- Uppercase selection:
gU
- Lowercase selection:
gu
- Open file in horizontal split pane view:
:sp file
- Open file in vertical split pane view:
:vsp file
- Open two or more files in horizontal split panes:
vim -o file1 file2
- Open two or more files in vertical split panes:
vim -O file1 file2
- Open file at line 15:
vim 15 file
- Open new file in horizontal split pane:
:new
- Open new file in vertical split pane:
:vnew
- Toggle to next pane on the left:
ctrl-w-h
- Switch from horizontal pane to vertical pane:
ctrl-w-L
- Switch from vertical pane to horizontal pane:
ctrl-w-J
- Open file in new tab:
:tabe file
- Switch between tabs:
gt/gT
- Create/open an encrypted file:
vim -x file.txt
- Remove MS-DOS CRs from a file (CTRL-V to get ^M):
%s/^M$//g
- Change the case of a word:
g~w
- Switches the case of the whole line:
g~~
- Open file over SSH/SCP:
vim scp://hostname/path/to/file
- Open new file over SSH:
:new scp://hostname/path/to/newfile
- ROT13 a whole file: Go to the top of the file (
1G
), theng?G
- Switch buffers (next/previous)
:bn
/:bp
- Indent/Unindent the next 3 lines:
3>>
/3<<
Last active
February 23, 2017 11:35
-
-
Save z0mbix/3301ebd1dfe49ea5a291c24ed278ae23 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment