You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

222 lines
5.7 KiB

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