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