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
46Plug 'davidhalter/jedi-vim'
47Plug 'raimon49/requirements.txt.vim', {'for': 'requirements'}
48
49" solidity
50Plug 'tomlion/vim-solidity'
51" circom
52Plug 'iden3/vim-circom-syntax'
53
54" LaTeX support. It needs latexmk & zathura
55Plug 'lervag/vimtex'
56
57
58" deoplete
59Plug 'Shougo/deoplete.nvim'
60let g:deoplete#enable_at_startup = 1
61autocmd CompleteDone * pclose!
62" Plug 'zchee/deoplete-go', {'build': {'unix': 'make'}}
63" " neosnippet with deoplete
64" Plug 'Shougo/neosnippet.vim'
65" Plug 'Shougo/neosnippet-snippets'
66" " Plugin deoplete neosnippet key-mappings.
67" " Note: It must be "imap" and "smap". It uses <Plug> mappings.
68" imap <C-k> <Plug>(neosnippet_expand_or_jump)
69" smap <C-k> <Plug>(neosnippet_expand_or_jump)
70" xmap <C-k> <Plug>(neosnippet_expand_target)
71
72" automatically adjust shiftwidth and expand tab based on current file
73Plug 'tpope/vim-sleuth'
74
75
76" errors
77Plug 'Valloric/ListToggle'
78Plug 'autozimu/LanguageClient-neovim', {
79 \ 'branch': 'next',
80 \ 'do': 'bash install.sh',
81 \ }
82Plug 'neoclide/coc.nvim', {'branch': 'release'}
83" after PlugInstall, install coc-rust-analyzer:
84" :CocInstall coc-rust-analyzer
85
86" focus mode
87Plug 'junegunn/goyo.vim'
88
89" vimwiki
90Plug 'vimwiki/vimwiki'
91" vim calendar
92Plug 'mattn/calendar-vim'
93
94" colors
95Plug 'tomasr/molokai'
96Plug 'srcery-colors/srcery-vim'
97Plug 'rakr/vim-one'
98Plug 'morhetz/gruvbox'
99
100call plug#end()
101
102" next 3 lines are needed for vimwiki
103set nocompatible
104filetype plugin on
105syntax on
106" vimwiki with markdown
107let g:vimwiki_list = [{'path': '~/vimwiki/',
108 \ 'syntax': 'markdown', 'ext': '.md'}]
109" prevent vimwiki of setting conceallevel=2:
110let g:vimwiki_conceallevel=0
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"" [old] for rust with rls needs https://github.com/rust-lang/rls installed
177let g:lt_location_list_toggle_map = '<leader>l'
178let g:lt_quickfix_list_toggle_map = '<leader>s'
179" \ 'rust': ['~/.cargo/bin/rustup', 'run', 'stable', 'rls'],
180let g:LanguageClient_serverCommands = {
181 \ 'go': ['~/go/bin/gopls'],
182 \ 'rust': ['rust-analyzer'],
183 \ }
184let g:LanguageClient_diagnosticsList = "Quickfix"
185let g:LanguageClient_diagnosticsEnable = 1
186
187" language server key bindings
188nnoremap <F6> :call LanguageClient_contextMenu()<CR>
189" Specific mappings of LanguageClient each action separately
190nnoremap <silent> K :call LanguageClient#textDocument_hover()<CR>
191nnoremap <silent> KK :call LanguageClient#textDocument_hover()<CR>
192nnoremap <silent> gd :call LanguageClient#textDocument_definition()<CR>
193nnoremap <silent> <F2> :call LanguageClient#textDocument_rename()<CR>
194
195noremap <silent> <C-c> :cn<CR>
196
197" rainbowparentheses
198let g:rainbow_active = 1
199
200"" circom syntax
201au BufRead,BufNewFile *.circom set filetype=circom
202au BufRead,BufNewFile *.circuit set filetype=go-snark-circuit
203
204"" LaTeX vimtex config:
205" Important: This config needs latexmk & zathura to be installed.
206"
207" This is necessary for VimTeX to load properly. The "indent" is optional.
208" Note that most plugin managers will do this automatically.
209filetype plugin indent on
210" This enables Vim's and neovim's syntax-related features. Without this, some
211" VimTeX features will not work (see ":help vimtex-requirements" for more
212" info).
213syntax enable
214" Viewer options: One may configure the viewer either by specifying a built-in
215" viewer method:
216let g:vimtex_view_method = 'zathura'
217
218"" sage syntax
219augroup filetypedetect
220 au! BufRead,BufNewFile *.sage,*.spyx,*.pyx setfiletype python
221augroup END
222
223" for file watching
224set backupcopy=yes
225
226" copy&paste from system clipboard
227vnoremap <leader>y "+y
228vnoremap <leader>p "+p
229
230" shortcut for theme change
231nnoremap <F9> :colorscheme gruvbox \| set background=dark \| highlight normal ctermbg=0 guibg=#000000 <CR>
232nnoremap <F10> :colorscheme gruvbox \| set background=light<CR>
233
234" colorscheme
235let g:gruvbox_contrast_dark = 'hard'
236let g:gruvbox_contrast_light = 'hard'
237let g:srcery_italic = 1
238
239set colorcolumn=100
240" set textwidth=80
241
242set background=dark
243
244" colorscheme molokai
245colorscheme gruvbox
246
247highlight normal ctermbg=0 guibg=#000000