-
Notifications
You must be signed in to change notification settings - Fork 0
/
dotvimrc
288 lines (230 loc) · 8.85 KB
/
dotvimrc
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
" the folowing is for the pathogen Pluglin, pathogen.vim, located at ~/.vim/autoload/pathogen.vim
call plug#begin()
Plug 'tpope/vim-sensible'
Plug 'scrooloose/nerdcommenter'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'neoclide/coc.nvim', {'branch': 'release'}
"
" " Plug 'mattn/gist-vim'
" " Plug 'mattn/webapi-vim'
" " Plug 'godlygeek/tabular'
" " Plug 'ctrlpvim/ctrlp.vim'
"
Plug 'lervag/vimtex'
Plug 'pangloss/vim-javascript'
Plug 'slashmili/alchemist.vim'
Plug 'elixir-lang/vim-elixir'
Plug 'sheerun/vim-polyglot'
Plug 'rosenfeld/conque-term'
" Plug 'ElmCast/elm-vim'
"Plug 'Shougo/neocomplete.vim'
"
"
Plug 'nvie/vim-flake8'
Plug 'Chiel92/vim-autoformat'
call plug#end()
" use different swapfile location (you should create if if doesn't exist):
:set directory=~/.vim/swapfiles//
" turn on autoindent
set autoindent
"change tabs width from 8 to 2
set tabstop=4 shiftwidth=4 softtabstop=4 expandtab
map <F2> :set tabstop=2 shiftwidth=2 softtabstop=2 expandtab <CR> :%retab! <CR>
map <F3> :set noexpandtab <CR> :%retab! <CR>
map <F4> :set tabstop=4 shiftwidth=4 softtabstop=4 expandtab <CR> :%retab <CR>
"only works if vim is built with python support
map <F5> :ConqueTermSplit bash <CR>
nnoremap th :tabnext<CR>
nnoremap tl :tabprev<CR>
nnoremap tn :tabnew<CR>
nnoremap tc :tabclose<CR>
" enable filetypes. I think its needed for syntax highting.. maybe otherthings too ( found haskell-mode to use it too)
" filetype plugin on
" show Line numbers on left side
set number
"to launch NERDTree with F6
nmap <F6> :NERDTree<CR>
" "for haskell mode from http://projects.haskell.org/haskellmode-vim
" "enable syntax highlighting
" syntax on
"
" "To use the features provided by the GHC |compiler| plugin
" au BufEnter *.hs compiler ghc
"
" "If the compiler plugin can't locate your GHC binary, or if you have
" "several versions of GHC installed and have a preference as to which binary
" "is used, set |g:ghc|:
" ">
" ":let g:ghc="/usr/bin/ghc-6.6.1"
"
" "The preferred HTML browser for viewing Haddock documentation can be set as
" "follows:
" :let g:haddock_browser="/usr/bin/firefox"
" "Your system's installed Haddock documentation for GHC and its libraries
" "should be automatically detected. If the plugin can't locate them, you
" "must point |g:haddock_docdir| to the path containing the master index.html
" "file for the subdirectories 'libraries', 'Cabal', 'users_guide', etc.:
"
" ":let g:haddock_docdir="/usr/local/share/doc/ghc/html/"
func! WordProcessorMode()
setlocal formatoptions=1
setlocal noexpandtab
map j gj
map k gk
setlocal spell spelllang=en_us
"set thesaurus+=/Users/sbrown/.vim/thesaurus/mthesaur.txt
set complete+=s
set formatprg=par
setlocal wrap
setlocal linebreak
endfu
com! WP call WordProcessorMode()
"to covert vimoutliner .otl to markdown using 'call VO2MD()' and back with
"'call MD2VO()'
" function! VO2MD()
" let lines = []
" let was_body = 0
" for line in getline(1,'$')
" if line =~ '^\t*[^:\t]'
" let indent_level = len(matchstr(line, '^\t*'))
" if was_body " <= remove this line to have body lines separated
" call add(lines, '')
" endif " <= remove this line to have body lines separated
" call add(lines, substitute(line, '^\(\t*\)\([^:\t].*\)', '\=repeat("#", indent_level + 1)." ".submatch(2)', ''))
" call add(lines, '')
" let was_body = 0
" else
" call add(lines, substitute(line, '^\t*: ', '', ''))
" let was_body = 1
" endif
" endfor
" silent %d _
" call setline(1, lines)
" endfunction
"
" function! MD2VO()
" let lines = []
" for line in getline(1,'$')
" if line =~ '^\s*$'
" continue
" endif
" if line =~ '^#\+'
" let indent_level = len(matchstr(line, '^#\+')) - 1
" call add(lines, substitute(line, '^#\(#*\) ', repeat("\<Tab>", indent_level), ''))
" else
" call add(lines, substitute(line, '^', repeat("\<Tab>", indent_level) . ': ', ''))
" endif
" endfor
" silent %d _
" call setline(1, lines)
" endfunction
" let g:alchemist#elixir_erlang_src = "~/src"
"
" " whitespacing for elixir filestypes
" autocmd Filetype elixir setlocal ts=2 sts=2 sw=2
" " autocomplpop
" let g:acp_enableAtStartup = 0
"
" " Use neocomplete.
" let g:neocomplete#enable_at_startup = 1
" " Use smartcase.
" let g:neocomplete#enable_smart_case = 1
" " Set minimum syntax keyword length.
" let g:neocomplete#sources#syntax#min_keyword_length = 3
" let g:neocomplete#enable_auto_select = 1
"
" " <TAB>: completion.
" inoremap <expr><TAB> pumvisible() ? "<Down>" : "\<TAB>"
" inoremap <expr><S-TAB> pumvisible() ? neocomplete#smart_close_popup() : "\<TAB>"
" inoremap <expr><BS> pumvisible() ? neocomplete#smart_close_popup()."<C-h>".neocomplete#start_manual_complete() : "\<BS>"
" inoremap <expr><CR> pumvisible() ? "<C-y>" : "\<CR>"
"
" call neocomplete#util#set_default_dictionary(
" \ 'g:neocomplete#sources#omni#input_patterns',
" \ 'elm',
" \ '\.')
"
" :set backspace=indent,eol,start
"
" Popup color.
hi Pmenu ctermbg=6
hi PmenuSel ctermbg=2
hi PmenuSbar ctermbg=0
" settings for gist-vim :
" the following token/user are in plugin/github_api_token.vim
"let g:github_token = "<my_personal_api_token_for_gists>"
"let g:github_user = "<username>"
" let g:gist_clip_command = 'xclip -selection clipboard'
"
"
"" Settings for coc-nvim:
"
" use <tab> for trigger completion and navigate to the next complete item
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction
inoremap <silent><expr> <Tab>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<Tab>" :
\ coc#refresh()
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm() : "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
autocmd! CompleteDone * if pumvisible() == 0 | pclose | endif
" Configuration for coc.nvim (from https://scalameta.org/metals/docs/editors/vim.html)
" Smaller updatetime for CursorHold & CursorHoldI
set updatetime=300
" don't give |ins-completion-menu| messages.
set shortmess+=c
" always show signcolumns
" set signcolumn=yes
" Some server have issues with backup files, see #649
set nobackup
set nowritebackup
" Better display for messages
set cmdheight=2
" Use <c-space> for trigger completion.
inoremap <silent><expr> <c-space> coc#refresh()
" Use <cr> for confirm completion, `<C-g>u` means break undo chain at current position.
" Coc only does snippet and additional edit on confirm.
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
" Use `[c` and `]c` for navigate diagnostics
nmap <silent> [c <Plug>(coc-diagnostic-prev)
nmap <silent> ]c <Plug>(coc-diagnostic-next)
" Remap keys for gotos
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)
" Remap for do codeAction of current line
nmap <leader>ac <Plug>(coc-codeaction)
" Remap for do action format
nnoremap <silent> F :call CocAction('format')<CR>
" Use K for show documentation in preview window
nnoremap <silent> K :call <SID>show_documentation()<CR>
function! s:show_documentation()
if &filetype == 'vim'
execute 'h '.expand('<cword>')
else
call CocAction('doHover')
endif
endfunction
" Highlight symbol under cursor on CursorHold
autocmd CursorHold * silent call CocActionAsync('highlight')
" Remap for rename current word
nmap <leader>rn <Plug>(coc-rename)
" Show all diagnostics
nnoremap <silent> <space>a :<C-u>CocList diagnostics<cr>
" Find symbol of current document
nnoremap <silent> <space>o :<C-u>CocList outline<cr>
" Search workspace symbols
nnoremap <silent> <space>s :<C-u>CocList -I symbols<cr>
" Do default action for next item.
nnoremap <silent> <space>j :<C-u>CocNext<CR>
" Do default action for previous item.
nnoremap <silent> <space>k :<C-u>CocPrev<CR>
" Resume latest coc list
nnoremap <silent> <space>p :<C-u>CocListResume<CR>
noremap <F3> :Autoformat<CR>