-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
177 lines (147 loc) · 4.78 KB
/
vimrc
1
2
3
4
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
Plugin 'altercation/vim-colors-solarized'
Plugin 'Valloric/YouCompleteMe'
Plugin 'SirVer/ultisnips'
Plugin 'honza/vim-snippets'
Plugin 'tpope/vim-fugitive'
Plugin 'kien/ctrlp.vim'
Plugin 'bronson/vim-trailing-whitespace'
Plugin 'scrooloose/syntastic'
Plugin 'bling/vim-airline'
Plugin 'godlygeek/tabular'
Plugin 'kchmck/vim-coffee-script'
Plugin 'LaTeX-Box-Team/LaTeX-Box'
Plugin 'rizzatti/dash.vim'
Plugin 'derekwyatt/vim-scala'
Plugin 'tpope/vim-sleuth'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
:let mapleader="\<Space>"
syntax enable
set background=light
set nu
set cursorline
colorscheme solarized
" set spell
set wrap
set nolist
set linebreak
set shell=/bin/bash
set fdm=syntax
set backspace=indent,eol,start
set hlsearch
au BufNewFile,BufRead *.py setlocal fdm=indent
set foldlevelstart=20
set scrolloff=5 " Scroll-boundaries
au BufNewFile,BufRead *.tex setlocal ft=tex
au BufNewFile,BufRead *.pynb setlocal ft=python
cabbr <expr> %% expand('%:p:h')
" Size indent
set expandtab
set autoindent
set spell spelllang=en_gb
set wildignore+=*.class,*.aux,*.out,*.toc,*.bbl,*.blg,*.fdb_latexmk,*.fls,*.log,*.pdf,*.run.xml,*.pyc
"""" Leader Mappings
" Tabularize
map <Leader>a= :Tabularize /=<CR>
map <Leader>a= :Tabularize /=<CR>
map <Leader>a: :Tabularize /:\zs<CR>
map <Leader>a: :Tabularize /:\zs<CR>
map <Leader>a& :Tabularize /&<CR>
map <Leader>a& :Tabularize /&<CR>
" Change focus
map <Leader>h <C-w>h
map <Leader>j <C-w>j
map <Leader>k <C-w>k
map <Leader>l <C-w>l
" Change split position
map <Leader>H <C-w>H
map <Leader>J <C-w>J
map <Leader>K <C-w>K
map <Leader>L <C-w>L
" Misc
map <Leader>ch :nohl<CR>
map <Leader>w :w<CR>
map <Leader>e :e
map <Leader>vs :vsplit<CR>
map <Leader>ss :split<CR>
map <Leader>hl :nohlsearch<CR>
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
" Line break behaviour
nmap j gj
nmap k gk
noremap <C-c> :nohl<CR>
inoremap <Esc> <nop>
inoremap hj <Esc>
" Filetype dependant runfiles
autocmd Filetype c,cpp map <buffer> <Leader>r :w<CR> :!make<CR>
autocmd Filetype python map <buffer> <Leader>r :w<CR> :!python %<CR>
autocmd Filetype python map <buffer> <Leader>t :w<CR> :!nosetests<CR>
autocmd Filetype tex map <buffer> <Leader>r :w<CR> :T texfind <bar> xargs latexmk -xelatex<CR>
autocmd Filetype sh map <buffer> <Leader>r :w<CR> :!./%<CR>
autocmd Filetype tex map <silent> <Leader>o :!open *.pdf<CR>
autocmd Filetype java :ProjectImportDiscover .<CR>
autocmd Filetype haskell map <buffer> <Leader>r :w<CR> :!hugs %<CR>
set t_Co=256
" YCM
let g:ycm_register_as_syntastic_checker = 1
let g:ycm_collect_identifiers_from_tags_files = 1
let g:ycm_global_ycm_extra_conf = '~/config/.ycm_extra_conf.py'
let g:EclimCompletionMethod = 'omnifunc'
" Dash
:nmap <silent> <leader>d <Plug>DashSearch
" Ultisnips
" Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
let g:UltiSnipsExpandTrigger="<esc>"
let g:UltiSnipsJumpForwardTrigger="<c-j>"
let g:UltiSnipsJumpBackwardTrigger="<c-k>"
" If you want :UltiSnipsEdit to split your window.
let g:UltiSnipsEditSplit="vertical"
" Vim airline
set laststatus=2
let g:airline_powerline_fonts = 1
" Syntastic
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_python_checkers = ['flake8', 'pylint']
let g:syntastic_check_on_open = 0
let g:syntastic_check_on_wq = 0
let g:syntastic_java_checkers = ['javac', 'checkstyle']
let g:syntastic_java_javac_config_file_enabled = 1
map <Leader>c :SyntasticCheck <CR>
let g:syntastic_python_flake8_args='--ignore=E501'
" Allow saving of files as sudo when I forgot to start vim using sudo.
cmap w!! w !sudo tee > /dev/null %
if has("multi_byte")
if &termencoding == ""
let &termencoding = &encoding
endif
set encoding=utf-8
setglobal fileencoding=utf-8
"setglobal bomb
set fileencodings=ucs-bom,utf-8,latin1
endif
if filereadable(".vimrc_proj")
so .vimrc_proj
endif