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.

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