-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
180 lines (138 loc) · 4.15 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
set nocompatible " be iMproved, required
filetype off " required
function! GetRunningOS()
if has("win32") || has("win16") || has("win64")
return "win"
elseif has("unix")
if ($MSYSTEM =~? 'MINGW\d\d')
return "win"
elseif (system('uname')=~'Darwin')
return "mac"
else
return "linux"
endif
else
return "unknown"
endif
endfunction
let os=GetRunningOS()
" Stay on the ruby implementation of command-t
let g:CommandTPreferredImplementation='ruby'
if os == "win"
" set the runtime path to include Vundle and initialize
set rtp+=~/vimfiles/bundle/Vundle.vim
" alternatively, pass a path where Vundle should install plugins
call vundle#begin('~/vimfiles/bundle')
else
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
endif
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'tpope/vim-fugitive'
" Papercolor
Plugin 'NLKNguyen/papercolor-theme'
" Fast file-source switcher
Plugin 'derekwyatt/vim-fswitch'
" vim airline
Plugin 'vim-airline/vim-airline'
" indent-guides
Plugin 'nathanaelkane/vim-indent-guides'
" clang-format
Plugin 'rhysd/vim-clang-format'
" vim change lines
Plugin 'airblade/vim-gitgutter'
" cmake syntax
Plugin 'nickhutchinson/vim-cmake-syntax'
" Per project vimrc
Plugin 'LucHermitte/lh-vim-lib'
Plugin 'LucHermitte/local_vimrc'
" Rust support
Plugin 'rust-lang/rust.vim'
" Tmux integration
Plugin 'christoomey/vim-tmux-navigator'
" os-specific config/plugins
if os == "win"
" ctrlp
Plugin 'kien/ctrlp.vim'
else
" Git plugin not hosted on GitHub
Plugin 'git://git.wincent.com/command-t.git'
endif
" All of your Plugins must be added before the following line
call vundle#end() " required
" Set the mapleader for command-t and others
let mapleader = ","
" We need 256 color terminal here
set t_Co=256
" fix backspace behavior for windows
set backspace=indent,eol,start
" Now comes configuration. Lets start with the os-specific stuff
if os == "win"
" Use a good font for windows
set guifont=DejaVu_Sans_Mono_for_Powerline:h9:cANSI
" remap ctrl-p to use the same command as command-t to make my life
" simpler
nmap <leader>t :CtrlP<cr>
" ignore list for ctrl-p
"let g:ctrlp_custom_ignore = {
" \ 'dir': '(.svn|bin|bin64)'
"}
" Make the cursor work in mintty
let &t_ti.="\e[1 q"
let &t_SI.="\e[6 q"
let &t_EI.="\e[2 q"
let &t_te.="\e[0 q"
else
" Looking up declarations. Needs Ycm so is non-windows right now
nmap <leader>g :YcmCompleter GoTo<cr>
endif
" clang format integration
let g:clang_format#detect_style_file = 1
map <C-K> :ClangFormat<cr>
" airline wants utf-8 encoding
set encoding=utf8
" Reenable the filetype plugin
filetype plugin indent on
" On windows, I have to enable syntax highlighting... grr!
syntax enable
" Add propsto xml
au BufNewFile,BufRead *.props set filetype=xml
au BufNewFile,BufRead *.vcxproj set filetype=xml
au BufNewFile,BufRead *.sln set filetype=xml
" enable search highlighting
set hlsearch
" airline setup
" use powerline fonts for the airline
let g:airline_powerline_fonts = 1
" In general, I use mixed space/tab configuration
let g:airline#extensions#whitespace#mixed_indent_algo = 2
" fix airline not showing on startup
set laststatus=2
" Use papercolor scheme
set background=dark
colorscheme PaperColor
" Whitespace visualization
set list
set listchars=tab:>·,trail:·
" Configure line numbers
set number
" relative numbers tend to be slow
set relativenumber
" code completion for help
set wildmenu
" For command-t to work nicely, we filter a few files
" wildignore also affects opening of files
set wildignore+=*.o,*.dll,*.pdb,*.exe,*.suo,*.obj,*.bin,*/CMakeFiles/*
" FSWitch mappings
nmap <leader>of :FSHere<cr>
" Let's assume you put all projects you are working on in your
" " corporation under $HOME/dev/my_corporation/
call lh#local_vimrc#munge('whitelist', $HOME)
call lh#local_vimrc#filter_list('asklist', 'v:val != $HOME')
" Disable question whether to load $HOME/.ycm_extrac
let g:ycm_extra_conf_globlist = [ '~/.ycm_extra_conf.py' ]