-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.vimrc
282 lines (250 loc) · 8.8 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
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Maintainer: Eguzki Astiz Lezaun
"
"
" Version: 1.8 - Oct 2023
"
" Sections:
" -> General
" -> Colors and Fonts
" -> Files, backups and undo
" -> Text, tab and indent related
" -> Visual mode related
"
" Plugins_Included:
"
" > Vundle - https://github.com/gmarik/vundle
" Vundle is short for Vim bundle and is a Vim plugin manager.
"
" > NERD tree - https://github.com/scrooloose/nerdtree
" Vundle is short for Vim bundle and is a Vim plugin manager.
"
" > EasyMotion - https://github.com/Lokaltog/vim-easymotion
" EasyMotion provides a much simpler way to use some motions in vim.
"
" > surround.vim - https://github.com/tpope/vim-surround
" Makes it easy to work with surrounding text:
" info -> :help surround
"
" > Syntastic - https://github.com/scrooloose/syntastic
" Syntastic is a syntax checking plugin that runs files through
" external syntax checkers and displays any resulting errors to the
" user
" info -> :help syntastic-checker-options
"
" > fzf vim - https://github.com/junegunn/fzf.vim
" fzf is a general-purpose command-line fuzzy finder.
"
" > ListToggle - https://github.com/Valloric/ListToggle
" A vim plugin for toggling the display of the quickfix list and the
" location-list
"
" > Vim-Airline - https://github.com/bling/vim-airline
" lean & mean status/tabline for vim that's light as air
"
" > EasyAlign - https://github.com/junegunn/vim-easy-align
" A simple, easy-to-use Vim alignment plugin.
"
" > vim-solarized8 - https://github.com/lifepillar/vim-solarized8
" Terminal mode color schemes
"
" > vim-wakatime- https://github.com/wakatime/vim-wakatime
" automatic time tracking and metrics generated from your programming activity
"
" > ack - https://github.com/mileszs/ack.vim
" Run your favorite search tool from Vim, with an enhanced results list
"
" > vim-gitgutter - https://github.com/airblade/vim-gitgutter
" shows a git diff in the 'gutter' (sign column)
"
" > indentLine - https://github.com/Yggdroot/indentLine
" Displaying thin vertical lines at each indentation level for code indented with spaces
"
" > vim-fugitive - https://github.com/tpope/vim-fugitive
" Fugitive is the premier Vim plugin for Git
" "
" "
" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => General
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Sets how many lines of history VIM has to remember
set history=700
" Set to auto read when a file is changed from the outside
set autoread
set expandtab
set nowrap
" always show line numbers
set number
" ignore case when searching
set ignorecase
" ignore case if search pattern is all lowercase,
" " case-sensitive otherwise
set smartcase
map <F2> :NERDTreeToggle<CR>
set pastetoggle=<F3>
" Hide default status line
set noshowmode
set shell=/bin/bash
set encoding=utf-8
set ffs=unix,dos,mac "Default file types
" toggling the cursorline
autocmd InsertEnter * set cul
autocmd InsertLeave * set nocul
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Files, backups and undo
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Turn backup off, since most stuff is in SVN, git anyway...
set nobackup
set nowb
set noswapfile
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Text, tab and indent related
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set smartindent
set autoindent
set tabstop=2
set softtabstop=2
set shiftwidth=2
set showmatch
set hls
set incsearch
set colorcolumn=100
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Visual Search
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" http://got-ravings.blogspot.com/2008/07/vim-pr0n-visual-search-mappings.html
function! s:VSetSearch()
let temp = @@
norm! gvy
let @/ = '\V' . substitute(escape(@@, '\'), '\n', '\\n', 'g')
let @@ = temp
endfunction
vnoremap * :<C-u>call <SID>VSetSearch()<CR>//<CR>
vnoremap # :<C-u>call <SID>VSetSearch()<CR>??<CR>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Markdown
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" associate *.md with markdown filetype
au BufRead,BufNewFile *.md set filetype=markdown
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Yaml
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" associate *.yaml|yml with yaml filetype
au! BufNewFile,BufReadPost *.{yaml,yml} set filetype=yaml foldmethod=indent
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
""""""""""""""""""""""""""""""
" => Vundle
""""""""""""""""""""""""""""""
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()
" let Vundle manage Vundle
" required!
Plugin 'gmarik/Vundle.vim'
" Keep Plugin commands between vundle#begin/end.
Plugin 'scrooloose/nerdtree'
Plugin 'Lokaltog/vim-easymotion'
Plugin 'tpope/vim-surround'
Plugin 'scrooloose/syntastic'
Plugin 'junegunn/fzf'
Plugin 'junegunn/fzf.vim'
Plugin 'Valloric/ListToggle'
Plugin 'bling/vim-airline'
Plugin 'junegunn/vim-easy-align'
Plugin 'lifepillar/vim-solarized8'
Plugin 'wakatime/vim-wakatime'
Plugin 'mileszs/ack.vim'
Plugin 'airblade/vim-gitgutter'
Plugin 'Yggdroot/indentLine'
Plugin 'tpope/vim-fugitive'
" 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
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Colors and Fonts
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Enable syntax hl
syntax enable
if $COLORTERM == 'gnome-terminal'
set t_Co=256
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Color scheme
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set background=dark
autocmd vimenter * ++nested colorscheme solarized8_high
""""""""""""""""""""""""""""""
" => fzf
""""""""""""""""""""""""""""""
nnoremap <silent> <C-f> :Files<CR>
""""""""""""""""""""""""""""""
" => Syntastic
""""""""""""""""""""""""""""""
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 0
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_yaml_checkers = ['yamllint']
""""""""""""""""""""""""""""""
" => ListToggle
""""""""""""""""""""""""""""""
let g:lt_location_list_toggle_map = '<leader>l'
let g:lt_quickfix_list_toggle_map = '<leader>q'
""""""""""""""""""""""""""""""
" => Vim-Airline
""""""""""""""""""""""""""""""
set laststatus=2
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
""""""""""""""""""""""""""""""
" => easy-align
""""""""""""""""""""""""""""""
" Start interactive EasyAlign in visual mode (e.g. vipga)
xmap ga <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap ga <Plug>(EasyAlign)
""""""""""""""""""""""""""""""
" => Misc
""""""""""""""""""""""""""""""
" Keep the cursos in the middle of the screen
let &scrolloff=999-&scrolloff
" Functions for cleaning up tabs and spaces
function! RemoveTrailingSpaces()
%s/\s\+$//e
endfunction
function! ConvertTabsToSpaces()
%retab
endfunction
function! CleanFile()
call ConvertTabsToSpaces()
call RemoveTrailingSpaces()
endfunction
" Key binding \f to clean up file
nmap <silent> <leader>f <Esc>:call CleanFile()<CR>
""""""""""""""""""""""""""""""
" => Ack
""""""""""""""""""""""""""""""
" Options include:
" --vimgrep -> Needed to parse the ag response properly for ack.vim
" --smart-case -> Search case insensitive if all lowercase pattern, Search case sensitively otherwise
let g:ackprg = 'ag --vimgrep --smart-case --hidden --ignore .git'
" Any empty ack search will search for the work the cursor is on
let g:ack_use_cword_for_empty_search = 1
" Don't jump to first match
cnoreabbrev Ack Ack!
" Maps <leader>/ so we're ready to type the search keyword
nnoremap <Leader>/ :Ack!<Space>
" search for a current visual selection
" This solution uses the <C-r>= trick that allows you to enter a kind of second-level command-line, which allows you to enter any vimscript expression, which is then evaluated, and the result is stringified and pasted onto the (original, first-level) command-line where the cursor is.
vnoremap <Leader>/ y:Ack! <C-r>=fnameescape(@")<CR><CR>
""""""""""""""""""""""""""""""
" => indentLine
""""""""""""""""""""""""""""""
let g:indentLine_setColors = 0
let g:indentLine_char = '⦙'