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.

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