-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
231 lines (192 loc) · 6.17 KB
/
vimrc
File metadata and controls
231 lines (192 loc) · 6.17 KB
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
" Maximize on startup (Win32)
if has("win32")
call plug#begin()
source ~/vimfiles/bundles.vim
call plug#end()
"autocmd GUIEnter * simalt ~x
" Put swap files in temp
set directory=c:/windows/temp/vim//i
behave mswin
" I have GNU Grep installed.
set t_Co=256
set grepprg=grep\ -nH
set guifont=Consolas_for_Powerline_FixedD:h9
let g:molokai_original=1
let g:Powerline_symbols="fancy"
if has("win64")
map <F12> <Esc>:call libcallnr($HOME."/vimfiles/gvimfullscreen_64.dll", "ToggleFullScreen", 0)<CR>
elseif has("win32")
map <F12> <Esc>:call libcallnr($HOME."/vimfiles/gvimfullscreen.dll", "ToggleFullScreen", 0)<CR>
endif
if executable("ag")
let $FZF_DEFAULT_COMMAND='ag -p ~/.gitignore -g ""'
endif
elseif has("unix")
call plug#begin()
source ~/.vim/bundles.vim
call plug#end()
let g:airline_powerline_fonts = 1
set grepprg=grep\ -nH
"let g:molokai_original=1
"let g:molokai_transparent = 1
"let g:molokai_alternate_comments = 1
" let g:rehash256 = 1
let g:gruvbox_plugin_hi_groups = 0
let g:gruvbox_transp_bg = 0
let g:airline_theme='distinguished'
set t_Co=256
endif
"set tab params
set tabstop=4
set shiftwidth=4
" GUI and color scheme
set background=dark
colorscheme gruvbox8_hard
"set linespace=0
"set fillchars=""
" UTF-8!
set encoding=utf-8
" Turn off menus, toolbars and scrollbars
set guioptions-=m
set guioptions-=T
set guioptions-=L
" Slashes in paths everywhere
set shellslash
" Various GUI/editing options
set cpoptions+=$
set backspace=indent,eol,start
set nowrap
set ruler
set showcmd
set showmode
set wildmenu
syntax on
" Tab/indent settings
set autoindent
set expandtab
set smarttab
set cino=:0l1g0t0(0
" Highlight search
set hlsearch
" No point in backup files, everything is version controlled!
set nobackup
set noswapfile
set laststatus=2
set cmdheight=2
" Hidden buffers don't ned to be unloaded
set hidden
" Wildcard ignores
set wildignore=*.o,*.obj,*.a,*.lib,*.exe,*.pdb,node_module/**,*.spec.ts
" Use The Silver Searcher when available
if executable("ag")
set grepprg=ag\ --nogroup\ --nocolor
let g:ackprg = 'ag --vimgrep'
let g:ctrlp_user_command = 'ag -l --nocolor -g "" %s'
endif
" Leader key is not possible with a french keyboard
let mapleader = ","
" NERDTree config
let NERDTreeShowBookmarks=1
nmap <F10> :NERDTreeToggle<CR>
nmap <F11> :cd %:p:h<CR>
" Quickfix mappings
nmap <F8> :cnext<CR>
nmap <S-F8> :cprevious<CR>
nmap <C-S-F> :noautocmd vimgrep
imap <C-S-F> :noautocmd vimgrep
" Turn off autohighlight by hitting return
nnoremap <CR> :nohl<CR><CR>
" DOS Edit-style copy & paste to system buffer.
vmap <C-Insert> "*y<CR>
vmap <C-Delete> "*d<CR>
nmap <S-Insert> "*P<CR>
vmap <S-Insert> "*P<CR>
"Buffers
nmap <C-PageUp> :bnext<CR>
nmap <C-PageDown> :bprevious<CR>
"alt -> and <- to cycle window panes
nnoremap <silent><A-Right> :wincmd l<CR>
nnoremap <silent><A-Left> :wincmd h<CR>
nnoremap <silent><A-Up> :wincmd k<CR>
nnoremap <silent><A-Down> :wincmd j<CR>
inoremap <silent><A-Right> <ESC>:wincmd l<CR>
inoremap <silent><A-Left> <ESC>:wincmd h<CR>
inoremap <silent><A-Up> <ESC>:wincmd k<CR>
inoremap <silent><A-Down> <ESC>:wincmd j<CR>
nnoremap <silent><A-p> :call CocActionAsync('jumpDefinition')<CR>
"ctrl + alt -> and <- move the window panes
nnoremap <silent><C-A-Right> :wincmd L<cr>
nnoremap <silent><C-A-Left> :wincmd H<cr>
nnoremap <silent><C-A-Up> :wincmd K<cr>
nnoremap <silent><C-A-Down> :wincmd J<cr>
inoremap <silent><C-A-Right> <ESC>:wincmd L<cr>
inoremap <silent><C-A-Left> <ESC>:wincmd H<cr>
inoremap <silent><C-A-Up> <ESC>:wincmd K<cr>
inoremap <silent><C-A-Down> <ESC>:wincmd J<cr>
command Flash :!make && make stflash
command FormatBDD :s#\(\%(\<\l\+\)\%(_\)\@=\)\|_\(\l\)#\u\1\2#g
command JSONP %!python -m json.tool
command FormatXML :%!python -c "import xml.dom.minidom, sys; print(xml.dom.minidom.parse(sys.stdin).toprettyxml())"
set wildignore+=*\\tmp\\*,*.swp,*.zip,*.exe " Windowus
nmap <F9> :FormatBDD<CR>
" Coc.vim config
" Use tab for trigger completion with characters ahead and navigate
" NOTE: There's always complete item selected by default, you may want to enable
" no select by `"suggest.noselect": true` in your configuration file
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config
inoremap <silent><expr> <TAB>
\ coc#pum#visible() ? coc#pum#next(1) :
\ CheckBackspace() ? "\<Tab>" :
\ coc#refresh()
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
" Make <CR> to accept selected completion item or notify coc.nvim to format
" <C-g>u breaks current undo, please make your own choice
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
nnoremap <silent> <leader>i :call ShowDocumentation()<CR>
nmap <silent> <leader>j <Plug>(coc-diagnostic-prev)
nmap <silent> <leader>k <Plug>(coc-diagnostic-next)
function! ShowDocumentation()
if CocAction('hasProvider', 'hover')
call CocActionAsync('doHover')
else
call feedkeys('K', 'in')
endif
endfunction
function! CheckBackspace()
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
" GoTo code navigation
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
nmap <silent> gf <Plug>(coc-quickfix)
nmap <silent> <F2> <Plug>(coc-rename)
" End of Coc.vim config
" FZF
nmap <C-p> :FZF<CR>
let g:fzf_vim = {}
"let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.6, 'relative': v:true, 'yoffset': 1.0 } }
let g:fzf_layout = { 'down': '40%' }
" Toogle BG on linux
inoremap <F12> :call ToggleBg()<CR>
function! ToggleBg() abort
if g:gruvbox_transp_bg == 1
let g:gruvbox_transp_bg = 0
else
let g:gruvbox_transp_bg = 1
endif
colorscheme gruvbox8_hard
echow "Reloaded color map"
endfunction
let g:NERDTreeWinPos = "right"
set number
set relativenumber
au FileType gitcommit setlocal tw=72
"autocmd! BufNewFile,BufRead *.ts set filetype=javascript
let g:ctrlp_custom_ignore = '\v[\/](node_modules|target|dist|Build)|(\.(swp|ico|git|svn))$'
autocmd! BufNewFile,BufRead .plan set filetype=plan
"