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
 39" go
 40Plug 'fatih/vim-go' " Amazing combination of features.
 41Plug 'godoctor/godoctor.vim' " Some refactoring tools
 42
 43" rust
 44Plug 'rust-lang/rust.vim'
 45" set hidden
 46let g:rustfmt_fail_silently = 0
 47let g:rustfmt_autosave = 1
 48
 49" javascript
 50Plug 'jelera/vim-javascript-syntax'
 51
 52" python (disabled as puts conceallevel=2, which forces markdown
 53" previsualization :S)
 54" Plug 'davidhalter/jedi-vim'
 55" Plug 'raimon49/requirements.txt.vim', {'for': 'requirements'}
 56
 57" solidity
 58Plug 'tomlion/vim-solidity'
 59" circom
 60Plug 'iden3/vim-circom-syntax'
 61" Cairo
 62" Plug 'miguelmota/cairo.vim'
 63
 64" LaTeX support. It needs latexmk & zathura
 65Plug 'lervag/vimtex'
 66
 67
 68" deoplete
 69Plug 'Shougo/deoplete.nvim'
 70let g:deoplete#enable_at_startup = 1
 71autocmd CompleteDone * pclose!
 72" Plug 'zchee/deoplete-go', {'build': {'unix': 'make'}}
 73" " neosnippet with deoplete
 74" Plug 'Shougo/neosnippet.vim'
 75" Plug 'Shougo/neosnippet-snippets'
 76" " Plugin deoplete neosnippet key-mappings.
 77" " Note: It must be "imap" and "smap".  It uses <Plug> mappings.
 78" imap <C-k>     <Plug>(neosnippet_expand_or_jump)
 79" smap <C-k>     <Plug>(neosnippet_expand_or_jump)
 80" xmap <C-k>     <Plug>(neosnippet_expand_target)
 81
 82" automatically adjust shiftwidth and expand tab based on current file
 83Plug 'tpope/vim-sleuth'
 84
 85
 86" errors
 87Plug 'Valloric/ListToggle'
 88Plug 'autozimu/LanguageClient-neovim', {
 89    \ 'branch': 'next',
 90    \ 'do': 'bash install.sh',
 91    \ }
 92Plug 'neoclide/coc.nvim', {'branch': 'release'}
 93" after PlugInstall, install coc-rust-analyzer:
 94" :CocInstall coc-rust-analyzer
 95
 96" focus mode
 97Plug 'junegunn/goyo.vim'
 98
 99" vimwiki
100Plug 'vimwiki/vimwiki'
101" vim calendar
102Plug 'mattn/calendar-vim'
103
104" colors
105Plug 'tomasr/molokai'
106Plug 'srcery-colors/srcery-vim'
107Plug 'rakr/vim-one'
108Plug 'morhetz/gruvbox'
109
110call plug#end()
111
112let $NVIM_TUI_ENABLE_TRUE_COLOR=1
113set termguicolors
114
115if $COLORTERM == 'gnome-terminal'
116  set term=gnome-256color
117else
118  if $TERM == 'xterm'
119    set term=xterm-256color
120  endif
121endif
122
123set statusline=%F%m%r%h%w%=(%{&ff}/%Y)\ (line\ %l\/%L,\ col\ %c)\
124
125
126" NERDTree
127let NERDTreeShowHidden=1
128autocmd vimenter * NERDTree
129map <C-n> :NERDTreeToggle<CR>
130" NERDCommenter
131let g:NERDSpaceDelims = 1 " Add spaces after comment delimiters by default
132let g:NERDDefaultAlign = 'left' " Align line-wise comment delimiters flush left instead of following code indentation
133let g:NERDCommentEmptyLines = 1 " Allow commenting and inverting empty lines (useful when commenting a region)
134
135
136"" go config
137function! s:build_go_files()
138  let l:file = expand('%')
139  if l:file =~# '^\f\+\.go$'
140    call go#cmd#Build(0)
141  endif
142endfunction
143
144
145let g:go_list_type = "quickfix"
146let g:go_fmt_command = "goimports"
147let g:go_fmt_fail_silently = 1
148let g:go_highlight_types = 1
149let g:go_highlight_fields = 1
150let g:go_highlight_functions = 1
151let g:go_highlight_methods = 1
152let g:go_highlight_operators = 1
153let g:go_highlight_build_constraints = 1
154let g:go_highlight_structs = 1
155let g:go_highlight_generate_tags = 1
156let g:go_highlight_space_tab_error = 0
157let g:go_highlight_array_whitespace_error = 0
158let g:go_highlight_trailing_whitespace_error = 0
159let g:go_highlight_extra_types = 1
160
161
162" vim-airline
163"" let g:airline_theme = 'powerlineish'
164let g:airline_theme='one'
165" let g:airline#extensions#syntastic#enabled = 1
166let g:airline#extensions#branch#enabled = 1
167let g:airline#extensions#tabline#enabled = 1
168let g:airline#extensions#tabline#buffer_nr_show = 1
169let g:airline#extensions#tagbar#enabled = 1
170let g:airline_skip_empty_sections = 1
171
172
173" errors
174"" For go needs gopls installed (comes with vim-go pluggin)
175"" For rust with rust-analyzer needs https://rust-analyzer.github.io/manual.html#rust-analyzer-language-server-binary installed
176""  --> place it at ~.local/bin or ~/bin and make sure that the PATH is defined (eg. in .zshrc: export PATH=$PATH:.local/bin)
177""      [old] for rust with rls needs https://github.com/rust-lang/rls installed
178let g:lt_location_list_toggle_map = '<leader>l'
179let g:lt_quickfix_list_toggle_map = '<leader>s'
180" \ 'rust': ['~/.cargo/bin/rustup', 'run', 'stable', 'rls'],
181let g:LanguageClient_serverCommands = {
182    \ 'go': ['~/go/bin/gopls'],
183    \ 'rust': ['rust-analyzer'],
184    \ }
185let g:LanguageClient_diagnosticsList = "Quickfix"
186let g:LanguageClient_diagnosticsEnable = 1
187
188" language server key bindings
189nnoremap <F6> :call LanguageClient_contextMenu()<CR>
190" Specific mappings of LanguageClient each action separately
191nnoremap <silent> K :call LanguageClient#textDocument_hover()<CR>
192nnoremap <silent> KK :call LanguageClient#textDocument_hover()<CR>
193nnoremap <silent> gd :call LanguageClient#textDocument_definition()<CR>
194nnoremap <silent> <F2> :call LanguageClient#textDocument_rename()<CR>
195
196noremap <silent> <C-c>          :cn<CR>
197
198
199" next 3 lines are needed for vimwiki
200set nocompatible
201filetype plugin on
202syntax on
203" vimwiki with markdown
204let g:vimwiki_list = [{'path': '~/vimwiki/',
205                      \ 'syntax': 'markdown', 'ext': '.md'}]
206" prevent vimwiki of setting conceallevel=2:
207let g:vimwiki_conceallevel=0
208
209" rainbowparentheses
210let g:rainbow_active = 1
211
212"" circom syntax
213au BufRead,BufNewFile *.circom set filetype=circom
214au BufRead,BufNewFile *.circuit set filetype=go-snark-circuit
215
216"" LaTeX vimtex config:
217" Important: This config needs latexmk & zathura to be installed.
218" 
219" This is necessary for VimTeX to load properly. The "indent" is optional.
220" Note that most plugin managers will do this automatically.
221filetype plugin indent on
222" This enables Vim's and neovim's syntax-related features. Without this, some
223" VimTeX features will not work (see ":help vimtex-requirements" for more
224" info).
225syntax enable
226" Viewer options: One may configure the viewer either by specifying a built-in
227" viewer method:
228let g:vimtex_view_method = 'zathura'
229
230"" sage syntax
231augroup filetypedetect
232  au! BufRead,BufNewFile *.sage,*.spyx,*.pyx setfiletype python
233augroup END
234
235" for file watching
236set backupcopy=yes
237
238" copy&paste from system clipboard
239vnoremap  <leader>y  "+y
240vnoremap  <leader>p  "+p
241
242" shortcut for theme change
243nnoremap <F9> :colorscheme gruvbox \| set background=dark \| highlight normal ctermbg=0 guibg=#000000 <CR>
244nnoremap <F10> :colorscheme one \| set background=light \| highlight normal guibg=#ffffff<CR>
245
246" colorscheme
247let g:gruvbox_contrast_dark = 'hard'
248let g:gruvbox_contrast_light = 'hard'
249let g:srcery_italic = 1
250
251set colorcolumn=100
252" set textwidth=80
253
254set background=dark 
255
256" colorscheme molokai
257colorscheme gruvbox
258set conceallevel=0
259
260highlight normal ctermbg=0 guibg=#000000