configs/init.vim
init.vimRaw
1call plug#begin(expand('~/.config/nvim/plugged'))
2
3nnoremap <Space> <nop>
4let mapleader = "\<Space>"
5let g:mapleader = "\<Space>"
6let maplocalleader = "\<Space>"
7
8
9" NERDTree
10Plug 'scrooloose/nerdtree'
11Plug 'jistr/vim-nerdtree-tabs'
12Plug 'scrooloose/nerdcommenter'
13
14" vim-airline
15Plug 'vim-airline/vim-airline'
16Plug 'vim-airline/vim-airline-themes'
17
18" vim-ripgrep
19Plug 'jremmen/vim-ripgrep'
20
21Plug 'airblade/vim-gitgutter'
22Plug 'Raimondi/delimitMate'
23Plug 'majutsushi/tagbar'
24
25" rainbow parentheses
26Plug 'luochen1990/rainbow'
27
28" go
29Plug 'fatih/vim-go' " Amazing combination of features.
30Plug 'godoctor/godoctor.vim' " Some refactoring tools
31
32" rust
33Plug 'rust-lang/rust.vim'
34" set hidden
35let g:rustfmt_fail_silently = 0
36let g:rustfmt_autosave = 1
37
38" javascript
39Plug 'jelera/vim-javascript-syntax'
40
41" python
42Plug 'davidhalter/jedi-vim'
43Plug 'raimon49/requirements.txt.vim', {'for': 'requirements'}
44
45" solidity
46Plug 'tomlion/vim-solidity'
47
48" deoplete
49Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
50Plug 'zchee/deoplete-go', {'build': {'unix': 'make'}}
51" neosnippet with deoplete
52Plug 'Shougo/neosnippet.vim'
53Plug 'Shougo/neosnippet-snippets'
54
55" automatically adjust shiftwidth and expand tab based on current file
56Plug 'tpope/vim-sleuth'
57
58let g:deoplete#enable_at_startup = 1
59" Plugin deoplete neosnippet key-mappings.
60" Note: It must be "imap" and "smap". It uses <Plug> mappings.
61imap <C-k> <Plug>(neosnippet_expand_or_jump)
62smap <C-k> <Plug>(neosnippet_expand_or_jump)
63xmap <C-k> <Plug>(neosnippet_expand_target)
64
65
66" colors
67Plug 'tomasr/molokai'
68Plug 'srcery-colors/srcery-vim'
69Plug 'rakr/vim-one'
70Plug 'morhetz/gruvbox'
71Plug 'toupeira/vim-desertink'
72Plug 'maksimr/Lucius2'
73let g:srcery_italic = 1
74
75" errors
76Plug 'Valloric/ListToggle'
77Plug 'autozimu/LanguageClient-neovim', {
78 \ 'branch': 'next',
79 \ 'do': 'bash install.sh',
80 \ }
81
82call plug#end()
83
84" visual
85syntax on
86set ruler
87set number
88set title
89set titlestring=nvim-%F
90set t_Co=256
91set cursorline
92set background=dark " for the dark version
93
94"Credit joshdick
95"Use 24-bit (true-color) mode in Vim/Neovim when outside tmux.
96"If you're using tmux version 2.2 or later, you can remove the outermost $TMUX check and use tmux's 24-bit color support
97"(see < http://sunaku.github.io/tmux-24bit-color.html#usage > for more information.)
98if (empty($TMUX))
99 if (has("nvim"))
100 "For Neovim 0.1.3 and 0.1.4 < https://github.com/neovim/neovim/pull/2198 >
101 let $NVIM_TUI_ENABLE_TRUE_COLOR=1
102 endif
103 "For Neovim > 0.1.5 and Vim > patch 7.4.1799 < https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162 >
104 "Based on Vim patch 7.4.1770 (`guicolors` option) < https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd >
105 " < https://github.com/neovim/neovim/wiki/Following-HEAD#20160511 >
106 if (has("termguicolors"))
107 set termguicolors
108 endif
109endif
110
111if $COLORTERM == 'gnome-terminal'
112 set term=gnome-256color
113else
114 if $TERM == 'xterm'
115 set term=xterm-256color
116 endif
117endif
118
119set statusline=%F%m%r%h%w%=(%{&ff}/%Y)\ (line\ %l\/%L,\ col\ %c)\
120
121
122" go
123let g:go_auto_sameids = 1
124
125"" go config
126function! s:build_go_files()
127 let l:file = expand('%')
128 if l:file =~# '^\f\+\.go$'
129 call go#cmd#Build(0)
130 endif
131endfunction
132
133
134let g:go_list_type = "quickfix"
135let g:go_fmt_command = "goimports"
136let g:go_fmt_fail_silently = 1
137let g:go_highlight_types = 1
138let g:go_highlight_fields = 1
139let g:go_highlight_functions = 1
140let g:go_highlight_methods = 1
141let g:go_highlight_operators = 1
142let g:go_highlight_build_constraints = 1
143let g:go_highlight_structs = 1
144let g:go_highlight_generate_tags = 1
145let g:go_highlight_space_tab_error = 0
146let g:go_highlight_array_whitespace_error = 0
147let g:go_highlight_trailing_whitespace_error = 0
148let g:go_highlight_extra_types = 1
149
150" NERDTree
151let NERDTreeShowHidden=1
152autocmd vimenter * NERDTree
153map <C-n> :NERDTreeToggle<CR>
154" NERDCommenter
155let g:NERDSpaceDelims = 1 " Add spaces after comment delimiters by default
156let g:NERDDefaultAlign = 'left' " Align line-wise comment delimiters flush left instead of following code indentation
157let g:NERDCommentEmptyLines = 1 " Allow commenting and inverting empty lines (useful when commenting a region)
158
159
160" vim-airline
161"" let g:airline_theme = 'powerlineish'
162let g:airline_theme='one'
163" let g:airline#extensions#syntastic#enabled = 1
164let g:airline#extensions#branch#enabled = 1
165let g:airline#extensions#tabline#enabled = 1
166let g:airline#extensions#tabline#buffer_nr_show = 1
167let g:airline#extensions#tagbar#enabled = 1
168let g:airline_skip_empty_sections = 1
169
170
171" errors
172"" for go needs gopls installed (comes with vim-go pluggin)
173"" for rust needs https://github.com/rust-lang/rls installed
174let g:lt_location_list_toggle_map = '<leader>l'
175let g:lt_quickfix_list_toggle_map = '<leader>s'
176let g:LanguageClient_serverCommands = {
177 \ 'go': ['~/go/bin/gopls'],
178 \ 'rust': ['~/.cargo/bin/rustup', 'run', 'stable', 'rls'],
179 \ }
180let g:LanguageClient_diagnosticsList = "Quickfix"
181let g:LanguageClient_diagnosticsEnable = 1
182
183" rainbowparentheses
184let g:rainbow_active = 1
185
186" abbreviations
187cnoreabbrev W! w!
188cnoreabbrev Q! q!
189cnoreabbrev Qall! qall!
190cnoreabbrev Wq wq
191cnoreabbrev Wa wa
192cnoreabbrev wQ wq
193cnoreabbrev WQ wq
194cnoreabbrev W w
195cnoreabbrev Q q
196cnoreabbrev Qall qall
197cnoreabbrev Qa qa
198
199"" Switching windows
200noremap <C-j> <C-w>j
201noremap <C-k> <C-w>k
202noremap <C-l> <C-w>l
203noremap <C-h> <C-w>h
204
205"" esc mapping
206inoremap jk <ESC>
207tnoremap jk <C-\><C-n>
208
209" scroll
210set scrolloff=5 " keep at least 5 lines above/below
211set sidescrolloff=5 " keep at least 5 lines left/right
212
213"" circom syntax
214au BufRead,BufNewFile *.circom set filetype=circom
215au BufRead,BufNewFile *.circuit set filetype=go-snark-circuit
216
217" for file watching
218set backupcopy=yes
219
220colorscheme molokai