summaryrefslogtreecommitdiffstats
path: root/vimrc_common
blob: 6bb303ad4576de169d5a61964a3f3c2fdc9f14a3 (plain)
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
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
" When started as "evim", evim.vim will already have done these settings.
if v:progname =~? "evim"
  finish
endif

" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible

" switch filetype support temporarily of for Vundle
filetype off
set rtp+=~/.vim/bundle/vundle
call vundle#begin()

" Plugin 'alfredodeza/pytest.vim'
" Plugin 'eagletmt/ghcmod-vim'
" Plugin 'fs111/pydoc.vim'
" Plugin 'garbas/vim-snipmate'
" Plugin 'MarcWeber/vim-addon-mw-utils'
" Plugin 'nvie/vim-rst-tables'
" Plugin 'pbrisbin/vim-syntax-shakespeare'
" Plugin 'reinh/vim-makegreen'
" Plugin 'tpope/vim-projectionist'
" Plugin 'vim-scripts/pep8'
" Plugin 'vim-scripts/pylint.vim'
Plugin 'bling/vim-airline'
Plugin 'chrisbra/SudoEdit.vim'
Plugin 'chrisbra/unicode.vim'
Plugin 'edkolev/tmuxline.vim'
Plugin 'elzr/vim-json'
Plugin 'gmarik/vundle'
Plugin 'godlygeek/tabular'          " a dependency of vim-markdown
Plugin 'honza/vim-snippets'
Plugin 'int3/vim-extradite'
Plugin 'LucHermitte/lh-vim-lib'     " a dependency of LucHermitte/local_vimrc
Plugin 'LucHermitte/local_vimrc'
Plugin 'majutsushi/tagbar'
Plugin 'markwu/manpageview'
Plugin 'mileszs/ack.vim'
Plugin 'nanotech/jellybeans.vim'
Plugin 'plasticboy/vim-markdown'
Plugin 'scrooloose/nerdcommenter'
Plugin 'scrooloose/nerdtree'
Plugin 'scrooloose/syntastic'
Plugin 'Shougo/vimproc'
Plugin 'SirVer/ultisnips'
Plugin 'sjl/gundo.vim'
Plugin 'thinca/vim-fontzoom'
Plugin 'tomasr/molokai'
Plugin 'tomtom/tlib_vim'
Plugin 'tpope/vim-dispatch'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-rhubarb'          " :Gbrowse support for fugitive
Plugin 'tsaleh/vim-align'
Plugin 'vim-scripts/DrawIt'
Plugin 'vim-scripts/quilt'
Plugin 'vim-scripts/Rename.vim'
Plugin 'vim-scripts/sessionman.vim'
Plugin 'vim-scripts/Skittles-Dark'
Plugin 'vim-scripts/spec.vim'
Plugin 'vim-scripts/TaskList.vim'
Plugin 'vim-scripts/tir_black'
Plugin 'vim-utils/vim-husk'
Plugin 'wincent/command-t'
Plugin 'xolox/vim-easytags'
Plugin 'xolox/vim-misc'
Plugin 'xolox/vim-shell'
Plugin 'yssl/QFEnter'

" load additional plugins for this host
" no error for non-existing files
runtime! vimrc_local_plugins
" all of your Plugins must be added before the following line
call vundle#end()
filetype plugin indent on
syntax on

" allow backspacing over everything in insert mode
set backspace=indent,eol,start

set history=4000    " keep XXX lines of command line history
set ruler           " show the cursor position all the time
set showcmd         " display incomplete commands
set incsearch       " do incremental searching
set ignorecase
set smartcase
set diffopt+=vertical
" prevent smartcase to apply to * or #
nnoremap * /\<<C-R>=expand('<cword>')<CR>\><CR>
nnoremap # ?\<<C-R>=expand('<cword>')<CR>\><CR>

set wildignore+=*.o,*.obj,.git,*.py[co],*.exe,*.so,*.dll,*.class
set wildignore+=*.tar,*.zip,*.rar,*.7z,*.dmg,*.gz,*.iso,*.jar
set wildignore+=*.swp,*.log,*.sql,*.sqlite,tags,**/build/*
set wildignore+=tags,TAGS

" Show editing mode
set showmode
" Error bells are displayed visually.
set visualbell

" Don't use Ex mode, use Q for formatting
map Q gq

" CTRL-U in insert mode deletes a lot.  Use CTRL-G u to first break undo,
" so that you can undo CTRL-U after inserting a line break.
inoremap <C-U> <C-G>u<C-U>

" In many terminal emulators the mouse works just fine, thus enable it.
if has('mouse')
  set mouse=a
endif

" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
  syntax on
  set hlsearch
  set title
endif

" Only do this part when compiled with support for autocommands.
if has("autocmd")

  " Enable file type detection.
  " Use the default filetype settings, so that mail gets 'tw' set to 72,
  " 'cindent' is on in C files, etc.
  " Also load indent files, to automatically do language-dependent indenting.
  filetype plugin indent on

  " Put these in an autocmd group, so that we can delete them easily.
  augroup vimrcEx
  au!

  " For all text files set 'textwidth' to 78 characters.
  autocmd FileType text setlocal textwidth=78

  " When editing a file, always jump to the last known cursor position.
  " Don't do it when the position is invalid or when inside an event handler
  " (happens when dropping a file on gvim).
  " Also don't do it when the mark is in the first line, that is the default
  " position when opening a file.
  autocmd BufReadPost *
    \ if line("'\"") > 1 && line("'\"") <= line("$") |
    \   exe "normal! g`\"" |
    \ endif

  augroup END

else

  set autoindent        " always set autoindenting on

endif " has("autocmd")

" Convenient command to see the difference between the current buffer and the
" file it was loaded from, thus the changes you made.
" Only define it when not defined already.
if !exists(":DiffOrig")
  command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
          \ | wincmd p | diffthis
endif

" Status line
set laststatus=2

set fileencodings=utf-8,latin2,cp1250
set nojoinspaces
set scrolloff=5
set showmatch
set directory=.,/tmp
" folding/unfolding with space
nnoremap <space> za
if ! has("gui_running")
    set t_Co=256
endif
if &diff
    set background=dark
    colors peaksea
else
    colorscheme jellybeans
endif
set confirm

" folding
set foldmethod=indent
set foldlevel=99

" command-line autocompletition
set wildchar=<Tab>
set wildmenu
set wildmode=longest:full,full

" indenting
set expandtab
set softtabstop=4
set shiftwidth=4
set smarttab
set smartindent

" this may be dangerous unless `secure` is set
set exrc
" set secure

" higlight current line (tip 1279)
set cursorline
highlight CursorLine term=none cterm=none ctermbg=235
nnoremap <Leader>c :set cursorline! cursorcolumn!<CR>

" highlight line, that goes over *textwidth
set colorcolumn=+1,+2

" fill line with stars
function! s:FillLine()
    let filler = ""
    if &textwidth == 0
        let maxLine = 78
    else
        let maxLine = &textwidth
    endif
    for i in range(0, maxLine - strlen(getline(".")))
        let filler = filler.'*'
    endfor
    call setline(".", getline(".").filler)
endfunction

nnoremap <F5> :call <SID>FillLine()<CR>
inoremap <F5> <C-O>:call <SID>FillLine()<CR>

" regenerate tags for project in current directory with Ctrl + F12
" noremap <C-F12> :!ctags .<CR>
map <C-\> :vsp <CR>:exec("tag ".expand("<cword>"))<CR>
" map <A-]> :tab split<CR>:exec("tag ".expand("<cword>"))<CR>
" map <A-]> :vsp <CR>:exec("tag ".expand("<cword>"))<CR>

" Ctrl+space for auto-completition
inoremap <c-space> <c-x><c-o>

" highlight current word
nnoremap <F10> :set hls<CR>:exec "let @/='\\<".expand("<cword>")."\\>'"<CR>
nnoremap <F11> :nohls<CR>

vmap <C-c> :<Esc>`>a<CR><Esc>mx`<i<CR><Esc>my'xk$v'y!xclip -selection c<CR>u
map <Insert> :set paste<CR>i<CR><CR><Esc>k:.!xclip -o<CR>JxkJx:set nopaste<CR>
" This maps non-breakable space to normal space
inoremap   <Space>

" Toggle paste with \p
nmap <leader>i :set invpaste<CR>

let g:netrw_browsex_viewer = expand("$BROWSER")
if strlen(g:netrw_browsex_viewer) == 0
    let g:netrw_browsex_viewer = 'firefox'
endif

" ******************** FILETYPE SETTINS ***************************************
au BufRead,BufNewFile *.md setfiletype markdown

" ******************** PLUGIN SETTINGS ****************************************
" airline
let g:airline_detect_paste = 1
let g:airline_section_z = airline#section#create_right(
    \ ['0x%02B', '%3p%% :%4l:%3c '])
let g:airline_section_warning = airline#section#create(['whitespace'])
let g:airline_mode_map = {
    \ '__' : '-',
    \ 'n'  : 'N',
    \ 'i'  : 'I',
    \ 'R'  : 'R',
    \ 'c'  : 'C',
    \ 'v'  : 'V',
    \ 'V'  : 'V',
    \ '' : 'V',
    \ 's'  : 'S',
    \ 'S'  : 'S',
    \ '' : 'S',
    \ }
let g:airline#extensions#default#section_truncate_width = {
  \ 'b': 15,
  \ 'x': 25,
  \ 'y': 15,
  \ }

" tagbar settings
let g:tagbar_usearrows = 1
nnoremap <silent> <F8> :TagbarToggle<CR>

" nerd tree
nnoremap <silent> <F9> :NERDTreeToggle<CR>
let g:NERDTreeHijackNetrw = 1   " use NERDTree instead of netrw
let g:NERDTreeRespectWildIgnore = 1 
let g:NERDTreeChDirMode = 2     " change CWD when changing root in NERDTree

" utfswitch
let g:ucs_encode_octal = 1

" auto install plugin updates
let g:GetLatestVimScripts_allowautoinstall=1

" command-t********************************************************************
let g:CommandTMaxFiles=100000

" ultisnips *******************************************************************
let g:UltiSnipsExpandTrigger="<c-tab>"
let g:UltiSnipsListSnippets="<c-s-tab>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"

" If you want :UltiSnipsEdit to split your window.
let g:UltiSnipsEditSplit="vertical"

" spec*************************************************************************
let g:spec_chglog_packager="Michal Minar <miminar@redhat.com>"
let g:spec_chglog_prepend=1

let g:showDigraphCode=1

" pyflakes
" let g:pyflakes_use_quick_fix = 0
" pep8
" let g:pep8_map='<leader>8'

" task list
map <leader>td <Plug>TaskList
"nnoremap <silent> <F6> <Plug>TaskList
" gundo
" map <leader>g :GundoToggle<CR>
nnoremap <silent> <F7> :GundoToggle<CR>
" ack
nmap <leader>a <Esc>:Ack!
" rope
" map <leader>j :RopeGotoDefinition<CR>
" map <leader>r :RopeRename<CR>
" makegreen
" map <Leader>] <Plug>MakeGreen " change from <Leader>t to <Leader>]

" easytags
let g:easytags_async = 1
let g:easytags_resolve_links = 1
let g:easytags_dynamic_files = 2
let g:easytags_auto_highlight = 0

" husk (command-line mode mappings)
" <C-k> is used for inserting digraphs
let g:husk_ctrl_k = 0
if !has('gui_running') && !has('nvim')
    cmap <Esc>k <M-k>
    " TODO: allow to use <C-]> and <C-M-]> in command line mode
endif
cnoremap <expr> <M-k> husk#clear_line_after_cursor()

" localvimrc
let g:localvimrc_blacklist = '\.git\/.*'
call lh#local_vimrc#munge('whitelist', $HOME.'/wsp/my/*')
call lh#local_vimrc#munge('whitelist', $HOME.'/Documents')