Write programs that do one thing and do it well.
Write programs to work together.
Write programs to handle text streams, because that is the universal interface.
-- Doug McIlroy, inventor of Unix pipes
vimtutor
From Normal mode...
i
enters "Insert" mode, at the current positionI
enters "Insert" mode, at the first position of the linea
enters "Insert" mode, appending the current positionA
enters "Insert" mode, appending the lineo
enters "Insert" mode, opening a new line beneath the currentO
enters "Insert" mode, opening a new line above the currentC
enters "Insert" mode, changing from current position to EOLR
enters "Insert" mode, replacing text as you typeFrom Normal mode...
v
enters "Visual" mode to highlight contiguous text rangesV
enters "Visual" mode to highlight lines of textCtrl-v
enters "Visual" mode to highlight blocks of textEscape
will return you to Normal modeh
- leftj
- downk
- upl
- rightCtrl-F
- page forwardCtrl-B
- page backward:he movement
for more information:he
invokes the help system:he <topic>
invokes the help system with that topicCtrl-]
jumps to a tagCtrl-t
goes back to the screen from which you jumpedw
, W
, e
, E
0
, $
gg
, G
{N}G
:se number
turns on line numbers, which is useful for jumping around/{searchpattern}
?{searchpattern}
f{character}
F{character}
t
and T
are like f
and F
, but go to character preceding\v
switch with searches, and how it enables PCRE regex%
When in doubt, parenthesize. At the very least it will let some poor schmuck bounce on the % key in vi.
-- Larry Wall
m{character}
'{character}
:w<CR>
:q
:wq
or ZZ
y
(yy
to yank current line)d
(dd
to delete current line)x
(current), X
(previous)p
(after current position), P
(before)u
xp
(twiddling characters)~
r
:s /{pattern}/{substitution}/{g}
r
actually needs an explanation of visual modes
is like perl's s//
operator4w
4fx
6yy
d3e
:{start},{end} {command}
:%
-- all lines in file:'<,'>
-- between start and end of visual selection:3,15
-- from lines 3 to 15:{range} g/{pattern}/{command}
:{range} v/{pattern}/{command}
gqip
gq
:he gq
:r {filename}
:!{command}
:r!{command}
sort
:{range}!sort
ls
:!ls
tree
:!tree {directory}
:!php %
Or, add this to your vimrc:
:autocmd FileType php noremap <C-M> :w!<CR>:!$HOME/bin/php %<CR>
:make
:!php -l %
Or, add this to your vimrc:
:autocmd FileType php noremap <C-L> :w!<CR>:!$HOME/bin/php -l %<CR>
:!phpunit %
Or, add this to your vimrc:
:autocmd FileType php noremap <Leader>u :w!<CR>:!$HOME/bin/phpunit %<CR>
<Leader>
ispear install doc.php.net/pman
keywordprg
in PHP files; add this to your vimrc: :autocmd FileType
php set keywordprg=/path/to/bin/pman
Ctrl-k
on a PHP function to get its man page!:syntax on
to your vimrc:filetype plugin on
:filetype plugin indent on
:runtime! $HOME/.vim/ftdetect/*.vim
s{character}
F8
to open the tag listctags-exuberant
to create tag files for PHP (http://bit.ly/vim-mktags):let tagspath = {tag path}
):tag {tagname}
to jump to a tag:stag {tagname}
to open a new window with the given tagCtrl-w Ctrl-]
to open a new window with the tag under the cursor:tag
has tab-completion<Leader>n
to open thisCtrl-p
git clone git://mwop.net/vimrc.git
Table of Contents | t |
---|---|
Exposé | ESC |
Full screen slides | e |
Presenter View | p |
Source Files | s |
Slide Numbers | n |
Toggle screen blanking | b |
Show/hide slide context | c |
Notes | 2 |
Help | h |