Вы находитесь на странице: 1из 3

Commands

Save and exit Save as Exit w/ save Edit file Go to shell (use exit to exit) List files Append eol Replace mode Status Normal mode Visual Block Mode Visual Mode :wq ZZ :w <filename> :q! ZQ :e <filename> :sh :!ls A R Ctrl + g ESC Ctrl + c Ctrl + v v Search cursor string Search string Navigate results Cursor positioning Go to Move next word Move to the end of the word(s) Move back to begining of word From cursor in ( to ) or [ to ]

Motion
* /word (downwards) n (next) H (high) M (mid) gg (line 1) ^|0 (bol) G (eof) $ (eol) w (word) e b % ?word (upwards) N (prev) L (low) #G (line #) W (WORD) #e

Tabs
New tab Close tab Change tab :tabnew :tabc gt (next)

Options
Set ignore case Set highlight search Set insearch (search while typing) Set line numbers :set ic :set hls :set is :set nu :set noic

gT (prev)

Edit
Del char Del word Del from cursor to eol Del line(s) Undo Redo Put Replace char Change word Substitute * if empty range current * <old> exact old word * \cold ignore case Yank (2nd clipboard) Yank word x dw (w space) de (w/ space) d$ D dd [#]dd _dd (no clipb) u U (whole line) CTRL + r p (below cursor) r cw c$ (eol) :[range] s/old/new/[opts] :[range] s#old#new#[opts] % (entire) .,# (curr to line #) .,.+4 #,# c (confirm) i (case ins.) g (* subs per line) "2p yw Yank entire line Yank lines Yank from cursor to Join lines Copy line to clipboard Select row Open new line Clean doc Autocomplete Selected text to upercase Sort all rows Select all Convert selected text to Select again last selection yy #yy y$ (eol) J (2 lines) +y V o (below cursor) :% d Ctrl + p gU :% sort ggVG u (lowercase) gv U (upercase) Y y^ (bol) #J (# lines)

O (above cursor)

Recording
Start recording Stop recording Apply recording q[char] q @[char] (1 time)

#@[char] (# times)

Tricks
Comment everything Comment selected block Ident selected lines (VM) Ident auto selected lines (VM) Tabs to spaces help me me help japan_2006 2006-japan Remove DOS ^M Save after forgetting to edit as root :% s/^/# Ctrl + v => I => # => ESC ESC > < = :% retab :%s#\(help\) \(me\)#\2 \1# :% s#^\(.*\) _ \([0-9]*\)#\2-\1# :%s/\r//g :w !sudo tee %

.vimrc set tabstop=4 set shiftwidth=4 set smarttab una nueva linea deja la tabulacion como estaba set expandtab set softtabstop=4 set autoindent set is busca mientras escribes set ic ignore case set smartcase si buscas con alguna mayscula hace noic (no ignore case) Pressing < or > will let you indent/unident selected lines vnoremap < <gv vnoremap > >gv Taglist config filetype on " Changing tabs: " Ctrl + n = newtab " Ctrl + leftarrow|rightarrow map <C-t> :tabnew<CR> map <C-left> :tabp<CR> map<C-right> :tabn<CR> Delete not using clipboard

:map F _dd
" Support for 256 colors set t_Co=256 " Theme dessert256 colorscheme desert256 " Ctrl+s to save " First edit ~/.bashrc and add: " " # http://samdorr.net/blog/2009/08/saving-files-in-vim-with-ctrl-s/ " stty -ixoff -ixon " " then $ source .bashrc imap <C-s> <esc>:w<cr>a map <C-s> :w<cr> " Press F2 to indent an XML map <F2> <Esc>:1,$!xmllint --format -<CR> "Press F3 to indent other files map <F3> <Esc>gg=G<CR>

Leyend: VM = Visual Mode Plugins: Taglist: - Install Exuberant Ctags (apt-get install ctags) - Download (http://vim-taglist.sourceforge.net) - Update .vimrc config. - :helptags. and restart vim. - :TlistToggle Color Sampler Pack: - Download: http://www.vim.org/scripts/script.php?script_id=625 http://www.vi-improved.org/color_sampler_pack/

- Put plugin/ and colors/ in ~/.vim/ - :colorscheme <name> Links: http://www.techrecipes.net/linux/enable-vim-auto-complete.html

Вам также может понравиться