Posts

Showing posts with the label vim

Tip for VIM

For splitting window.    : split ( for horizontal split )    : vsplit ( for vertical split ) Switch between splitted window    Ctrl-ww Resize splitted window    Ctrl-w + / -   ( 1 unit each time, height )    10 Ctrl-w +   ( resize 10 unit height )    Ctrl-w < / >   ( 1 unit each time, width ) Search and replace    :%s/original/replace/g   ( every occur in file )    :1,$s/original/replace/    :s/original/replace/g ( replace all in current line ) For multiple files    :e ( edit file in new buffer )    :bn ( switch to next file in buffer )    :bp ( switch to previous file in buffer )    :bd ( delete file in buffer , ake close file )    :sp ( edit file in new window ) ETC    :sh ( switch to console ) and Ctrl-d to get back    other way    Ctrl-z (switch to co...

Best of VIM tips

ref  http://www.rayninfo.co.uk/vimtips.html  (thank   zzapper) ref  http://www.viemu.com/vi-vim-cheat-sheet.gif  (thank viemu)

Secret of Vim #2

You can see current full path of editing file by >>> CTRL+1+G

Secret of Vim #1

In visual mode. If you use V (visual mode) to select multiline, then press : prompt will appear >>>:' So if you need to comment or insert something at first place please do >>>:' s/^/#/ for example above , I need to comment selected multiline. If you want some change with // , then we have to change delimeter, so >>>:' s!^!//! Hahaha, Cool , ha?

Something more about vimrc (python)

" Kelvin's handy VIM config file " " Use spaces instead of tabs set tabstop=4 set shiftwidth=4 " Use shiftwidth setting when at beginning of file set smarttab " When I press TAB actually insert spaces set expandtab " Fix backspace to delete the spaces youre using set softtabstop=4 " Autoindenting makes life easier for Python programmers set autoindent " Some syntax coloring syntax on " Set line numbering so you know where you are set number set ruler " Add another tab to the next line after the colon im : : thank for kevin (http://www.kelvinwong.ca/2008/09/11/my-vim-config-file-for-python/)

Beginning of my VIM

Change tabs to space in vim Temporarily :set tabstop=4 :set expandtab do command :retab # after set expandtab to activate above command Permanently add above command by vi ~/.vimrc