arnaucube
arnaucube/configsPublic Self-hosted repository
configs/init.vim
init.vimRaw
  1source ~/vimconfigbase.vim
  2
  3" Automate plug.vim installation:
  4let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'
  5if empty(glob(data_dir . '/autoload/plug.vim'))
  6  silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs  https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
  7  autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
  8endif
  9
 10call plug#begin(expand('~/.config/nvim/plugged'))
 11
 12nnoremap <Space> <nop>
 13let mapleader = "\<Space>"
 14let g:mapleader = "\<Space>"
 15let maplocalleader =  "\<Space>"
 16
 17" nerdtree
 18Plug 'scrooloose/nerdtree'
 19Plug 'jistr/vim-nerdtree-tabs'
 20Plug 'scrooloose/nerdcommenter'
 21
 22" vim-airline
 23Plug 'vim-airline/vim-airline'
 24Plug 'vim-airline/vim-airline-themes'
 25
 26" vim-ripgrep
 27Plug 'jremmen/vim-ripgrep'
 28
 29Plug 'airblade/vim-gitgutter'
 30Plug 'Raimondi/delimitMate'
 31Plug 'majutsushi/tagbar'
 32
 33" rainbow parentheses
 34Plug 'luochen1990/rainbow'
 35
 36" git
 37Plug 'tpope/vim-fugitive'
 38" gitlink
 39Plug 'mazubieta/gitlink-vim'
 40
 41" go
 42Plug 'fatih/vim-go' " Amazing combination of features.
 43Plug 'godoctor/godoctor.vim' " Some refactoring tools
 44
 45" rust
 46Plug 'rust-lang/rust.vim'
 47" set hidden
 48let g:rustfmt_fail_silently = 0
 49let g:rustfmt_autosave = 1
 50
 51" Lean
 52Plug 'Julian/lean.nvim'
 53" let g:lean_config = {'mappings' = v:true}
 54let g:lean_config = {
 55      \ 'mappings': v:true,
 56      \ }
 57
 58
 59" javascript
 60Plug 'jelera/vim-javascript-syntax'
 61
 62" python (disabled as puts conceallevel=2, which forces markdown
 63" previsualization :S)
 64" Plug 'davidhalter/jedi-vim'
 65" Plug 'raimon49/requirements.txt.vim', {'for': 'requirements'}
 66
 67" solidity
 68Plug 'tomlion/vim-solidity'
 69" circom
 70Plug 'iden3/vim-circom-syntax'
 71" Cairo
 72" Plug 'miguelmota/cairo.vim'
 73
 74" LaTeX support. It needs latexmk & zathura
 75Plug 'lervag/vimtex'
 76
 77" Coq/Rocq
 78Plug 'whonore/Coqtail'
 79
 80" deoplete
 81Plug 'Shougo/deoplete.nvim'
 82let g:deoplete#enable_at_startup = 1
 83autocmd CompleteDone * pclose!
 84" Plug 'zchee/deoplete-go', {'build': {'unix': 'make'}}
 85" " neosnippet with deoplete
 86" Plug 'Shougo/neosnippet.vim'
 87" Plug 'Shougo/neosnippet-snippets'
 88" " Plugin deoplete neosnippet key-mappings.
 89" " Note: It must be "imap" and "smap".  It uses <Plug> mappings.
 90" imap <C-k>     <Plug>(neosnippet_expand_or_jump)
 91" smap <C-k>     <Plug>(neosnippet_expand_or_jump)
 92" xmap <C-k>     <Plug>(neosnippet_expand_target)
 93
 94" automatically adjust shiftwidth and expand tab based on current file
 95Plug 'tpope/vim-sleuth'
 96
 97
 98" errors
 99Plug 'Valloric/ListToggle'
100Plug 'autozimu/LanguageClient-neovim', {
101    \ 'branch': 'next',
102    \ 'do': 'bash install.sh',
103    \ }
104Plug 'neoclide/coc.nvim', {'branch': 'release'}
105" after PlugInstall, install coc-rust-analyzer:
106" :CocInstall coc-rust-analyzer
107" also run (outside vim, in a shell):
108" rustup component add rust-analyzer
109
110" focus mode
111Plug 'junegunn/goyo.vim'
112Plug 'szw/vim-maximizer' " use `CTRL+w; m` to maximize panel
113
114" vimwiki
115Plug 'vimwiki/vimwiki'
116" vim calendar
117Plug 'mattn/calendar-vim'
118
119" colors
120Plug 'tomasr/molokai'
121Plug 'srcery-colors/srcery-vim'
122Plug 'rakr/vim-one'
123Plug 'morhetz/gruvbox'
124Plug 'noahfrederick/vim-hemisu'
125Plug 'JaySandhu/xcode-vim'
126
127call plug#end()
128
129let $NVIM_TUI_ENABLE_TRUE_COLOR=1
130set termguicolors
131
132if $COLORTERM == 'gnome-terminal'
133  set term=gnome-256color
134else
135  if $TERM == 'xterm'
136    set term=xterm-256color
137  endif
138endif
139
140set statusline=%F%m%r%h%w%=(%{&ff}/%Y)\ (line\ %l\/%L,\ col\ %c)\
141
142
143" NERDTree
144let NERDTreeShowHidden=1
145autocmd vimenter * NERDTree
146map <C-n> :NERDTreeToggle<CR>
147" NERDCommenter
148let g:NERDSpaceDelims = 1 " Add spaces after comment delimiters by default
149let g:NERDDefaultAlign = 'left' " Align line-wise comment delimiters flush left instead of following code indentation
150let g:NERDCommentEmptyLines = 1 " Allow commenting and inverting empty lines (useful when commenting a region)
151
152
153"" go config
154function! s:build_go_files()
155  let l:file = expand('%')
156  if l:file =~# '^\f\+\.go$'
157    call go#cmd#Build(0)
158  endif
159endfunction
160
161
162let g:go_list_type = "quickfix"
163let g:go_fmt_command = "goimports"
164let g:go_fmt_fail_silently = 1
165let g:go_highlight_types = 1
166let g:go_highlight_fields = 1
167let g:go_highlight_functions = 1
168let g:go_highlight_methods = 1
169let g:go_highlight_operators = 1
170let g:go_highlight_build_constraints = 1
171let g:go_highlight_structs = 1
172let g:go_highlight_generate_tags = 1
173let g:go_highlight_space_tab_error = 0
174let g:go_highlight_array_whitespace_error = 0
175let g:go_highlight_trailing_whitespace_error = 0
176let g:go_highlight_extra_types = 1
177
178
179" vim-airline
180"" let g:airline_theme = 'powerlineish'
181let g:airline_theme='one'
182" let g:airline#extensions#syntastic#enabled = 1
183let g:airline#extensions#branch#enabled = 1
184let g:airline#extensions#tabline#enabled = 1
185let g:airline#extensions#tabline#buffer_nr_show = 1
186let g:airline#extensions#tagbar#enabled = 1
187let g:airline_skip_empty_sections = 1
188
189
190" errors
191"" For go needs gopls installed (comes with vim-go pluggin)
192"" For rust with rust-analyzer needs https://rust-analyzer.github.io/manual.html#rust-analyzer-language-server-binary installed
193""  --> place it at ~.local/bin or ~/bin and make sure that the PATH is defined (eg. in .zshrc: export PATH=$PATH:.local/bin)
194""      [old] for rust with rls needs https://github.com/rust-lang/rls installed
195let g:lt_location_list_toggle_map = '<leader>l'
196let g:lt_quickfix_list_toggle_map = '<leader>s'
197" \ 'rust': ['~/.cargo/bin/rustup', 'run', 'stable', 'rls'],
198let g:LanguageClient_serverCommands = {
199    \ 'go': ['~/go/bin/gopls'],
200    \ 'rust': ['rust-analyzer'],
201    \ }
202let g:LanguageClient_diagnosticsList = "Quickfix"
203let g:LanguageClient_diagnosticsEnable = 1
204
205" language server key bindings
206nnoremap <F6> :call LanguageClient_contextMenu()<CR>
207" Specific mappings of LanguageClient each action separately
208nnoremap <silent> K :call LanguageClient#textDocument_hover()<CR>
209nnoremap <silent> KK :call LanguageClient#textDocument_hover()<CR>
210nnoremap <silent> gd :call LanguageClient#textDocument_definition()<CR>
211nnoremap <silent> <F2> :call LanguageClient#textDocument_rename()<CR>
212
213noremap <silent> <C-c>          :cn<CR>
214
215
216" next 3 lines are needed for vimwiki
217set nocompatible
218filetype plugin on
219syntax on
220" vimwiki with markdown
221let g:vimwiki_list = [{'path': '~/vimwiki/',
222                      \ 'syntax': 'markdown', 'ext': '.md'}]
223" prevent vimwiki of setting conceallevel=2:
224let g:vimwiki_conceallevel=0
225
226" rainbowparentheses
227let g:rainbow_active = 1
228
229"" circom syntax
230au BufRead,BufNewFile *.circom set filetype=circom
231au BufRead,BufNewFile *.circuit set filetype=go-snark-circuit
232
233"" LaTeX vimtex config:
234" Important: This config needs latexmk & zathura to be installed.
235" 
236" This is necessary for VimTeX to load properly. The "indent" is optional.
237" Note that most plugin managers will do this automatically.
238filetype plugin indent on
239" This enables Vim's and neovim's syntax-related features. Without this, some
240" VimTeX features will not work (see ":help vimtex-requirements" for more
241" info).
242syntax enable
243" Viewer options: One may configure the viewer either by specifying a built-in
244" viewer method:
245let g:vimtex_view_method = 'zathura'
246
247"" gitlink
248function! CopyGitLink(...) range
249  redir @+
250  silent echo gitlink#GitLink(get(a:, 1, 0))
251  redir END
252endfunction
253nmap <leader>gl :call CopyGitLink()<CR>
254vmap <leader>gl :call CopyGitLink(1)<CR>
255
256"" sage syntax
257augroup filetypedetect
258  au! BufRead,BufNewFile *.sage,*.spyx,*.pyx setfiletype python
259augroup END
260
261"" wat (wasm) syntax
262autocmd BufNewFile,BufReadPost *.wat setlocal filetype=wast
263
264" maximize current split or return to previous
265noremap <C-w>m :MaximizerToggle<CR>
266
267" for file watching
268set backupcopy=yes
269
270" copy&paste from system clipboard
271vnoremap  <leader>y  "+y
272vnoremap  <leader>p  "+p
273
274" shortcut for theme change
275nnoremap <F9> :colorscheme gruvbox \| set background=dark \| highlight normal ctermbg=0 guibg=#000000 <CR>
276nnoremap <F10> :colorscheme one \| set background=light \| highlight normal guibg=#ffffff<CR>
277
278" colorscheme
279let g:gruvbox_contrast_dark = 'hard'
280let g:gruvbox_contrast_light = 'hard'
281let g:srcery_italic = 1
282
283set colorcolumn=80
284set textwidth=80
285
286set background=dark 
287
288" colorscheme molokai
289colorscheme gruvbox
290set conceallevel=0
291
292highlight normal ctermbg=0 guibg=#000000