These tips are completely uncategorized and appear in the order I added them to this post.
- Finding opening and closing curly brackets in a code block: [{ and ]} useful if we want to locate the beginning of a long if block.
- Converting a pattern to uppercase. Suppose we want to convert the word "pattern" (without the double quotes) to uppercase. Here is how to do it in vim: :%s/\(pattern\)/\U\1/g
- Auto-completion magic: pressing Ctrl+P after typing the first letter of a word will auto-complete the word in vim.
- Basic indentation support for Java.
In .vimrc file put the following:
set autoindent
set si
set shiftwidth=4
set smarttab
inoremap { {<cr>}<left><cr><up><tab>
inoremap ( ()<left>
inoremap " ""<left> - useful links:
http://www.vim.org/tips
http://vim.wikia.com/wiki
Aucun commentaire:
Enregistrer un commentaire