All of my important config files
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.

507 lines
17 KiB

8 years ago
8 years ago
3 years ago
7 years ago
5 years ago
3 years ago
3 years ago
3 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
4 years ago
3 years ago
7 years ago
8 years ago
6 years ago
2 years ago
8 years ago
8 years ago
7 years ago
7 years ago
7 years ago
2 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
3 years ago
8 years ago
8 years ago
3 years ago
8 years ago
6 years ago
8 years ago
4 years ago
2 years ago
4 years ago
3 years ago
2 years ago
3 years ago
7 years ago
2 years ago
2 years ago
7 years ago
7 years ago
2 years ago
7 years ago
2 years ago
2 years ago
2 years ago
7 years ago
5 years ago
3 years ago
2 years ago
3 years ago
7 years ago
7 years ago
3 years ago
5 years ago
3 years ago
7 years ago
2 years ago
2 years ago
2 years ago
  1. set nocompatible " be iMproved, required
  2. filetype off " required
  3. " Section Plugins {{{
  4. " Load vim-plug
  5. if empty(glob("~/.config/nvim/autoload/plug.vim"))
  6. execute '!curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
  7. endif
  8. call plug#begin()
  9. Plug 'tpope/vim-fugitive' " Git integration
  10. Plug 'tpope/vim-sensible' " Defaults everyone can agree on
  11. Plug 'tpope/vim-surround' " better handling of surrounding markers
  12. Plug 'tpope/vim-ragtag' " Enhancement of surround for html
  13. Plug 'tpope/vim-repeat' " repeat last command with .
  14. Plug 'scrooloose/nerdtree', { 'on': ['NERDTreeToggle', 'NERDTreeFind'] } " file tree
  15. Plug 'Xuyuanp/nerdtree-git-plugin', { 'on': ['NERDTreeToggle', 'NERDTreeFind'] }
  16. Plug 'scrooloose/nerdcommenter' " better commenting
  17. Plug 'neoclide/coc.nvim', {'branch': 'release'} " coc - completion
  18. Plug 'easymotion/vim-easymotion' " better motion with leader
  19. Plug 'bling/vim-airline' " statusline
  20. Plug 'w0rp/ale' " asynchronous linting engine
  21. Plug 'godlygeek/tabular' " Align text on symbols
  22. Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } " fuzzy file finder
  23. Plug 'junegunn/fzf.vim' " vim integration for fzf
  24. Plug 'airblade/vim-gitgutter' " git status in gutter column
  25. Plug 'lambdalisue/suda.vim' " As w!! did not work anymore in nvim
  26. Plug 'https://github.com/alok/notational-fzf-vim' " note taking
  27. Plug 'prettier/vim-prettier', { 'do': 'npm install' } " prettier integration
  28. Plug 'honza/vim-snippets' " Collection of Snippets, used by coc-snippet
  29. "Plug 'ludovicchabant/vim-gutentags', { 'for': ['js', 'vue', 'php', 'python'] } " Keep tags in sync
  30. Plug 'dpelle/vim-LanguageTool', { 'for': ['markdown', 'tex', 'plaintext', 'mail']} " LanguageTool bindings
  31. Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} " We recommend updating the parsers on update
  32. Plug 'nvim-treesitter/nvim-treesitter-textobjects'
  33. Plug 'kyazdani42/nvim-web-devicons' " Icons...
  34. Plug 'mfussenegger/nvim-dap', { 'for': ['typescript', 'javascript', 'python', 'rust'] }
  35. Plug 'lbrayner/vim-rzip' " recursive zip support, needed for yarn pnp
  36. Plug 'kkoomen/vim-doge', { 'do': { -> doge#install() } }
  37. " telescope. Needed for octo.nvim, might replace fzf
  38. Plug 'nvim-lua/popup.nvim'
  39. Plug 'nvim-lua/plenary.nvim'
  40. Plug 'nvim-telescope/telescope.nvim'
  41. Plug 'nvim-telescope/telescope-fzf-native.nvim', { 'do': 'make' } " improve sort performance
  42. Plug 'pwntester/octo.nvim'
  43. " {{{ CocPlugins
  44. Plug 'neoclide/coc-json', { 'do': 'yarn install --frozen-lockfile' }
  45. Plug 'neoclide/coc-snippets', { 'do': 'yarn install --frozen-lockfile' }
  46. Plug 'neoclide/coc-tsserver', { 'do': 'yarn install --frozen-lockfile' }
  47. Plug 'neoclide/coc-eslint', { 'do': 'yarn install --frozen-lockfile' }
  48. Plug 'fannheyward/coc-rust-analyzer', { 'do': 'yarn install --frozen-lockfile' }
  49. Plug 'neoclide/coc-css', { 'do': 'yarn install --frozen-lockfile' }
  50. Plug 'neoclide/coc-vimtex', { 'do': 'yarn install --frozen-lockfile' }
  51. Plug 'fannheyward/coc-texlab', { 'do': 'yarn install --frozen-lockfile' }
  52. Plug 'neoclide/coc-html', { 'do': 'yarn install --frozen-lockfile' }
  53. Plug 'neoclide/coc-yaml', { 'do': 'yarn install --frozen-lockfile' }
  54. "Plug 'neoclide/coc-python', { 'do': 'yarn install --frozen-lockfile' }
  55. Plug 'fannheyward/coc-sql', { 'do': 'yarn install --frozen-lockfile' }
  56. Plug 'fannheyward/coc-markdownlint', { 'do': 'yarn install --frozen-lockfile' }
  57. Plug 'fannheyward/coc-pyright', { 'for': 'python', 'do': 'yarn install --frozen-lockfile' }
  58. " }}}
  59. " html / templates{{{
  60. Plug 'mattn/emmet-vim', { 'for': ['jinja.html', 'html', 'php', 'gohtmltmpl', 'vue', 'markdown'] } " emmet support for vim - easily create markdup wth CSS-like syntax
  61. Plug 'gregsexton/MatchTag', { 'for': ['html', 'php', 'gohtmltmpl', 'vue'] } " match tags in html, similar to paren support
  62. Plug 'othree/html5.vim', { 'for': ['html', 'php', 'gohtmltmpl', 'vue'] } " html5 support
  63. Plug 'lumiliet/vim-twig', { 'for': ['html'] } " twig syntax support
  64. Plug 'Glench/Vim-Jinja2-Syntax', { 'for': ['html'] }
  65. Plug 'jvanja/vim-bootstrap4-snippets', { 'for': ['html', 'blade'] }
  66. "}}}
  67. " JavaScript{{{
  68. Plug 'gavocanov/vim-js-indent', { 'for': [ 'javascript' ]} " JavaScript indent support
  69. Plug 'posva/vim-vue', { 'for': [ 'javascript', 'html', 'vue' ] } " vue.js integration
  70. Plug 'kevinoid/vim-jsonc'
  71. "}}}
  72. " LaTeX{{{
  73. Plug 'lervag/vimtex', { 'for': 'tex' }
  74. "}}}
  75. " Markdown{{{
  76. Plug 'tpope/vim-markdown', { 'for': 'markdown'}
  77. Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app & yarn install', 'for': 'markdown' }
  78. "}}}
  79. " Colorschemes{{{
  80. Plug 'altercation/vim-colors-solarized'
  81. Plug 'vim-scripts/nginx.vim'
  82. "}}}
  83. " TOML{{{
  84. Plug 'cespare/vim-toml', { 'for': 'toml' }
  85. "}}}
  86. " C/C++{{{
  87. Plug 'Rip-Rip/clang_complete', { 'for': ['c', 'cpp'], 'do': 'make install' }
  88. let g:clang_library_path='/usr/lib/llvm-6.0/lib/libclang-6.0.so.1'
  89. Plug 'rhysd/vim-clang-format', { 'for' : ['c', 'cpp', 'java'] }
  90. Plug 'vim-scripts/DoxygenToolkit.vim', { 'for' : ['c', 'cpp'] }
  91. "}}}
  92. " PHP{{{
  93. Plug 'captbaritone/better-indent-support-for-php-with-html', { 'for': 'php' }
  94. Plug 'lumiliet/vim-twig', { 'for': [ 'php', 'html' ] } " Twig templates
  95. Plug 'Rican7/php-doc-modded', { 'for': 'php' } " Automatic phpdoc comments
  96. Plug 'jwalton512/vim-blade', { 'for': 'php' }
  97. "}}}
  98. " {{{ Python
  99. Plug 'jeetsukumaran/vim-pythonsense', { 'for': ['python'] } " text objects for python
  100. Plug 'heavenshell/vim-pydocstring', { 'for': ['python'], 'do': 'make install' }
  101. Plug 'anntzer/vim-cython', { 'for': ['python']}
  102. "}}}
  103. "{{{ CSV
  104. Plug 'chrisbra/csv.vim', { 'for': 'csv' }
  105. "}}}
  106. " All of your Plugins must be added before the following line
  107. call plug#end() " required
  108. filetype plugin indent on " required
  109. " }}}
  110. " THEME{{{
  111. colorscheme solarized
  112. set background=dark
  113. " Use light theme if whole shell is in light mode
  114. let themeenv=$THEME_SWITCHER
  115. if themeenv=='light'
  116. set background=light
  117. endif
  118. " }}}
  119. " SETTINGS{{{
  120. " disable Ex mode, who needs this anyway?
  121. noremap Q <Nop>
  122. set number " line numbers
  123. set autoread " reload file automatically
  124. set colorcolumn=100 " highlight column 99
  125. set textwidth=99
  126. set smartcase "use smart case like in ripgrep (case insensitive until capital letters are used)
  127. set history=1000
  128. set wildignore+=node_modules " ignore node_modules folder from file search
  129. set inccommand=split " show interactive results of substiute command
  130. " make comments and HTML attributes italic
  131. highlight Comment cterm=italic
  132. highlight htmlArg cterm=italic
  133. set autoindent " automatically set indent of new line
  134. set smartindent
  135. set tabstop=4
  136. set shiftwidth=4
  137. set expandtab
  138. " toggle invisible characters
  139. set list
  140. set listchars=tab:→\ ,trail:⋅,extends:❯,precedes:❮
  141. set showbreak=
  142. set ttyfast " faster redrawing
  143. set diffopt+=vertical
  144. set laststatus=2 " show the satus line all the time
  145. set so=7 " set 7 lines to the cursors - when moving vertical
  146. set wildmenu " enhanced command line completion
  147. set hidden " current buffer can be put into background
  148. set showcmd " show incomplete commands
  149. " set noshowmode " don't show which mode disabled for PowerLine
  150. set wildmode=list:longest " complete files like a shell
  151. set scrolloff=3 " lines of text around cursor
  152. set shell=$SHELL
  153. set cmdheight=1 " command bar height
  154. set title " set terminal title
  155. set mouse=nv
  156. set foldmethod=marker" " folds are marked with {{{}}}
  157. " Uncomment the following to have Vim jump to the last position when
  158. " reopening a file
  159. if has("autocmd")
  160. if expand('%:t') != 'COMMIT_EDITMSG'
  161. au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
  162. \| exe "normal! g'\"" | endif
  163. endif
  164. endif
  165. " Setting for correct mips syntax highlighting
  166. au BufReadPost *.mips set syntax=mips
  167. " Override default flavor to latex, so vimtex gets loaded always
  168. let g:tex_flavor = "latex"
  169. " use python 3 when in doubt
  170. let g:python3_host_prog="/home/schneider/.pyenv/versions/neovim3/bin/python"
  171. set pyxversion=3
  172. " nodejs settings
  173. "let g:node_host_prog="/usr/bin/node"
  174. " Disable ALEs LSP, as we're using coc
  175. let g:ale_disable_lsp = 1
  176. " }}}
  177. " MAPPINGS{{{
  178. let mapleader = ","
  179. " CtrlP for Tags
  180. nnoremap <leader><C-p> :CtrlPTag<cr>
  181. " fzf bindings
  182. "nmap <C-p> :Files<CR>
  183. nmap <leader><C-p> :Tags<CR>
  184. nmap <leader>/ :Rg<CR>
  185. "nmap <leader>b :Buffers<CR>
  186. " Telescope Bindings
  187. nmap <C-p> :lua require("telescope.builtin").find_files({find_command={"fd","--type=f","-H", "-E=.git", "-E=.yalc", "-E=node_modules"}})<CR>
  188. "nmap <C-p> :Telescope fd<CR>
  189. nmap <leader>b :lua require('telescope.builtin').buffers({ sort_mru = true, ignore_current_buffer = true })<CR>
  190. nmap <leader>/ :Telescope live_grep<CR>
  191. " Toggle NERDTree
  192. nmap <silent> <leader>k :NERDTreeToggle<cr>
  193. " expand to the path of the file in the current buffer
  194. nmap <silent> <leader>y :NERDTreeFind<cr>
  195. " Allow saving of files as sudo when I forgot to start vim using sudo.
  196. cmap w!! :w suda://%
  197. "Toggle set paste
  198. nmap <leader>tp :set paste!<cr>
  199. " scroll the viewport faster
  200. nnoremap <C-e> 3<C-e>
  201. nnoremap <C-y> 3<C-y>
  202. " ctrl-r in visual mode to replace selected text
  203. vnoremap <C-r> "hy:%s/<C-r>h//g<left><left>
  204. nmap <leader>an :ALENext<cr>
  205. nnoremap <leader>tn :tabnew<cr>
  206. nnoremap <F3> :Git<cr>
  207. nnoremap <F4> :Git push<cr>
  208. "}}}
  209. " {{{ Textobjects
  210. lua <<EOF
  211. require'nvim-treesitter.configs'.setup {
  212. textobjects = {
  213. select = {
  214. enable = true,
  215. -- Automatically jump forward to textobj, similar to targets.vim
  216. lookahead = true,
  217. keymaps = {
  218. -- You can use the capture groups defined in textobjects.scm
  219. ["af"] = "@function.outer",
  220. ["if"] = "@function.inner",
  221. ["ac"] = "@class.outer",
  222. ["ic"] = "@class.inner",
  223. -- Or you can define your own textobjects like this
  224. -- ["iF"] = {
  225. -- python = "(function_definition) @function",
  226. -- cpp = "(function_definition) @function",
  227. -- c = "(function_definition) @function",
  228. -- java = "(method_declaration) @function",
  229. -- },
  230. },
  231. },
  232. },
  233. }
  234. EOF
  235. " }}}
  236. " P L U G I N S{{{
  237. let g:languagetool_server="/opt/LanguageTool/LanguageTool-5.0/languagetool-server.jar"
  238. let g:languagetool_jar="/opt/LanguageTool/LanguageTool-5.0/languagetool-commandline.jar"
  239. let NERDTreeShowHidden=1
  240. if exists('g:started_by_firenvim')
  241. let g:airline_disable_statusline = 1
  242. else
  243. let g:airline_powerline_fonts = 1
  244. end
  245. " notational notes
  246. let g:nv_search_paths = ['~/notes']
  247. let g:nv_default_extension = '.md'
  248. let g:nv_main_directory = '~/notes'
  249. " Octo.nvim
  250. "lua require('octo')
  251. " ALE {{{
  252. let g:airline#extensions#ale#enabled = 1
  253. "}}}
  254. let vim_tags_ctags_binary='~/bin/phpctags'"
  255. " Java config
  256. autocmd FileType java setlocal omnifunc=javacomplete#Complete
  257. " Python-mode config
  258. let g:pymode_lint_on_write = 0
  259. " Vimtex{{{
  260. if !exists('g:neocomplete#sources#omni#input_patterns')
  261. let g:neocomplete#sources#omni#input_patterns = {}
  262. endif
  263. let g:neocomplete#sources#omni#input_patterns.tex =
  264. \ '\v\\%('
  265. \ . '\a*%(ref|cite)\a*%(\s*\[[^]]*\])?\s*\{[^{}]*'
  266. \ . '|includegraphics%(\s*\[[^]]*\])?\s*\{[^{}]*'
  267. \ . '|%(include|input)\s*\{[^{}]*'
  268. \ . ')'
  269. "}}}
  270. " C/C++ {{{
  271. autocmd FileType c,cpp,objc nnoremap <buffer><Leader>f :<C-u>ClangFormat<CR>
  272. autocmd FileType c,cpp,objc vnoremap <buffer><Leader>f :ClangFormat<CR>
  273. "}}}
  274. " Prettier
  275. let g:prettier#config#tab_width = 4
  276. let g:prettier#exec_cmd_async = 1
  277. " Completion {{{
  278. " if hidden is not set, TextEdit might fail.
  279. set hidden
  280. " Some servers have issues with backup files, see #649
  281. set nobackup
  282. set nowritebackup
  283. " Better display for messages
  284. set cmdheight=2
  285. " You will have bad experience for diagnostic messages when it's default 4000.
  286. set updatetime=300
  287. " don't give |ins-completion-menu| messages.
  288. set shortmess+=c
  289. " always show signcolumns
  290. set signcolumn=yes
  291. " Use tab for trigger completion with characters ahead and navigate.
  292. " Use command ':verbose imap <tab>' to make sure tab is not mapped by other plugin.
  293. inoremap <silent><expr> <TAB>
  294. \ pumvisible() ? "\<C-n>" :
  295. \ <SID>check_back_space() ? "\<TAB>" :
  296. \ coc#refresh()
  297. inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
  298. function! s:check_back_space() abort
  299. let col = col('.') - 1
  300. return !col || getline('.')[col - 1] =~# '\s'
  301. endfunction
  302. " Use <c-space> to trigger completion.
  303. inoremap <silent><expr> <c-space> coc#refresh()
  304. " Use <cr> to confirm completion, `<C-g>u` means break undo chain at current position.
  305. " Coc only does snippet and additional edit on confirm.
  306. inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
  307. " Use `[c` and `]c` to navigate diagnostics
  308. nmap <silent> [c <Plug>(coc-diagnostic-prev)
  309. nmap <silent> ]c <Plug>(coc-diagnostic-next)
  310. " Remap keys for gotos
  311. nmap <silent> gd <Plug>(coc-definition)
  312. nmap <silent> gy <Plug>(coc-type-definition)
  313. nmap <silent> gi <Plug>(coc-implementation)
  314. nmap <silent> gr <Plug>(coc-references)
  315. " Use K to show documentation in preview window
  316. nnoremap <silent> H :call <SID>show_documentation()<CR>
  317. function! s:show_documentation()
  318. if (index(['vim','help'], &filetype) >= 0)
  319. execute 'h '.expand('<cword>')
  320. else
  321. call CocAction('doHover')
  322. endif
  323. endfunction
  324. " Highlight symbol under cursor on CursorHold
  325. autocmd CursorHold * silent call CocActionAsync('highlight')
  326. " Remap for rename current word
  327. nmap <leader>rn <Plug>(coc-rename)
  328. " Remap for format selected region
  329. xmap <leader>f <Plug>(coc-format-selected)
  330. nmap <leader>f <Plug>(coc-format-selected)
  331. augroup mygroup
  332. autocmd!
  333. " Setup formatexpr specified filetype(s).
  334. autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
  335. " Update signature help on jump placeholder
  336. autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
  337. augroup end
  338. " Remap for do codeAction of selected region, ex: `<leader>aap` for current paragraph
  339. xmap <leader>a <Plug>(coc-codeaction-selected)
  340. nmap <leader>a <Plug>(coc-codeaction-selected)
  341. " Remap for do codeAction of current line
  342. nmap <leader>ac <Plug>(coc-codeaction)
  343. " Fix autofix problem of current line
  344. nmap <leader>qf <Plug>(coc-fix-current)
  345. " Use <tab> for select selections ranges, needs server support, like: coc-tsserver, coc-python
  346. "nmap <silent> <TAB> <Plug>(coc-range-select)
  347. "xmap <silent> <TAB> <Plug>(coc-range-select)
  348. "xmap <silent> <S-TAB> <Plug>(coc-range-select-backward)
  349. " Use `:Format` to format current buffer
  350. command! -nargs=0 Format :call CocAction('format')
  351. " Use `:Fold` to fold current buffer
  352. command! -nargs=? Fold :call CocAction('fold', <f-args>)
  353. " use `:OR` for organize import of current buffer
  354. command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport')
  355. " Add status line support, for integration with other plugin, checkout `:h coc-status`
  356. set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
  357. " Using CocList
  358. " Show all diagnostics
  359. nnoremap <silent> <space>a :<C-u>CocList diagnostics<cr>
  360. " Manage extensions
  361. nnoremap <silent> <space>e :<C-u>CocList extensions<cr>
  362. " Show commands
  363. nnoremap <silent> <space>c :<C-u>CocList commands<cr>
  364. " Find symbol of current document
  365. nnoremap <silent> <space>o :<C-u>CocList outline<cr>
  366. " Search workspace symbols
  367. nnoremap <silent> <space>s :<C-u>CocList -I symbols<cr>
  368. " Do default action for next item.
  369. nnoremap <silent> <space>j :<C-u>CocNext<CR>
  370. " Do default action for previous item.
  371. nnoremap <silent> <space>k :<C-u>CocPrev<CR>
  372. " Resume latest coc list
  373. nnoremap <silent> <space>p :<C-u>CocListResume<CR>:
  374. " snippets
  375. imap <C-k> <Plug>(coc-snippets-expand-jump)
  376. " For conceal markers.
  377. if has('conceal')
  378. set conceallevel=2 concealcursor=niv
  379. endif
  380. let g:neosnippet#snippets_directory = '~/.dotfiles/vim/neosnippets'
  381. "}}}
  382. " Treesitter {{{
  383. lua <<EOF
  384. require'nvim-treesitter.configs'.setup {
  385. ensure_installed = {"typescript", "javascript", "python", "json", "yaml"}, -- one of "all", "maintained" (parsers with maintainers), or a list of languages
  386. highlight = {
  387. enable = true, -- false will disable the whole extension
  388. disable = {}, -- list of language that will be disabled
  389. },
  390. }
  391. EOF
  392. " }}}
  393. " Telescope {{{
  394. lua <<EOF
  395. -- You dont need to set any of these options. These are the default ones. Only
  396. -- the loading is important
  397. require('telescope').setup {
  398. extensions = {
  399. fzf = {
  400. fuzzy = true, -- false will only do exact matching
  401. override_generic_sorter = true, -- override the generic sorter
  402. override_file_sorter = true, -- override the file sorter
  403. case_mode = "smart_case", -- or "ignore_case" or "respect_case"
  404. -- the default case_mode is "smart_case"
  405. }
  406. }
  407. }
  408. -- To get fzf loaded and working with telescope, you need to call
  409. -- load_extension, somewhere after setup function:
  410. require('telescope').load_extension('fzf')
  411. EOF
  412. "}}}
  413. " doge settings
  414. let g:doge_javascript_settings = {
  415. \ 'omit_redundant_param_types': 1,
  416. \}
  417. let g:doge_doc_standard_python = 'google'
  418. "}}}