Created
December 28, 2009 20:06
-
-
Save thebigbad/264893 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
" Change tabs to 2 spaces | |
:retab 2 | |
" Wrap the margin at 80 chars | |
:set wrapmargin=80 | |
" Show non-printable characters in Vim | |
:set list | |
" Interactive search and replace | |
" | |
" : Enter command mode | |
" % Perform command on all lines | |
" s :substitute | |
" /\<foo\>/ Match whole word foo | |
" /bar/ Replace with bar | |
" g Do this global (not just current line) | |
" c Confirm each change | |
:%s/\<foo\>/bar/gc | |
" Remove spaces and tabs from end of line | |
:%s/\s\+$// | |
" Copy and paste from one file to another | |
" | |
" v Enter visual mode in foo.txt | |
" y Yank text from foo.txt | |
" :split bar.txt Open bar.txt in a split window | |
" p Paste text | |
" Finding a procedure `foo` in a C program | |
ctags *.c | |
vim -t foo | |
" Jumping to procedure `bar` under cursor | |
Ctrl+] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment