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'
 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
 82" focus mode
 83Plug 'junegunn/goyo.vim'
 84
 85call plug#end()
 86
 87" visual
 88syntax on
 89set ruler
 90set number
 91set title
 92set titlestring=nvim-%F
 93set t_Co=256
 94set cursorline
 95set background=dark " for the dark version
 96
 97"Credit joshdick
 98"Use 24-bit (true-color) mode in Vim/Neovim when outside tmux.
 99"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
100"(see < http://sunaku.github.io/tmux-24bit-color.html#usage > for more information.)
101if (empty($TMUX))
102  if (has("nvim"))
103  "For Neovim 0.1.3 and 0.1.4 < https://github.com/neovim/neovim/pull/2198 >
104  let $NVIM_TUI_ENABLE_TRUE_COLOR=1
105  endif
106  "For Neovim > 0.1.5 and Vim > patch 7.4.1799 < https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162 >
107  "Based on Vim patch 7.4.1770 (`guicolors` option) < https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd >
108  " < https://github.com/neovim/neovim/wiki/Following-HEAD#20160511 >
109  if (has("termguicolors"))
110    set termguicolors
111  endif
112endif
113
114if $COLORTERM == 'gnome-terminal'
115  set term=gnome-256color
116else
117  if $TERM == 'xterm'
118    set term=xterm-256color
119  endif
120endif
121
122set statusline=%F%m%r%h%w%=(%{&ff}/%Y)\ (line\ %l\/%L,\ col\ %c)\
123
124
125" go
126let g:go_auto_sameids = 1
127
128"" go config
129function! s:build_go_files()
130  let l:file = expand('%')
131  if l:file =~# '^\f\+\.go$'
132    call go#cmd#Build(0)
133  endif
134endfunction
135
136
137let g:go_list_type = "quickfix"
138let g:go_fmt_command = "goimports"
139let g:go_fmt_fail_silently = 1
140let g:go_highlight_types = 1
141let g:go_highlight_fields = 1
142let g:go_highlight_functions = 1
143let g:go_highlight_methods = 1
144let g:go_highlight_operators = 1
145let g:go_highlight_build_constraints = 1
146let g:go_highlight_structs = 1
147let g:go_highlight_generate_tags = 1
148let g:go_highlight_space_tab_error = 0
149let g:go_highlight_array_whitespace_error = 0
150let g:go_highlight_trailing_whitespace_error = 0
151let g:go_highlight_extra_types = 1
152
153" NERDTree
154let NERDTreeShowHidden=1
155autocmd vimenter * NERDTree
156map <C-n> :NERDTreeToggle<CR>
157" NERDCommenter
158let g:NERDSpaceDelims = 1 " Add spaces after comment delimiters by default
159let g:NERDDefaultAlign = 'left' " Align line-wise comment delimiters flush left instead of following code indentation
160let g:NERDCommentEmptyLines = 1 " Allow commenting and inverting empty lines (useful when commenting a region)
161
162
163" vim-airline
164"" let g:airline_theme = 'powerlineish'
165let g:airline_theme='one'
166" let g:airline#extensions#syntastic#enabled = 1
167let g:airline#extensions#branch#enabled = 1
168let g:airline#extensions#tabline#enabled = 1
169let g:airline#extensions#tabline#buffer_nr_show = 1
170let g:airline#extensions#tagbar#enabled = 1
171let g:airline_skip_empty_sections = 1
172
173
174" errors
175"" for go needs gopls installed (comes with vim-go pluggin)
176"" for rust 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'
179let g:LanguageClient_serverCommands = {
180    \ 'go': ['~/go/bin/gopls'],
181    \ 'rust': ['~/.cargo/bin/rustup', 'run', 'stable', 'rls'],
182    \ }
183let g:LanguageClient_diagnosticsList = "Quickfix"
184let g:LanguageClient_diagnosticsEnable = 1
185
186" rainbowparentheses
187let g:rainbow_active = 1
188
189" abbreviations
190cnoreabbrev W! w!
191cnoreabbrev Q! q!
192cnoreabbrev Qall! qall!
193cnoreabbrev Wq wq
194cnoreabbrev Wa wa
195cnoreabbrev wQ wq
196cnoreabbrev WQ wq
197cnoreabbrev W w
198cnoreabbrev Q q
199cnoreabbrev Qall qall
200cnoreabbrev Qa qa
201
202"" Switching windows
203noremap <C-j> <C-w>j
204noremap <C-k> <C-w>k
205noremap <C-l> <C-w>l
206noremap <C-h> <C-w>h
207
208"" esc mapping
209inoremap jk <ESC>
210tnoremap jk <C-\><C-n>
211
212" scroll
213set scrolloff=5               " keep at least 5 lines above/below
214set sidescrolloff=5           " keep at least 5 lines left/right
215
216"" circom syntax
217au BufRead,BufNewFile *.circom set filetype=circom
218au BufRead,BufNewFile *.circuit set filetype=go-snark-circuit
219
220" for file watching
221set backupcopy=yes
222
223" shortcut for theme change
224nnoremap <F9> :colorscheme molokai \| set background=dark<CR>
225nnoremap <F10> :colorscheme one \| set background=light<CR>
226
227colorscheme molokai