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.

271 lines
7.5 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
  1. source ~/vimconfigbase.vim
  2. " Automate plug.vim installation:
  3. let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'
  4. if empty(glob(data_dir . '/autoload/plug.vim'))
  5. silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
  6. autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
  7. endif
  8. call plug#begin(expand('~/.config/nvim/plugged'))
  9. nnoremap <Space> <nop>
  10. let mapleader = "\<Space>"
  11. let g:mapleader = "\<Space>"
  12. let maplocalleader = "\<Space>"
  13. " nerdtree
  14. Plug 'scrooloose/nerdtree'
  15. Plug 'jistr/vim-nerdtree-tabs'
  16. Plug 'scrooloose/nerdcommenter'
  17. " vim-airline
  18. Plug 'vim-airline/vim-airline'
  19. Plug 'vim-airline/vim-airline-themes'
  20. " vim-ripgrep
  21. Plug 'jremmen/vim-ripgrep'
  22. Plug 'airblade/vim-gitgutter'
  23. Plug 'Raimondi/delimitMate'
  24. Plug 'majutsushi/tagbar'
  25. " rainbow parentheses
  26. Plug 'luochen1990/rainbow'
  27. " git
  28. Plug 'tpope/vim-fugitive'
  29. " gitlink
  30. Plug 'mazubieta/gitlink-vim'
  31. " go
  32. Plug 'fatih/vim-go' " Amazing combination of features.
  33. Plug 'godoctor/godoctor.vim' " Some refactoring tools
  34. " rust
  35. Plug 'rust-lang/rust.vim'
  36. " set hidden
  37. let g:rustfmt_fail_silently = 0
  38. let g:rustfmt_autosave = 1
  39. " javascript
  40. Plug 'jelera/vim-javascript-syntax'
  41. " python (disabled as puts conceallevel=2, which forces markdown
  42. " previsualization :S)
  43. " Plug 'davidhalter/jedi-vim'
  44. " Plug 'raimon49/requirements.txt.vim', {'for': 'requirements'}
  45. " solidity
  46. Plug 'tomlion/vim-solidity'
  47. " circom
  48. Plug 'iden3/vim-circom-syntax'
  49. " Cairo
  50. " Plug 'miguelmota/cairo.vim'
  51. " LaTeX support. It needs latexmk & zathura
  52. Plug 'lervag/vimtex'
  53. " deoplete
  54. Plug 'Shougo/deoplete.nvim'
  55. let g:deoplete#enable_at_startup = 1
  56. autocmd CompleteDone * pclose!
  57. " Plug 'zchee/deoplete-go', {'build': {'unix': 'make'}}
  58. " " neosnippet with deoplete
  59. " Plug 'Shougo/neosnippet.vim'
  60. " Plug 'Shougo/neosnippet-snippets'
  61. " " Plugin deoplete neosnippet key-mappings.
  62. " " Note: It must be "imap" and "smap". It uses <Plug> mappings.
  63. " imap <C-k> <Plug>(neosnippet_expand_or_jump)
  64. " smap <C-k> <Plug>(neosnippet_expand_or_jump)
  65. " xmap <C-k> <Plug>(neosnippet_expand_target)
  66. " automatically adjust shiftwidth and expand tab based on current file
  67. Plug 'tpope/vim-sleuth'
  68. " errors
  69. Plug 'Valloric/ListToggle'
  70. Plug 'autozimu/LanguageClient-neovim', {
  71. \ 'branch': 'next',
  72. \ 'do': 'bash install.sh',
  73. \ }
  74. Plug 'neoclide/coc.nvim', {'branch': 'release'}
  75. " after PlugInstall, install coc-rust-analyzer:
  76. " :CocInstall coc-rust-analyzer
  77. " focus mode
  78. Plug 'junegunn/goyo.vim'
  79. " vimwiki
  80. Plug 'vimwiki/vimwiki'
  81. " vim calendar
  82. Plug 'mattn/calendar-vim'
  83. " colors
  84. Plug 'tomasr/molokai'
  85. Plug 'srcery-colors/srcery-vim'
  86. Plug 'rakr/vim-one'
  87. Plug 'morhetz/gruvbox'
  88. call plug#end()
  89. let $NVIM_TUI_ENABLE_TRUE_COLOR=1
  90. set termguicolors
  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. " NERDTree
  100. let NERDTreeShowHidden=1
  101. autocmd vimenter * NERDTree
  102. map <C-n> :NERDTreeToggle<CR>
  103. " NERDCommenter
  104. let g:NERDSpaceDelims = 1 " Add spaces after comment delimiters by default
  105. let g:NERDDefaultAlign = 'left' " Align line-wise comment delimiters flush left instead of following code indentation
  106. let g:NERDCommentEmptyLines = 1 " Allow commenting and inverting empty lines (useful when commenting a region)
  107. "" go config
  108. function! s:build_go_files()
  109. let l:file = expand('%')
  110. if l:file =~# '^\f\+\.go$'
  111. call go#cmd#Build(0)
  112. endif
  113. endfunction
  114. let g:go_list_type = "quickfix"
  115. let g:go_fmt_command = "goimports"
  116. let g:go_fmt_fail_silently = 1
  117. let g:go_highlight_types = 1
  118. let g:go_highlight_fields = 1
  119. let g:go_highlight_functions = 1
  120. let g:go_highlight_methods = 1
  121. let g:go_highlight_operators = 1
  122. let g:go_highlight_build_constraints = 1
  123. let g:go_highlight_structs = 1
  124. let g:go_highlight_generate_tags = 1
  125. let g:go_highlight_space_tab_error = 0
  126. let g:go_highlight_array_whitespace_error = 0
  127. let g:go_highlight_trailing_whitespace_error = 0
  128. let g:go_highlight_extra_types = 1
  129. " vim-airline
  130. "" let g:airline_theme = 'powerlineish'
  131. let g:airline_theme='one'
  132. " let g:airline#extensions#syntastic#enabled = 1
  133. let g:airline#extensions#branch#enabled = 1
  134. let g:airline#extensions#tabline#enabled = 1
  135. let g:airline#extensions#tabline#buffer_nr_show = 1
  136. let g:airline#extensions#tagbar#enabled = 1
  137. let g:airline_skip_empty_sections = 1
  138. " errors
  139. "" For go needs gopls installed (comes with vim-go pluggin)
  140. "" For rust with rust-analyzer needs https://rust-analyzer.github.io/manual.html#rust-analyzer-language-server-binary installed
  141. "" --> place it at ~.local/bin or ~/bin and make sure that the PATH is defined (eg. in .zshrc: export PATH=$PATH:.local/bin)
  142. "" [old] for rust with rls 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. " \ 'rust': ['~/.cargo/bin/rustup', 'run', 'stable', 'rls'],
  146. let g:LanguageClient_serverCommands = {
  147. \ 'go': ['~/go/bin/gopls'],
  148. \ 'rust': ['rust-analyzer'],
  149. \ }
  150. let g:LanguageClient_diagnosticsList = "Quickfix"
  151. let g:LanguageClient_diagnosticsEnable = 1
  152. " language server key bindings
  153. nnoremap <F6> :call LanguageClient_contextMenu()<CR>
  154. " Specific mappings of LanguageClient each action separately
  155. nnoremap <silent> K :call LanguageClient#textDocument_hover()<CR>
  156. nnoremap <silent> KK :call LanguageClient#textDocument_hover()<CR>
  157. nnoremap <silent> gd :call LanguageClient#textDocument_definition()<CR>
  158. nnoremap <silent> <F2> :call LanguageClient#textDocument_rename()<CR>
  159. noremap <silent> <C-c> :cn<CR>
  160. " next 3 lines are needed for vimwiki
  161. set nocompatible
  162. filetype plugin on
  163. syntax on
  164. " vimwiki with markdown
  165. let g:vimwiki_list = [{'path': '~/vimwiki/',
  166. \ 'syntax': 'markdown', 'ext': '.md'}]
  167. " prevent vimwiki of setting conceallevel=2:
  168. let g:vimwiki_conceallevel=0
  169. " rainbowparentheses
  170. let g:rainbow_active = 1
  171. "" circom syntax
  172. au BufRead,BufNewFile *.circom set filetype=circom
  173. au BufRead,BufNewFile *.circuit set filetype=go-snark-circuit
  174. "" LaTeX vimtex config:
  175. " Important: This config needs latexmk & zathura to be installed.
  176. "
  177. " This is necessary for VimTeX to load properly. The "indent" is optional.
  178. " Note that most plugin managers will do this automatically.
  179. filetype plugin indent on
  180. " This enables Vim's and neovim's syntax-related features. Without this, some
  181. " VimTeX features will not work (see ":help vimtex-requirements" for more
  182. " info).
  183. syntax enable
  184. " Viewer options: One may configure the viewer either by specifying a built-in
  185. " viewer method:
  186. let g:vimtex_view_method = 'zathura'
  187. "" gitlink
  188. function! CopyGitLink(...) range
  189. redir @+
  190. silent echo gitlink#GitLink(get(a:, 1, 0))
  191. redir END
  192. endfunction
  193. nmap <leader>gl :call CopyGitLink()<CR>
  194. vmap <leader>gl :call CopyGitLink(1)<CR>
  195. "" sage syntax
  196. augroup filetypedetect
  197. au! BufRead,BufNewFile *.sage,*.spyx,*.pyx setfiletype python
  198. augroup END
  199. " for file watching
  200. set backupcopy=yes
  201. " copy&paste from system clipboard
  202. vnoremap <leader>y "+y
  203. vnoremap <leader>p "+p
  204. " shortcut for theme change
  205. nnoremap <F9> :colorscheme gruvbox \| set background=dark \| highlight normal ctermbg=0 guibg=#000000 <CR>
  206. nnoremap <F10> :colorscheme one \| set background=light \| highlight normal guibg=#ffffff<CR>
  207. " colorscheme
  208. let g:gruvbox_contrast_dark = 'hard'
  209. let g:gruvbox_contrast_light = 'hard'
  210. let g:srcery_italic = 1
  211. set colorcolumn=100
  212. " set textwidth=80
  213. set background=dark
  214. " colorscheme molokai
  215. colorscheme gruvbox
  216. set conceallevel=0
  217. highlight normal ctermbg=0 guibg=#000000