vimrc 4.19 KB
Newer Older
1 2 3
set nocompatible
set ruler
set number
Murukesh Mohanan's avatar
Murukesh Mohanan committed
4
"set bg=dark
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48

set incsearch
" This shows what you are typing as a command.  I love this!
set showcmd
" Who doesn't like autoindent?
set autoindent

" Needed for Syntax Highlighting and stuff
filetype on
filetype plugin on
filetype plugin indent on
syntax enable
set grepprg=grep\ -nH\ $*

" Spaces are better than a tab character
" set expandtab
set smarttab

" Who wants an 8 character tab?  Not me!
set tabstop=4
set shiftwidth=4
set softtabstop=4

" Cool tab completion stuff
set wildmenu
set wildmode=list:longest,full

set ignorecase
set smartcase
set incsearch
set hlsearch
set showmatch

set tags=tags;/
set wrap
set formatoptions=tcrql
set scrolloff=5               " keep at least 5 lines above/below
set sidescrolloff=5           " keep at least 5 lines left/right
set history=200
set backspace=indent,eol,start
set undolevels=1000           " 1000 undos
set updatecount=100           " switch every 100 chars
set complete=.,w,b,u,U,t,i,d  " do lots of scanning on tab completion
set ttyfast                   " we have a fast terminal
49
set pastetoggle=<F10>
50
set title
51
set titlelen=20
52
set laststatus=2
53
set wildignore+=*.aux,*.toc,*.pdf
Murukesh Mohanan's avatar
Murukesh Mohanan committed
54 55

let g:tex_flavor = "latex"
56

Murukesh Mohanan's avatar
Murukesh Mohanan committed
57 58
noremap ; :
noremap , ;
59 60
noremap < :tabp<CR>
noremap > :tabn<CR>
Murukesh Mohanan's avatar
Murukesh Mohanan committed
61 62
noremap <leader>, :bp<CR>
noremap <leader>. :bn<CR>
63 64
command! C let @/=""
cmap w!! w !sudo tee >/dev/null %
65 66
vnoremap cy "*y
vnoremap cp "*p
67 68
noremap <leader>p "+p
noremap <leader>y "+y
69 70
inoremap <Down> <C-o>gj
inoremap <Up> <C-o>gk
Murukesh Mohanan's avatar
Murukesh Mohanan committed
71 72
nnoremap <Down> gj
nnoremap <Up> gk
73

Murukesh Mohanan's avatar
Murukesh Mohanan committed
74
execute pathogen#infect()
75 76 77
autocmd Bufenter,BufNew *.pro set syntax=prolog
autocmd Filetype gitcommit setlocal spell textwidth=72
autocmd Bufenter *.hs compiler ghc
78

Murukesh Mohanan's avatar
Murukesh Mohanan committed
79
colorscheme molokai
80

81
" From http://vi.stackexchange.com/questions/258/
82
autocmd BufWritePre *.sh if !filereadable(expand('%')) | let b:is_new = 1 | endif
Murukesh Mohanan's avatar
Murukesh Mohanan committed
83
autocmd BufWritePost *.sh if get(b:, 'is_new', 0) | silent execute '!chmod +x %' | endif
84

Murukesh Mohanan's avatar
Murukesh Mohanan committed
85
let g:SuperTabDefaultCompletionType = "context"
Murukesh Mohanan's avatar
Murukesh Mohanan committed
86 87
set omnifunc=syntaxcomplete#Complete
set foldmethod=syntax
Murukesh Mohanan's avatar
Murukesh Mohanan committed
88
let g:syntastic_cpp_compiler_options = ' -std=c++11'
89
let g:syntastic_python_python_exec = '/usr/bin/python3'
90
let g:airline#extensions#tabline#enabled = 1
Murukesh Mohanan's avatar
Murukesh Mohanan committed
91 92 93 94 95
let g:LatexBox_latexmk_options = ' -xelatex '
let g:LatexBox_latexmk_async = 1
let g:LatexBox_latexmk_preview_continuously = 1
let g:LatexBox_quickfix = 4

Murukesh Mohanan's avatar
Murukesh Mohanan committed
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113

if has('cscope')
  set cscopetag cscopeverbose

  if has('quickfix')
    set cscopequickfix=s-,c-,d-,i-,t-,e-
  endif

  cnoreabbrev csa cs add
  cnoreabbrev csf cs find
  cnoreabbrev csk cs kill
  cnoreabbrev csr cs reset
"  cnoreabbrev css cs show
  cnoreabbrev csh cs help

  command -nargs=0 Cscope cs add $VIMSRC/src/cscope.out $VIMSRC/src
endif

114
" From http://vi.stackexchange.com/questions/239/
115 116 117 118
if @% == "" && getcwd() == "/tmp"
	:silent edit test.sh
endif

Murukesh Mohanan's avatar
Murukesh Mohanan committed
119
let g:DiffColors = 100
120 121 122 123 124 125 126 127

" function LookupFiles ()
" 	python <<EOF
" from os.path import *
" from vim import *
" current_file = eval ('expand("%")')
" current_index = str (current.buffer.number)
" PATHS = ['~', '~/.vim', '/etc']
128
"
129 130 131
" if current_file != '' and  not isfile (current_file):
" 	for p in map (expanduser, PATHS):
" 		f = join (p, current_file)
132
" 		if isfile (f):
133 134 135 136 137 138 139
" 			command ('bad ' + f)
" 			command ('bd ' + current_index)
" 			command ('bl')
" 			# command ('silent keepalt file ' + f)
" 			break
" EOF
" endfunction
140
"
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
" autocmd BufWinEnter * nested call LookupFiles()

" From http://vi.stackexchange.com/questions/2009/
function! FindInPath(name)
    let path=&path
    " Add any extra directories to the normal search path
    set path+=~,~/.vim,/etc
    " If :find finds a file, then wipeout the buffer that was created for the "new" file
    setlocal bufhidden=wipe
    exe 'silent! keepalt find '. fnameescape(a:name)
    " Restore 'path' and 'bufhidden' to their normal values
    let &path=path
    set bufhidden<
endfunction
autocmd BufNewFile * nested call FindInPath(expand('<afile>'))

"au VimEnter * tab all | tabfirst

" From http://vi.stackexchange.com/questions/2358/
autocmd FileType * exec("setlocal dictionary+=".$HOME."/.vim/dictionary/".expand('<amatch>'))
Murukesh Mohanan's avatar
Murukesh Mohanan committed
161
set completeopt+=menuone,longest,preview
162
set complete+=k
Murukesh Mohanan's avatar
Murukesh Mohanan committed
163

164 165 166
if !empty($CONFLOCAL)
	source $HOME/.vim/local/$CONFLOCAL.vim
endif
Murukesh Mohanan's avatar
Murukesh Mohanan committed
167
let g:airline#extensions#tabline#enabled= 0