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.

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