-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.vim
298 lines (238 loc) · 8.73 KB
/
init.vim
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
" Plugins
"=============================================================================
" VimPlug: https://github.com/junegunn/vim-plug
" Install with :source ~/.vimrc | PlugInstall
" Specify a directory for plugins
call plug#begin('~/vimfiles/plugged')
"Plug 'flazz/vim-colorschemes'
"Plug 'felixhummel/setcolors.vim'
"Plug 'altercation/vim-colors-solarized'
"Plug 'lifepillar/vim-solarized8'
Plug 'NLKNguyen/papercolor-theme'
"Plug 'jonathanfilip/vim-lucius'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
let g:airline#extensions#tabline#enabled = 1
let g:airline_powerline_fonts = 1
" unicode symbols
set encoding=utf-8
" if !exists('g:airline_symbols')
" let g:airline_symbols = {}
" endif
" unicode symbols
" let g:airline_left_sep = '»'
" let g:airline_left_sep = '▶'
" let g:airline_right_sep = '«'
" let g:airline_right_sep = '◀'
" let g:airline_symbols.linenr = '␊'
" let g:airline_symbols.linenr = ''
" let g:airline_symbols.linenr = '¶'
" let g:airline_symbols.branch = '⎇'
" let g:airline_symbols.paste = 'ρ'
" let g:airline_symbols.paste = 'Þ'
" let g:airline_symbols.paste = '∥'
" let g:airline_symbols.whitespace = 'Ξ'
"
" " airline symbols
" let g:airline_left_sep = ''
" let g:airline_left_alt_sep = ''
" let g:airline_right_sep = ''
" let g:airline_right_alt_sep = ''
" let g:airline_symbols.branch = ''
" let g:airline_symbols.readonly = ''
" let g:airline_symbols.linenr = ''
"Plug 'jelera/vim-javascript-syntax'
"Plug 'vim-scripts/JavaScript-Indent'
Plug 'sheerun/vim-polyglot'
"Plug 'Shougo/unite.vim'
"Plug 'Shougo/vimproc.vim', {'do' : 'make'}
"Plug 'Shougo/vimproc.vim'
" let g:vimproc#download_windows_dll = 1
Plug 'ctrlpvim/ctrlp.vim'
let g:ctrlp_working_path_mode = 'rw'
"let g:ctrlp_user_command = '\bin\ag.exe --nocolor --hidden -g "" %s'
"let g:ctrlp_user_command = 'pt --nogroup -S --ignore=node_modules --global-gitignore -g "" %s'
let g:ctrlp_user_command ='rg -F --files --hidden %s'
let g:ctrlp_by_filename = 0
let g:ctrlp_mruf_case_sensitive = 0
let g:ctrlp_max_files = 0 " no limit
let g:ctrlp_show_hidden = 1
Plug 'JazzCore/ctrlp-cmatcher'
let g:ctrlp_match_func = {'match' : 'matcher#cmatch' }
"Plug 'junegunn/fzf', { 'dir': '~/.fzf' }
Plug 'dyng/ctrlsf.vim'
let g:ctrlsf_ackprg = 'rg'
Plug 'xolox/vim-misc'
Plug 'xolox/vim-session'
let g:session_autosave = 'yes'
let g:session_autoload = 'yes'
Plug 'vim-syntastic/syntastic'
let g:syntastic_javascript_checkers = ['jshint']
let g:syntastic_json_checkers = ['jshint']
let g:syntastic_javascript_jshint_args =
\ '--config C:/code/hana_epm_fpa/config/coding/jshintConfig.js'
let g:syntastic_css_checkers = ['csslint']
let g:syntastic_css_csslint_args =
\ '--ignore=order-alphabetical,important,ids,adjoining-classes,zero-units'
Plug 'koron/nyancat-vim'
Plug 'pelodelfuego/vim-swoop'
" TODO: figure out how to use
Plug 'scrooloose/nerdcommenter'
" Add spaces after comment delimiters by default
let g:NERDSpaceDelims = 1
" Use compact syntax for prettified multi-line comments
let g:NERDCompactSexyComs = 1
" Align line-wise comment delimiters flush left instead of following code indentation
let g:NERDDefaultAlign = 'left'
" Set a language to use its alternate delimiters by default
let g:NERDAltDelims_java = 1
" Allow commenting and inverting empty lines (useful when commenting a region)
let g:NERDCommentEmptyLines = 1
" Enable trimming of trailing whitespace when uncommenting
let g:NERDTrimTrailingWhitespace = 1
Plug 'easymotion/vim-easymotion'
"Plug 'lambdalisue/vim-gita'
Plug 'tpope/vim-fugitive'
Plug 'ryanoasis/vim-devicons'
Plug 'jiangmiao/auto-pairs'
Plug 'maksimr/vim-jsbeautify'
" Initialize plugin system
call plug#end()
" General settings
"===============================================================================
set nocompatible
syntax enable
"set guifont=Hack:h10:cANSI:qDRAFT
"set guifont=Droid_Sans_Mono_Dotted_for_Powe:h10:cANSI:qDRAFT
"set guifont=Fira_Mono_For_Powerline:h11:cANSI:qDRAFT
" set guifont=DejaVu_Sans_Mono_For_Powerline:h10:cANSI:qDRAFT
"set guifont=DroidSansMonoForPowerline_NF:h10:cANSI:qDRAFT
set guifont=Knack_NF:h10:cANSI:qDRAFT
set background=light
colorscheme PaperColor " tutticolor colorful lucius
set hidden
filetype on
filetype indent on
filetype plugin on
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set smarttab
set hlsearch " highlight search
set incsearch " incremental search
set ignorecase
set smartcase
set infercase " better case handling for insert mode completion
set wrapscan
set smartindent
"set autoindent
set autoread " automatically reload files changed outside Vim
"set autowrite " automatically write files when doing things like :make
set cmdheight=2
set laststatus=2
set showcmd
set showfulltag
set shortmess+=ts
" make backspace work
set bs=2
if has("gui_running")
set guioptions-=T
au GUIEnter * simalt ~x "maximize
endif
"set autowriteall
set wildchar=<Tab> wildmenu wildmode=longest:full,full
set cursorline
set clipboard=unnamed " use system clipboard
set fileformats=unix,dos
set backupcopy=yes " make file change watchers happy
" line numbering
set number
autocmd InsertEnter * :set norelativenumber
autocmd InsertLeave * :set relativenumber
":au FocusLost * :set norelativenumber
":au FocusGained * :set relativenumber
"set shellslash " use forward slasheds
function! <SID>StripTrailingWhitespaces()
let l = line(".")
let c = col(".")
%s/\s\+$//e
call cursor(l, c)
endfun
autocmd BufWritePre * :call <SID>StripTrailingWhitespaces()
" Key mappings
"===============================================================================
" note: you can see mapping with :map <key> (ex: :map <C-d>)
let mapleader = ","
imap jk <Esc>
cmap jk <C-U><Esc>
set timeoutlen=1000
vnoremap <C-c> "*y
inoremap <C-v> <C-O>"*p
nnoremap ; :
"Note: command history is: q:
" If the current buffer has never been saved, it will have no name,
" call the file browser to save it, otherwise just save it.
command! -nargs=0 -bar Update if &modified
\| if empty(bufname('%'))
\| browse confirm write
\| else
\| confirm write
\| endif
\|endif
nnoremap <silent> <C-S> :<C-U>Update<CR>
nnoremap <Leader>w :<C-U>Update<CR>
vnoremap <silent> <C-S> <C-C>:Update<CR>
inoremap <silent> <C-S> <C-O>:Update<CR>
"splits
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
nnoremap <C-Q> <C-W><C-Q>
nnoremap <leader>q :bp\|bd #<CR>
"finding files
nnoremap <silent><leader>f :<C-U>CtrlPMixed<CR>
nnoremap <silent><C-p> :<C-U>CtrlPMixed<CR>
nnoremap <silent><leader>b :<C-U>CtrlPBuffer<CR>
"searching in files
nmap <C-F>f <Plug>CtrlSFPrompt
vmap <C-F>f <Plug>CtrlSFVwordPath
vmap <C-F>F <Plug>CtrlSFVwordExec
"nmap <C-F>n <Plug>CtrlSFCwordPath
nmap <C-F>p <Plug>CtrlSFPwordPath
nnoremap <C-F>o :CtrlSFOpen<CR>
nnoremap <C-F>t :CtrlSFToggle<CR>
inoremap <C-F>t <Esc>:CtrlSFToggle<CR>
nmap <C-F>l <Plug>CtrlSFQuickfixPrompt
vmap <C-F>l <Plug>CtrlSFQuickfixVwordPath
vmap <C-F>L <Plug>CtrlSFQuickfixVwordExec
function! SearchWebpackNodeModulesFun( arg )
let g:ctrlsf_extra_backend_args = {'rg': '--no-ignore-parent'}
execute 'CtrlSF ' . a:arg . ' /code/hana_epm_fpa/webpack/node_modules'
let g:ctrlsf_extra_backend_args = {}
endfunction
command! -nargs=* SearchWebpackNodeModules call SearchWebpackNodeModulesFun( '<args>' )
noremap <C-F>n :SearchWebpackNodeModules<space>
"easymotion
" <Leader>f{char}{char} to move to {char}
map <Leader>s <Plug>(easymotion-bd-f2)
"nmap <Leader>f <Plug>(easymotion-overwin-f)
" s{char}{char} to move to {char}{char}
nmap s <Plug>(easymotion-overwin-f2)
" Move to line
map <Leader>L <Plug>(easymotion-bd-jk)
nmap <Leader>L <Plug>(easymotion-overwin-line)
" Move to word
map <Leader>w <Plug>(easymotion-bd-w)
"vimdiff current vs git head (fugitive extension)
nnoremap <Leader>gd :Gdiff<cr>
"switch back to current file and closes fugitive buffer
nnoremap <Leader>gD <c-w>h<c-w>c
nnoremap <Leader>gs :Gstatus<cr>
autocmd BufReadPost fugitive://* set bufhidden=delete
autocmd FileType javascript vnoremap <buffer> <leader>i :call RangeJsBeautify()<cr>
autocmd FileType json vnoremap <buffer> <leader>i :call RangeJsonBeautify()<cr>
autocmd FileType jsx vnoremap <buffer> <leader>i :call RangeJsxBeautify()<cr>
autocmd FileType html vnoremap <buffer> <leader>i :call RangeHtmlBeautify()<cr>
autocmd FileType css vnoremap <buffer> <leadedoner>i :call RangeCSSBeautify()<cr>