wk Vim list find blog view edit

Vim



use gu and gU to change to lower and uppercase

place cursor over a filename and press 'gf'

Here's my vim configuration script. It comes with:

 - Exposee function binded to the F10 key.
 - Create splits with F1, F2
 - Open new file with F3
 - Close them with F4
 - Move frame splits with <control>-<shift>-[hjkl]

If you want to read more please follow reading here

Have fun!
" Save file as root
cmap w!! %!sudo tee > /dev/null %


"Install pathogen
mkdir ~/.vim/autoload ~/.vim/bundle
wget -O ~/.vim/autoload/pathogen.vim http://www.vim.org/scripts/download_script.php?src_id=19375
echo 'call pathogen#infect()' >> ~/.vimrc


# Install pathogen plugin
git clone https://github.com/bling/vim-airline ~/.vim/bundle/vim-airline


"js indent
:set cino=:0,+0,(8,J1,{1,}0,>8,)1,m2


"C syntax
" my own indentation for C using the coding styles
set cindent
set tabstop=4
set noexpandtab
set smartindent
set cino=:0,+0,(2,J0,{1,}0,>4,)1,m2
cmap w!! %!sudo tee > /dev/null %


"Using 4spaces indentation
set expandtab
set tabstop=4
set softtabstop=4
set shiftwidth=4


" pancake's exposee for vim:
let fs=0
fun Exposee()
if (g:fs == 0)
  res 1000
  vertical res 1000
  let g:fs=1
else
  exe "normal \<C-W>="
  let g:fs=0
endif
endfun
map <F10> :call Exposee()<cr>

"some nice keymappings
map <F1> :vsp<cr>
map <F2> :sp<cr>
map <F3> :sp<cr>:e .<cr>
map <F4> :q<cr>
map <F5> <C-W>=

" fine zooming
map <C-J> 2<C-W>+
map <C-K> 2<C-W>-
map <C-L> 2<C-W>>
map <C-H> 2<C-W><

" fine frame moving
map <C-Y> <C-W>h
map <C-U> <C-W>j
map <C-I> <C-W>k
map <C-O> <C-W>l


Some more food


au BufNewFile,BufRead *.vala setf cs
au BufNewFile,BufRead *.vapi setf cs

filetype indent on
colorscheme pablo
set foldmethod=marker
set hlsearch
set paste
sy on


Use @" to execute the command found in the pasted buffer

CTags



C-] - go to definition
C-T - Jump back from the definition.
C-W C-] - Open the definition in a horizontal split

Add these lines in vimrc
map <C-\> :tab split<CR>:exec("tag ".expand("<cword>"))<CR>
map <A-]> :vsp <CR>:exec("tag ".expand("<cword>"))<CR>

C-\ - Open the definition in a new tab
A-] - Open the definition in a vertical split

Ctrl-Left_MouseClick - Go to definition
Ctrl-Right_MouseClick - Jump back from definition


CTags for Javascript



--langdef=js
--langmap=js:.js
--regex-js=/([A-Za-z0-9._$]+)[ \t]*[:=][ \t]*\{/\1/,object/
--regex-js=/([A-Za-z0-9._$()]+)[ \t]*[:=][ \t]*function[ \t]*\(/\1/,function/
--regex-js=/function[ \t]+([A-Za-z0-9._$]+)[ \t]*\(([^)])\)/\1/,function/
--regex-js=/([A-Za-z0-9._$]+)[ \t]*[:=][ \t]*\[/\1/,array/
--regex-js=/([^= ]+)[ \t]*=[ \t]*[^"]'[^']*/\1/,string/
--regex-js=/([^= ]+)[ \t]*=[ \t]*[^']"[^"]*/\1/,string/

Simply add the above to ~/.ctags or $HOME/ctags.cnf.


Building



map <F9> :make<cr>:copen<cr>
" :make -> build from inside vim
" :copen -> open error console