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.

276 lines
7.6 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
2 months ago
6 years ago
6 years ago
6 years ago
6 years ago
2 months 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. " also run (outside vim, in a shell):
  78. " rustup component add rust-analyzer
  79. " focus mode
  80. Plug 'junegunn/goyo.vim'
  81. " vimwiki
  82. Plug 'vimwiki/vimwiki'
  83. " vim calendar
  84. Plug 'mattn/calendar-vim'
  85. " colors
  86. Plug 'tomasr/molokai'
  87. Plug 'srcery-colors/srcery-vim'
  88. Plug 'rakr/vim-one'
  89. Plug 'morhetz/gruvbox'
  90. call plug#end()
  91. let $NVIM_TUI_ENABLE_TRUE_COLOR=1
  92. set termguicolors
  93. if $COLORTERM == 'gnome-terminal'
  94. set term=gnome-256color
  95. else
  96. if $TERM == 'xterm'
  97. set term=xterm-256color
  98. endif
  99. endif
  100. set statusline=%F%m%r%h%w%=(%{&ff}/%Y)\ (line\ %l\/%L,\ col\ %c)\
  101. " NERDTree
  102. let NERDTreeShowHidden=1
  103. autocmd vimenter * NERDTree
  104. map <C-n> :NERDTreeToggle<CR>
  105. " NERDCommenter
  106. let g:NERDSpaceDelims = 1 " Add spaces after comment delimiters by default
  107. let g:NERDDefaultAlign = 'left' " Align line-wise comment delimiters flush left instead of following code indentation
  108. let g:NERDCommentEmptyLines = 1 " Allow commenting and inverting empty lines (useful when commenting a region)
  109. "" go config
  110. function! s:build_go_files()
  111. let l:file = expand('%')
  112. if l:file =~# '^\f\+\.go$'
  113. call go#cmd#Build(0)
  114. endif
  115. endfunction
  116. let g:go_list_type = "quickfix"
  117. let g:go_fmt_command = "goimports"
  118. let g:go_fmt_fail_silently = 1
  119. let g:go_highlight_types = 1
  120. let g:go_highlight_fields = 1
  121. let g:go_highlight_functions = 1
  122. let g:go_highlight_methods = 1
  123. let g:go_highlight_operators = 1
  124. let g:go_highlight_build_constraints = 1
  125. let g:go_highlight_structs = 1
  126. let g:go_highlight_generate_tags = 1
  127. let g:go_highlight_space_tab_error = 0
  128. let g:go_highlight_array_whitespace_error = 0
  129. let g:go_highlight_trailing_whitespace_error = 0
  130. let g:go_highlight_extra_types = 1
  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 with rust-analyzer needs https://rust-analyzer.github.io/manual.html#rust-analyzer-language-server-binary installed
  143. "" --> place it at ~.local/bin or ~/bin and make sure that the PATH is defined (eg. in .zshrc: export PATH=$PATH:.local/bin)
  144. "" [old] for rust with rls needs https://github.com/rust-lang/rls installed
  145. let g:lt_location_list_toggle_map = '<leader>l'
  146. let g:lt_quickfix_list_toggle_map = '<leader>s'
  147. " \ 'rust': ['~/.cargo/bin/rustup', 'run', 'stable', 'rls'],
  148. let g:LanguageClient_serverCommands = {
  149. \ 'go': ['~/go/bin/gopls'],
  150. \ 'rust': ['rust-analyzer'],
  151. \ }
  152. let g:LanguageClient_diagnosticsList = "Quickfix"
  153. let g:LanguageClient_diagnosticsEnable = 1
  154. " language server key bindings
  155. nnoremap <F6> :call LanguageClient_contextMenu()<CR>
  156. " Specific mappings of LanguageClient each action separately
  157. nnoremap <silent> K :call LanguageClient#textDocument_hover()<CR>
  158. nnoremap <silent> KK :call LanguageClient#textDocument_hover()<CR>
  159. nnoremap <silent> gd :call LanguageClient#textDocument_definition()<CR>
  160. nnoremap <silent> <F2> :call LanguageClient#textDocument_rename()<CR>
  161. noremap <silent> <C-c> :cn<CR>
  162. " next 3 lines are needed for vimwiki
  163. set nocompatible
  164. filetype plugin on
  165. syntax on
  166. " vimwiki with markdown
  167. let g:vimwiki_list = [{'path': '~/vimwiki/',
  168. \ 'syntax': 'markdown', 'ext': '.md'}]
  169. " prevent vimwiki of setting conceallevel=2:
  170. let g:vimwiki_conceallevel=0
  171. " rainbowparentheses
  172. let g:rainbow_active = 1
  173. "" circom syntax
  174. au BufRead,BufNewFile *.circom set filetype=circom
  175. au BufRead,BufNewFile *.circuit set filetype=go-snark-circuit
  176. "" LaTeX vimtex config:
  177. " Important: This config needs latexmk & zathura to be installed.
  178. "
  179. " This is necessary for VimTeX to load properly. The "indent" is optional.
  180. " Note that most plugin managers will do this automatically.
  181. filetype plugin indent on
  182. " This enables Vim's and neovim's syntax-related features. Without this, some
  183. " VimTeX features will not work (see ":help vimtex-requirements" for more
  184. " info).
  185. syntax enable
  186. " Viewer options: One may configure the viewer either by specifying a built-in
  187. " viewer method:
  188. let g:vimtex_view_method = 'zathura'
  189. "" gitlink
  190. function! CopyGitLink(...) range
  191. redir @+
  192. silent echo gitlink#GitLink(get(a:, 1, 0))
  193. redir END
  194. endfunction
  195. nmap <leader>gl :call CopyGitLink()<CR>
  196. vmap <leader>gl :call CopyGitLink(1)<CR>
  197. "" sage syntax
  198. augroup filetypedetect
  199. au! BufRead,BufNewFile *.sage,*.spyx,*.pyx setfiletype python
  200. augroup END
  201. " for file watching
  202. set backupcopy=yes
  203. " copy&paste from system clipboard
  204. vnoremap <leader>y "+y
  205. vnoremap <leader>p "+p
  206. " disable mouse
  207. set mouse=
  208. " shortcut for theme change
  209. nnoremap <F9> :colorscheme gruvbox \| set background=dark \| highlight normal ctermbg=0 guibg=#000000 <CR>
  210. nnoremap <F10> :colorscheme one \| set background=light \| highlight normal guibg=#ffffff<CR>
  211. " colorscheme
  212. let g:gruvbox_contrast_dark = 'hard'
  213. let g:gruvbox_contrast_light = 'hard'
  214. let g:srcery_italic = 1
  215. set colorcolumn=100
  216. " set textwidth=80
  217. set background=dark
  218. " colorscheme molokai
  219. colorscheme gruvbox
  220. set conceallevel=0
  221. highlight normal ctermbg=0 guibg=#000000