Find file
a2e1637 Jan 6, 2015
@ddvlad @Therzok @teobaluta
147 lines (116 sloc) 4.49 KB
" Created 22.12.2006 by Vlad
" Add modeline functionality -- it's disabled by default on some distros
set modeline
filetype plugin on
" Mapping from usenet.
imap jj <Esc>
" Per-filetype settings
autocmd FileType java setlocal tw=78 cin foldmethod=marker
autocmd FileType c,cpp setlocal tw=72 cindent noexpandtab
autocmd FileType python setlocal autoindent expandtab sts=4 sw=4 tw=78
autocmd FileType haskell setlocal tw=72 sw=2 sts=2 et
autocmd FileType tex setlocal tw=72 sw=2 sts=2 ai et
autocmd FileType tex so ~/.vim/latex-abbrevs.vim
" 'linebreak' won't work without 'nolist'
autocmd FileType creole setlocal tw=0 fo=t wrap nolist linebreak
autocmd FileType creole so ~/.vim/creole-abbrevs.vim
autocmd FileType mail setlocal tw=72 fo=tql
autocmd FileType lua setlocal sts=4 sw=4 ai et
autocmd FileType rust setlocal cin
autocmd FileType sh setlocal sts=4 sw=4 si et
" Custom filetypes per extension. Not sure this is the recommended way to do it.
autocmd BufRead,BufNewFile *.wiki setlocal ft=creole
autocmd BufRead,BufNewFile *.tex setlocal ft=tex
autocmd BufRead,BufNewFile *.cool setlocal ft=cool
autocmd BufRead,BufNewFile *.cl setlocal ft=cool
autocmd BufRead,BufNewFile *.miC setlocal ft=C
autocmd BufRead,BufNewFile *.g setlocal ft=antlr
autocmd BufRead,BufNewFile *.rkt setlocal ft=scheme
autocmd BufRead,BufNewFile SConstruct* setlocal ft=python tw=0
autocmd BufRead,BufNewFile SConscript* setlocal ft=python tw=0
set autowrite
set dir=/tmp
" Ripped off from Alexandru Mosoi
set statusline=%<%f\ %y%h%m%r%=%-24.(0x%02B,%l/%L,%c%V%)\ %P
set laststatus=2
set wildmenu
" /ripoff
" Ripped off from Cosmin Ratiu, on SO list; 30 Jun 2009
if has("cscope")
" Look for a 'cscope.out' file starting from the current directory,
" going up to the root directory.
let s:dirs = split(getcwd(), "/")
while s:dirs != []
let s:path = "/" . join(s:dirs, "/")
if (filereadable(s:path . "/cscope.out"))
execute "cs add " . s:path . "/cscope.out " . s:path . " -v"
let s:dirs = s:dirs[:-2]
set csto=0 " Use cscope first, then ctags
set cst " Only search cscope
set csverb " Make cs verbose
nmap <C-\>s :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>g :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>c :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>t :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>e :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-\>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-\>d :cs find d <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>s :vert scs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>g :vert scs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>c :vert scs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>t :vert scs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>e :vert scs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>f :vert scs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-@>i :vert scs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-@>d :vert scs find d <C-R>=expand("<cword>")<CR><CR>
" Open a quickfix window for the following queries.
set cscopequickfix=s-,c-,d-,i-,t-,e-,g-
" More tabs -- we have enough memory.
set tabpagemax=20
colorscheme zenburn
" Mark tabs and spaces
set list listchars=tab\ ,trail:·,extends:»,precedes:«
map Q gq
" Ripped off from Bee on vim_use mailing list
" Space as PageDown like web browser
nmap <Space> <PageDown>
vmap <Space> <PageDown>
" /ripoff
" Highlight current line
set cursorline
" Disable the background color erase; makes the text background the same as
" the terminal background
set t_ut=
" Open new vertical splits to the right of current one.
set splitright
set hidden
set smartcase
set ignorecase
syntax on
nnoremap <Tab> <C-W>w
nnoremap <F9> :cope<CR>
nnoremap <S-F9> :ccl<CR>
nnoremap <F1> 1gt
nnoremap <F2> 2gt
nnoremap <F3> 3gt
nnoremap <F4> 4gt
nnoremap <F5> :cp<CR>
nnoremap <F6> :cn<CR>
" Align subsequent lines to open parantheses in C sources. Via andradaq.
set cinoptions=(0,W4
" Restore position inside previously opened file. From vim.wikia.
function! ResCur()
if line("'\"") <= line("$")
normal! g`"
return 1
augroup resCur
autocmd BufWinEnter * call ResCur()
augroup END