Created
October 9, 2010 19:50
-
-
Save chelmertz/618541 to your computer and use it in GitHub Desktop.
vim shortcuts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"search for "bla": | |
/bla | |
"replace "bla" with "blue" throughout file: | |
:%s/bla/blue/g | |
"replace "bla" with "blue" throughout visual selection: | |
:'<,'>s/bla/blue/g | |
"go to line 51 | |
:51 | |
"repeat last command (enter insert mode, do some stuff, <Esc>, .) | |
. | |
"yank a whole line | |
yy | |
"find matching bracket | |
% | |
"remove character under cursor | |
x | |
"replace one character | |
r | |
"+1 word: | |
w | |
"+1 word, stay at last character of that word: | |
e | |
"-1 word: | |
b | |
"insert before | |
i | |
"insert after | |
a | |
"indent block of code | |
=aB | |
"save bookmark, where <a-z> is one character in that range | |
m<a-z> | |
"recall bookmark, where <a-z> is one character in that range | |
'<a-z> | |
"sort range: http://vim.wikia.com/wiki/Sort_lines | |
:sort | |
"move to next occurence of x on the same row | |
fx | |
"repeat last motion | |
; | |
"undo last motion | |
, | |
"move to ^ | |
0 | |
"delete three words | |
3dw | |
"delete three lines | |
3dd | |
"move a line downwards | |
ddp | |
"move a line upwards | |
ddkP | |
"delete blank lines | |
:g/^$/d | |
"display occurrences for word under cursor | |
* | |
"jump between occurrences for word under cursor | |
shift+3 | |
"move to beginning of line | |
0 | |
"move to end of line | |
$ | |
"go to variable initialization | |
gd | |
"delete until matching brace (works with all kinds of braces) | |
da( | |
"delete sentence from within sentence | |
das | |
"select everything in between the current set of braces | |
vib | |
"select everything between current set of ' | |
vi' | |
"replace within ' and keep ' | |
ci' | |
"replace within ' and discard ' | |
ca' | |
""" | |
" file explorer | |
""" | |
"open file explorer | |
:e. | |
"open file explorer in current path, horizontally | |
:Vex | |
"open file explorer in current path, vertically | |
:Sex | |
"create file in active directory in file explorer | |
:e <filename> | |
"split screens vertically in current directory | |
:sp. | |
"split screens horizontally in current directory | |
:vs. | |
"move between split screens | |
ctrl+w, <arrow key> | |
"maximize current split screen | |
ctrl+w, _ | |
"jump back one step, in command mode | |
ctrl+o | |
"jump forward one step, in command mode | |
ctrl+i | |
"autocomplete, in insert mode | |
ctrl+n | |
""" | |
" conf | |
""" | |
" automatic indentation | |
set autoindent | |
set smartindent | |
" livesearch | |
set incsearch | |
" line numbers | |
set number | |
" leave four lines from the window's edge | |
set scrolloff=4 | |
" always display status bar | |
set laststatus=2 | |
" show general information | |
set showcmd | |
" mute | |
set noerrorbells | |
" maximize windows sideways | |
" http://stackoverflow.com/questions/1262154/minimizing-vertical-vim-window-splits | |
nmap <Leader>h <C-W>h500<C-W>> | |
nmap <Leader>l <C-W>l500<C-W>> | |
" when having more than 1 windows open, this assigns equal widths to all of them | |
<C-W>= | |
"non-git but bash...: | |
"move to beginning of line | |
ctrl+a | |
"move to end of line | |
ctrl+e |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment