diw
to delete in the word (doesn't include spaces)daw
to delete around the word (includes spaces before the next word).dd
delete the entire line.D
delete from the current cursor to the end of line.u
undo
- Position the cursor where you want to begin cutting.
- Press
v
to select characters (or uppercaseV
to select whole lines, orCtrl-v
to select rectangular blocks). - Move the cursor to the end of what you want to cut.
- Press
d
to cut (ory
to copy). - Move to where you would like to paste.
- Press
P
(upper case) to paste before the cursor, orp
to paste after.
d
stands for delete in Vim, which in other editors is usually called cut
y
stands for yank in Vim, which in other editors is usually called copy
yy
copy the current line,p
to paste after the cursor.yw
copy to the next word,yiw
copy the current word excluding the surrounded whitespaces,yaw
includes spaces.
h move one character left
j move one row down
k move one row up
l move one character right
w move to beginning of next word
b move to previous beginning of word
e move to end of word
$ move to the end of line
Ctrl-D move half-page down
Ctrl-U move half-page up
Ctrl-B page up
Ctrl-F page down
Add the following lines to ~/.vimrc
" enable syntax processing
syntax enable
let g:solarized_termcolors=256
set background=dark
colorscheme solarized
" set tab size
set tabstop=4
set softtabstop=4
set expandtab
set shiftwidth=4
" UI Config
set number
set showcmd
filetype indent on " load filetype-specific indent files
" set cursorline
set showmatch " highlight matching [{()}]
" Searching
set incsearch " search as characters are entered
set hlsearch " highlight matches
" move to beginning/end of line
nnoremap B ^
nnoremap E $
" fix the delete key in mac os x
:set backspace=indent,eol,start