arnaucube
arnaucube/configsPublic Self-hosted repository
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" circom
 48Plug 'iden3/vim-circom-syntax'
 49
 50" deoplete
 51Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
 52Plug 'zchee/deoplete-go', {'build': {'unix': 'make'}}
 53" neosnippet with deoplete
 54Plug 'Shougo/neosnippet.vim'
 55Plug 'Shougo/neosnippet-snippets'
 56
 57" automatically adjust shiftwidth and expand tab based on current file
 58Plug 'tpope/vim-sleuth'
 59
 60let g:deoplete#enable_at_startup = 1
 61" Plugin deoplete neosnippet key-mappings.
 62" Note: It must be "imap" and "smap".  It uses <Plug> mappings.
 63imap <C-k>     <Plug>(neosnippet_expand_or_jump)
 64smap <C-k>     <Plug>(neosnippet_expand_or_jump)
 65xmap <C-k>     <Plug>(neosnippet_expand_target)
 66
 67
 68" colors
 69Plug 'tomasr/molokai'
 70Plug 'srcery-colors/srcery-vim'
 71Plug 'rakr/vim-one'
 72Plug 'morhetz/gruvbox'
 73Plug 'toupeira/vim-desertink'
 74Plug 'maksimr/Lucius2'
 75let g:srcery_italic = 1
 76
 77" errors
 78Plug 'Valloric/ListToggle'
 79Plug 'autozimu/LanguageClient-neovim', {
 80    \ 'branch': 'next',
 81    \ 'do': 'bash install.sh',
 82    \ }
 83
 84call plug#end()
 85
 86" visual
 87syntax on
 88set ruler
 89set number
 90set title
 91set titlestring=nvim-%F
 92set t_Co=256
 93set cursorline
 94set background=dark " for the dark version
 95
 96"Credit joshdick
 97"Use 24-bit (true-color) mode in Vim/Neovim when outside tmux.
 98"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
 99"(see < http://sunaku.github.io/tmux-24bit-color.html#usage > for more information.)
100if (empty($TMUX))
101  if (has("nvim"))
102  "For Neovim 0.1.3 and 0.1.4 < https://github.com/neovim/neovim/pull/2198 >
103  let $NVIM_TUI_ENABLE_TRUE_COLOR=1
104  endif
105  "For Neovim > 0.1.5 and Vim > patch 7.4.1799 < https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162 >
106  "Based on Vim patch 7.4.1770 (`guicolors` option) < https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd >
107  " < https://github.com/neovim/neovim/wiki/Following-HEAD#20160511 >
108  if (has("termguicolors"))
109    set termguicolors
110  endif
111endif
112
113if $COLORTERM == 'gnome-terminal'
114  set term=gnome-256color
115else
116  if $TERM == 'xterm'
117    set term=xterm-256color
118  endif
119endif
120
121set statusline=%F%m%r%h%w%=(%{&ff}/%Y)\ (line\ %l\/%L,\ col\ %c)\
122
123
124" go
125let g:go_auto_sameids = 1
126
127"" go config
128function! s:build_go_files()
129  let l:file = expand('%')
130  if l:file =~# '^\f\+\.go$'
131    call go#cmd#Build(0)
132  endif
133endfunction
134
135
136let g:go_list_type = "quickfix"
137let g:go_fmt_command = "goimports"
138let g:go_fmt_fail_silently = 1
139let g:go_highlight_types = 1
140let g:go_highlight_fields = 1
141let g:go_highlight_functions = 1
142let g:go_highlight_methods = 1
143let g:go_highlight_operators = 1
144let g:go_highlight_build_constraints = 1
145let g:go_highlight_structs = 1
146let g:go_highlight_generate_tags = 1
147let g:go_highlight_space_tab_error = 0
148let g:go_highlight_array_whitespace_error = 0
149let g:go_highlight_trailing_whitespace_error = 0
150let g:go_highlight_extra_types = 1
151
152" NERDTree
153let NERDTreeShowHidden=1
154autocmd vimenter * NERDTree
155map <C-n> :NERDTreeToggle<CR>
156" NERDCommenter
157let g:NERDSpaceDelims = 1 " Add spaces after comment delimiters by default
158let g:NERDDefaultAlign = 'left' " Align line-wise comment delimiters flush left instead of following code indentation
159let g:NERDCommentEmptyLines = 1 " Allow commenting and inverting empty lines (useful when commenting a region)
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 needs https://github.com/rust-lang/rls installed
176let g:lt_location_list_toggle_map = '<leader>l'
177let g:lt_quickfix_list_toggle_map = '<leader>s'
178let g:LanguageClient_serverCommands = {
179    \ 'go': ['~/go/bin/gopls'],
180    \ 'rust': ['~/.cargo/bin/rustup', 'run', 'stable', 'rls'],
181    \ }
182let g:LanguageClient_diagnosticsList = "Quickfix"
183let g:LanguageClient_diagnosticsEnable = 1
184
185" rainbowparentheses
186let g:rainbow_active = 1
187
188" abbreviations
189cnoreabbrev W! w!
190cnoreabbrev Q! q!
191cnoreabbrev Qall! qall!
192cnoreabbrev Wq wq
193cnoreabbrev Wa wa
194cnoreabbrev wQ wq
195cnoreabbrev WQ wq
196cnoreabbrev W w
197cnoreabbrev Q q
198cnoreabbrev Qall qall
199cnoreabbrev Qa qa
200
201"" Switching windows
202noremap <C-j> <C-w>j
203noremap <C-k> <C-w>k
204noremap <C-l> <C-w>l
205noremap <C-h> <C-w>h
206
207"" esc mapping
208inoremap jk <ESC>
209tnoremap jk <C-\><C-n>
210
211" scroll
212set scrolloff=5               " keep at least 5 lines above/below
213set sidescrolloff=5           " keep at least 5 lines left/right
214
215"" circom syntax
216au BufRead,BufNewFile *.circom set filetype=circom
217au BufRead,BufNewFile *.circuit set filetype=go-snark-circuit
218
219" for file watching
220set backupcopy=yes
221
222colorscheme molokai