-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
277 lines (229 loc) · 6.27 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
" pastjean's vimrc
" Author : Pierre-Alexandre St-Jean <pierrealexandre.stjean@gmail.com>
" Source : https://github.com/pastjean/dotfiles
"
" feel free to use, modify, destroy, attack , steal...
" => Preamble <================================================================ {
" Disable default from plugins
let g:multi_cursor_use_default_mapping=0
" Start plugins
filetype off
call pathogen#infect()
filetype plugin indent on
set hidden
set nocompatible "power to vim
" }
" => Basic options <=========================================================== {
set encoding=utf-8
set fileformat=unix
set modelines=0
set title
set noerrorbells
set autoread
set splitbelow
set splitright
set autoindent
set smartindent
set cindent
set viewoptions=cursor,unix
set history=1000
"set undofile
"set undoreload=10000
set undolevels=1000
set noswapfile
set wildmenu
set wildmode=list:longest
" Disable bell plz
set vb t_vb=
if exists('+colorcolumn')
set colorcolumn=80
else
au BufWinEnter * let w:m2=matchadd('ErrorMsg', '\%>80v.\+', -1)
endif
highlight OverLength ctermbg=red ctermfg=white guibg=#592929
match OverLength /\%81v.\+/
" Tabs, spaces, wrapping {
set ts=2 sw=2 sts=2 "tabs
set expandtab "spaces no tabs
" }
" Display {
syntax on
set background=dark
set cursorline " Cursor highlight
set listchars=tab:▸\ ,eol:¬,trail:-,extends:>,precedes:<,nbsp:+
set ruler
set number
set cmdheight=1
set laststatus=2
"set statusline=\ %F%m%r%h\ %w\ [%{&ff}/%{&fenc}]%=Line:\ %l/%L:%c\ \ %P
set showmatch
set showmode
set showcmd
if has('gui_running')
set guifont=Droid\ Sans\ Mono\ for\ Powerline:h16
colorscheme molokai
endif
" I Want a mouse
set mouse=a
" and more caracters to redraw
set ttyfast
" }
" }
" => Navigation <============================================================== {
" Directional Keys
" Make cursor move by visual lines instead of file lines (when wrapping)
noremap k gk
noremap j gj
map <up> k
map <down> j
imap <up> <C-o>k
imap <down> <C-o>j
set scrolloff=3
set backspace=indent,eol,start " line change on backspace
set whichwrap=h,l,<,>,[,] " line change when going left or right
nnoremap Y y$
nnoremap D d$
" Make horizontal scrolling less horrible.
set sidescroll=1
set sidescrolloff=10
" }
" => Searching and movement =================================================== {
nnoremap / /\v
vnoremap / /\v
set ignorecase
set smartcase
set incsearch
set hlsearch
set virtualedit+=block
map <leader><space> :nohl<cr>
" Heresy
inoremap <c-a> <esc>I
inoremap <c-e> <esc>A
" }
" => Folding <================================================================= {
" }
" => Filetype specific <======================================================= {
" FileType specific Stuff
" " C
" au FileType c setlocal foldmethod=syntax
" " Html
" au FileType html setlocal foldmethod=manual
" " Javascript
" au FileType javascript setlocal foldmethod=marker
" au FileType javascript setlocal foldmarker={,}
" " Ruby
" au FileType ruby setlocal foldmethod=syntax
" " Vagrant
" au BufRead,BufNewFile Vagrantfile set ft=ruby
" " Vim
" au FileType vim setlocal foldmethod=marker
" au FileType help setlocal textwidth=80
" }
" => Mappings <================================================================ {
let mapleader = ","
" Trick that makes ; be a : so you dont have to hit shift for every stupid
" command
noremap ; :
" => Shortcut keys
nnoremap <C-S> :w<CR>
imap <C-S> <C-O><C-S>
inoremap <c-cr> <esc>A<cr>
" => Indenting commands
vmap <Tab> >gv
vmap <S-Tab> <gv
" => Switch Buffers
nmap <C-H> :bp<CR>
nmap <C-L> :bn<CR>
imap <C-H> <ESC><C-H>
imap <C-L> <ESC><C-L>
nnoremap <leader>w :set wrap!<CR>
nnoremap <leader>l :set list!<CR>
nnoremap <leader>n :set number! <CR>
nnoremap <leader>u :GundoToggle<CR>
nnoremap <leader>t :NERDTreeToggle<cr>
nnoremap <leader>r :RainbowToggle<cr>
nnoremap <leader>zw :ZoomWin<cr>
nnoremap <leader>p :TagbarToggle<cr>
let g:EasyMotion_leader_key = '<Leader>m'
" => Visual Wrap Text
vnoremap ( <ESC>`>a)<ESC>`<i(<ESC>
vnoremap ) <ESC>`>a)<ESC>`<i(<ESC>
vnoremap { <ESC>`>a}<ESC>`<i{<ESC>
vnoremap } <ESC>`>a}<ESC>`<i{<ESC>
vnoremap [ <ESC>`>a]<ESC>`<i[<ESC>
vnoremap ] <ESC>`>a]<ESC>`<i[<ESC>
" }
" => Plugin/Filters <========================================================== {
let g:rainbow_active = 1 "0 if you want to enable it later via :RainbowToggle
let g:go_disable_autoinstall = 0
let g:neocomplete#enable_at_startup = 1
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
if executable("ag")
let g:CtrlSpaceGlobCommand = 'ag -l --nocolor -g ""'
endif
" Principally for commandT
set wildignore+=*.o,*.obj,*.d,.git,node_modules,.DS_Store
" Permits to execute and replace inline
nmap gr :.!ruby<CR>
vmap gr :!ruby<CR>
let g:multi_cursor_next_key='<C-n>'
let g:multi_cursor_prev_key='<C-p>'
let g:multi_cursor_skip_key='<C-x>'
let g:multi_cursor_quit_key='<Esc>'
let g:syntastic_enable_signs=1
let g:syntastic_quiet_warnings=0
let g:syntastic_auto_loc_list=2
let g:racer_experimental_completer = 1
set hidden
" }
" => In GUI - MacVim or GVIM <================================================= {
if has('gui_running')
" Remove unusefull scrollbars
set guioptions-=l
set guioptions-=L
set guioptions-=r
set guioptions-=R
" vertical splits with a better line
set fillchars+=vert:│
set guioptions-=T " no toolbar
" Different cursors for different modes.
set guicursor=n-c:block-Cursor-blinkon0
set guicursor+=v:block-vCursor-blinkon0
endif
" }
"Use a bar-shaped cursor for insert mode, even through tmux.
if exists('$TMUX')
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\"
let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\"
else
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
endif
let g:tagbar_type_go = {
\ 'ctagstype' : 'go',
\ 'kinds' : [
\ 'p:package',
\ 'i:imports:1',
\ 'c:constants',
\ 'v:variables',
\ 't:types',
\ 'n:interfaces',
\ 'w:fields',
\ 'e:embedded',
\ 'm:methods',
\ 'r:constructor',
\ 'f:functions'
\ ],
\ 'sro' : '.',
\ 'kind2scope' : {
\ 't' : 'ctype',
\ 'n' : 'ntype'
\ },
\ 'scope2kind' : {
\ 'ctype' : 't',
\ 'ntype' : 'n'
\ },
\ 'ctagsbin' : 'gotags',
\ 'ctagsargs' : '-sort -silent'
\ }