-
Notifications
You must be signed in to change notification settings - Fork 1
/
.vimrc
290 lines (251 loc) · 8.57 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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
" Automatic reloading of .vimrc
autocmd! bufwritepost .vimrc source %"
autocmd! bufwritepost .zshrc source %"
au InsertLeave * set nopaste
au VimResized * exe "normal! \<c-w>="
" Python-specific stuff
autocmd FileType python set cc=79
"autocmd BufWritePre *.py :%s/\s\+$//e
set nocompatible
set encoding=utf-8
set scrolloff=1
set sidescrolloff=5
set display+=lastline
set clipboard=unnamed
" general stuff
set incsearch
set hlsearch
set ignorecase
set smartcase
set smartindent
set history=100
set shiftwidth=4
set tabstop=4
set shiftround
set expandtab
set hidden
set nobackup
set noswapfile
set undofile
""" initialise formatting
" Don't fold on start
set nofoldenable
set number
set autoindent
syntax on
" Other stuff
set showmode
set showcmd
set autoread
set smarttab
filetype on
filetype indent on
filetype plugin on
set listchars+=eol:¬
set backspace=indent,eol,start
set completeopt=menuone,longest,preview
vnoremap < <gv
vnoremap > >gv
" For some reason home and end keys are not mapping properly.
" Home key
"imap <esc>OH <esc>0i
"cmap <esc>OH <home>
"nmap <esc>OH 0
"" End key
"nmap <esc>OF $
"imap <esc>OF <esc>$a
"cmap <esc>OF <end>
" Some mappings
let mapleader = ","
map <Leader>n :set number!<CR>
nnoremap <Leader>l :set list!<CR>
nnoremap <Leader>D :MBEbd<CR>
nnoremap <Leader>q :qall!
nnoremap <C-M-t> :TlistToggle<CR>
nnoremap <F8> :PyLint<CR>
nnoremap :W :w
nnoremap :Q :q
nnoremap <PAGEUP> <C-u>
nnoremap <PAGEDOWN> <C-d>
map <C-Down> <C-W>j
map <C-Up> <C-W>k
map <C-Right> <C-W>l
map <C-Left> <C-W>h
nnoremap <up> <nop>
nnoremap <down> <nop>
nnoremap <left> <nop>
nnoremap <right> <nop>
inoremap <up> <nop>
inoremap <down> <nop>
inoremap <left> <nop>
inoremap <right> <nop>
nnoremap <left> :bnext<CR>
nnoremap <right> :bprev<CR>
" Tell vim to remember certain things when we exit
" '10 : marks will be remembered for up to 10 previously edited files
" "100 : will save up to 100 lines for each register
" :20 : up to 20 lines of command-line history will be remembered
" % : saves and restores the buffer list
" n... : where to save the viminfo files
set viminfo='10,\"100,:20,%,n~/.viminfo
function! ResCur()
if line("'\"") <= line("$")
normal! g`"
return 1
endif
endfunction
augroup resCur
autocmd!
autocmd BufWinEnter * call ResCur()
augroup END
" ---------------------------------------------------------------------------
" status line
set laststatus=2
if has('statusline')
function! SetStatusLineStyle()
let &stl="%f %y " .
\"%([%R%M]%)" .
\"%#StatusLineNC#%{&ff=='unix'?'':&ff.'\ format'}%*" .
\"%{'$'[!&list]}" .
\"%{'~'[&pm=='']}" .
\"%=" .
\"#%n %l/%L,%c%V " .
\""
endfunc
call SetStatusLineStyle()
if has('title')
set titlestring=%t%(\ [%R%M]%)
endif
endif
" MiniBufExpl setup
let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplMapWindowNavArrows = 1
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplModSelTarget = 1
" Gain focus on class browser on open
let Tlist_GainFocus_On_ToggleOpen = 1
" Powerline stuff
"let g:Powerline_symbols = 'fancy'
" Jedi stuff
let g:jedi#use_tabs_not_buffers = 0
let g:jedi#popup_on_dot = 0
let g:jedi#popup_select_first = 0
let g:jedi#goto_definition_command = "<leader>g"
" Sane Ignore For ctrlp
let g:ctrlp_working_mode = 'CtrlP'
let g:ctrlp_working_path_mode = 'ra'
let g:ctrlp_custom_ignore = {
\ 'file': '\v\.(java|jpeg|png|pyc|jar)$',
\ }
" Syntastic
let g:syntastic_enable_signs = 1
let g:syntastic_enable_highlighting = 1
let g:syntastic_auto_jump = 0
fun! EnsureVamIsOnDisk(vam_install_path)
" windows users may want to use http://mawercer.de/~marc/vam/index.php
" to fetch VAM, VAM-known-repositories and the listed plugins
" without having to install curl, 7-zip and git tools first
" -> BUG [4] (git-less installation)
let is_installed_c = "isdirectory(a:vam_install_path.'/vim-addon-manager/autoload')"
if eval(is_installed_c)
return 1
else
if 1 == confirm("Clone VAM into ".a:vam_install_path."?","&Y\n&N")
" I'm sorry having to add this reminder. Eventually it'll pay off.
call confirm("Remind yourself that most plugins ship with ".
\"documentation (README*, doc/*.txt). It is your ".
\"first source of knowledge. If you can't find ".
\"the info you're looking for in reasonable ".
\"time ask maintainers to improve documentation")
call mkdir(a:vam_install_path, 'p')
execute '!git clone --depth=1 git://github.com/MarcWeber/vim-addon-manager '.shellescape(a:vam_install_path, 1).'/vim-addon-manager'
" VAM runs helptags automatically when you install or update
" plugins
exec 'helptags '.fnameescape(a:vam_install_path.'/vim-addon-manager/doc')
endif
return eval(is_installed_c)
endif
endfun
fun! SetupVAM()
" Set advanced options like this:
" let g:vim_addon_manager = {}
" let g:vim_addon_manager['key'] = value
" Pipe all output into a buffer which gets written to disk
" let g:vim_addon_manager['log_to_buf'] =1
" Example: drop git sources unless git is in PATH. Same plugins can
" be installed from www.vim.org. Lookup MergeSources to get more control
" let g:vim_addon_manager['drop_git_sources'] = !executable('git')
" let g:vim_addon_manager.debug_activation = 1
" VAM install location:
let vam_install_path = expand('$HOME') . '/.vim/vim-addons'
if !EnsureVamIsOnDisk(vam_install_path)
echohl ErrorMsg | echomsg "No VAM found!" | echohl NONE
return
endif
exec 'set runtimepath+='.vam_install_path.'/vim-addon-manager'
" Tell VAM which plugins to fetch & load:
call vam#ActivateAddons([
\ 'github:Lokaltog/vim-powerline',
\ 'github:jiangmiao/auto-pairs',
\ 'github:altercation/vim-colors-solarized',
\ 'github:tpope/vim-fugitive',
\ 'github:tpope/vim-unimpaired',
\ 'github:fholgado/minibufexpl.vim',
\ 'github:scrooloose/syntastic',
\ 'github:scrooloose/nerdtree',
\ 'github:fs111/pydoc.vim',
\ 'github:vim-scripts/taglist.vim',
\ 'github:vim-scripts/TaskList.vim',
\ 'github:kien/ctrlp.vim',
\ 'github:vim-scripts/Efficient-python-folding',
\ 'github:nvie/vim-flake8',
\ 'github:Valloric/YouCompleteMe',
\ 'github:hynek/vim-python-pep8-indent',
\ 'github:ardagnir/united-front',
\ 'github:terryma/vim-multiple-cursors',
\ ], {'auto_install' : 1})
"\ 'snipmate-snippets',
"\ 'github:klen/python-mode',
"\ 'github:alourie/Conque-Shell',
"\ 'github:vim-scripts/AutoComplPop',
" \ 'github:vim-scripts/ScrollColors',
" sample: call vam#ActivateAddons(['pluginA','pluginB', ...], {'auto_install' : 0})
" Addons are put into vam_install_path/plugin-name directory
" unless those directories exist. Then they are activated.
" Activating means adding addon dirs to rtp and do some additional
" magic
" How to find addon names?
" - look up source from pool
" - (<c-x><c-p> complete plugin names):
" You can use name rewritings to point to sources:
" ..ActivateAddons(["github:foo", .. => github://foo/vim-addon-foo
" ..ActivateAddons(["github:user/repo", .. => github://user/repo
" Also see section "2.2. names of addons and addon sources" in VAM's documentation
endfun
call SetupVAM()
" experimental [E1]: load plugins lazily depending on filetype, See
" NOTES
" experimental [E2]: run after gui has been started (gvim) [3]
" option1: au VimEnter * call SetupVAM()""
" option2: au GUIEnter * call SetupVAM()
" See BUGS sections below [*]
" Vim 7.0 users see BUGS section [3]
" Colors are set here, because we only bring them in SetupVAM
set t_Co=256
set background=dark
if !has("gui_running")
""set t_Co=16
"colorscheme distinguished
colorscheme solarized
else
set guioptions-=T
set guioptions-=m
set guioptions-=r
set guifont=Droid\ Sans\ Mono\ 14
set mouse=a
set mousehide
map <MouseMiddle> <Esc>"*p
set lines=45
set columns=110
colorscheme solarized
endif