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.

261 lines
8.6 KiB

8 years ago
8 years ago
8 years ago
7 years ago
7 years ago
8 years ago
6 years ago
6 years ago
6 years ago
8 years ago
8 years ago
7 years ago
7 years ago
7 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
6 years ago
7 years ago
8 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 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 'VundleVim/Vundle.vim' " let Vundle manage Vundle, required
  10. Plug 'tpope/vim-fugitive' " Git integration
  11. Plug 'tpope/vim-sensible' " Defaults everyone can agree on
  12. Plug 'tpope/vim-surround' " better handling of surrounding markers
  13. Plug 'tpope/vim-ragtag' " Enhancement of surround for html
  14. Plug 'tpope/vim-repeat' " repeat last command with .
  15. Plug 'tpope/vim-dadbod' " Modern database interface for Vim
  16. Plug 'tpope/vim-dispatch' " Needed for dadbod
  17. Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } " file tree
  18. Plug 'Xuyuanp/nerdtree-git-plugin', { 'on': 'NERDTreeToggle' }
  19. Plug 'scrooloose/nerdcommenter' " better commenting
  20. Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } " completion engine
  21. Plug 'Shougo/neosnippet.vim' " snippet engine
  22. Plug 'Shougo/neosnippet-snippets' " snippets
  23. Plug 'easymotion/vim-easymotion' " better motion with leader
  24. Plug 'bling/vim-airline' " statusline
  25. Plug 'w0rp/ale' " asynchronous linting engine
  26. Plug 'godlygeek/tabular' " Align text on symbols
  27. Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } " fuzzy file finder
  28. Plug 'junegunn/fzf.vim' " vim integration for fzf
  29. Plug 'airblade/vim-gitgutter' " git status in gutter column
  30. Plug 'radenling/vim-dispatch-neovim' " support for :Start command, needed in dadbod
  31. " html / templates{{{
  32. Plug 'mattn/emmet-vim', { 'for': ['html', 'php', 'gohtmltmpl', 'vue'] } " emmet support for vim - easily create markdup wth CSS-like syntax
  33. Plug 'gregsexton/MatchTag', { 'for': ['html', 'php', 'gohtmltmpl', 'vue'] } " match tags in html, similar to paren support
  34. Plug 'othree/html5.vim', { 'for': ['html', 'php', 'gohtmltmpl', 'vue'] } " html5 support
  35. "}}}
  36. " JavaScript{{{
  37. Plug 'gavocanov/vim-js-indent', { 'for': [ 'javascript' ]} " JavaScript indent support
  38. Plug 'moll/vim-node', { 'for': [ 'javascript', 'vue' ]} " node support
  39. "Plug 'othree/yajs.vim', { 'for': [ 'javascript', 'vue' ]} " JavaScript syntax plugin
  40. "Plug 'othree/es.next.syntax.vim', { 'for': [ 'javascript', 'vue' ]} " ES6 and beyond syntax
  41. Plug 'https://github.com/othree/jspc.vim', { 'for': [ 'javascript', 'vue' ]} " Function parameter completion
  42. Plug 'heavenshell/vim-jsdoc', { 'for': [ 'javascript', 'vue' ]} " Generate JSDoc comments
  43. Plug 'posva/vim-vue', { 'for': [ 'javascript', 'html', 'vue' ] } " vue.js integration
  44. Plug 'carlitux/deoplete-ternjs', { 'for': [ 'javascript', 'vue', 'html' ], 'do': 'npm install -g tern' } " deoplete completion via ternjs
  45. "}}}
  46. " Go {{{
  47. Plug 'fatih/vim-go', { 'for': [ 'go', 'html', 'gohtmltmpl' ], 'do': ':GoInstallBinaries' } " go support
  48. Plug 'zchee/deoplete-go', { 'for': 'go' }
  49. "}}}
  50. " LaTeX{{{
  51. Plug 'lervag/vimtex', { 'for': 'tex' }
  52. "}}}
  53. " Markdown{{{
  54. Plug 'suan/vim-instant-markdown', { 'for': 'markdown' }
  55. Plug 'tpope/vim-markdown', { 'for': 'markdown'}
  56. "}}}
  57. " Colorschemes{{{
  58. Plug 'altercation/vim-colors-solarized'
  59. "}}}
  60. " TOML{{{
  61. Plug 'cespare/vim-toml', { 'for': 'toml' }
  62. "}}}
  63. " Haskell{{{
  64. Plug 'bitc/vim-hdevtools', { 'for': 'haskell' }
  65. Plug 'nbouscal/vim-stylish-haskell', { 'for': 'haskell' }
  66. "}}}
  67. " C/C++{{{
  68. Plug 'Rip-Rip/clang_complete', { 'for': ['c', 'cpp'], 'do': 'make install' }
  69. let g:clang_library_path='/usr/lib/llvm-6.0/lib/libclang-6.0.so.1'
  70. Plug 'rhysd/vim-clang-format', { 'for' : ['c', 'cpp', 'java'] }
  71. "}}}
  72. " PHP{{{
  73. "Plug 'shawncplus/phpcomplete.vim', { 'for': 'php', 'do': 'curl -Ss http://vim-php.com/phpctags/install/phpctags.phar > ~/bin/phpctags && chmod +x ~/bin/phpctags' }
  74. Plug 'lvht/phpcd.vim', { 'for': 'php', 'do': 'composer install' }
  75. Plug 'captbaritone/better-indent-support-for-php-with-html', { 'for': 'php' }
  76. Plug 'lumiliet/vim-twig', { 'for': [ 'php', 'html' ] } " Twig templates
  77. "}}}
  78. " Python{{{
  79. Plug 'davidhalter/jedi-vim', { 'for': 'python', 'do': 'pip install jedi' }
  80. Plug 'zchee/deoplete-jedi', { 'for': 'python' }
  81. "}}}
  82. " Java{{{
  83. Plug 'artur-shaik/vim-javacomplete2', { 'for': 'java' }
  84. "}}}
  85. " MIPS{{{
  86. Plug 'vim-scripts/mips.vim'
  87. "}}}
  88. " All of your Plugins must be added before the following line
  89. call plug#end() " required
  90. filetype plugin indent on " required
  91. " }}}
  92. " THEME{{{
  93. colorscheme solarized
  94. set background=dark
  95. " Use light theme if whole shell is in light mode
  96. let themeenv=$THEME_SWITCHER
  97. if themeenv=='light'
  98. set background=light
  99. endif
  100. " }}}
  101. " SETTINGS{{{
  102. set number " line numbers
  103. set autoread " reload file automatically
  104. set colorcolumn=80 " highlight column 80
  105. set history=1000
  106. set wildignore+=node_modules " ignore node_modules folder from file search
  107. " make comments and HTML attributes italic
  108. highlight Comment cterm=italic
  109. highlight htmlArg cterm=italic
  110. set autoindent " automatically set indent of new line
  111. set smartindent
  112. set tabstop=4
  113. set shiftwidth=4
  114. set expandtab
  115. " toggle invisible characters
  116. set list
  117. set listchars=tab:→\ ,eol,trail:⋅,extends:❯,precedes:❮
  118. set showbreak=
  119. set ttyfast " faster redrawing
  120. set diffopt+=vertical
  121. set laststatus=2 " show the satus line all the time
  122. set so=7 " set 7 lines to the cursors - when moving vertical
  123. set wildmenu " enhanced command line completion
  124. set hidden " current buffer can be put into background
  125. set showcmd " show incomplete commands
  126. " set noshowmode " don't show which mode disabled for PowerLine
  127. set wildmode=list:longest " complete files like a shell
  128. set scrolloff=3 " lines of text around cursor
  129. set shell=$SHELL
  130. set cmdheight=1 " command bar height
  131. set title " set terminal title
  132. set foldmethod=marker" " folds are marked with {{{}}}
  133. " Uncomment the following to have Vim jump to the last position when
  134. " reopening a file
  135. if has("autocmd")
  136. au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
  137. \| exe "normal! g'\"" | endif
  138. endif
  139. " Setting for correct mips syntax highlighting
  140. au BufReadPost *.mips set syntax=mips
  141. " }}}
  142. " MAPPINGS{{{
  143. let mapleader = ","
  144. " CtrlP for Tags
  145. nnoremap <leader><C-p> :CtrlPTag<cr>
  146. " fzf bindings
  147. nmap <C-p> :Files<CR>
  148. nmap <leader><C-p> :Tags<CR>
  149. " Toggle NERDTree
  150. nmap <silent> <leader>k :NERDTreeToggle<cr>
  151. " expand to the path of the file in the current buffer
  152. nmap <silent> <leader>y :NERDTreeFind<cr>
  153. " Allow saving of files as sudo when I forgot to start vim using sudo.
  154. cmap w!! w !sudo tee > /dev/null %
  155. "Toggle set paste
  156. nmap <leader>tp :set paste!<cr>
  157. " scroll the viewport faster
  158. nnoremap <C-e> 3<C-e>
  159. nnoremap <C-y> 3<C-y>
  160. " ctrl-r in visual mode to replace selected text
  161. vnoremap <C-r> "hy:%s/<C-r>h//g<left><left>
  162. nmap <leader>an :ALENext<cr>
  163. "}}}
  164. " P L U G I N S{{{
  165. let NERDTreeShowHidden=1
  166. let g:airline_powerline_fonts = 1
  167. " ALE {{{
  168. let g:airline#extensions#ale#enabled = 1
  169. "}}}
  170. let vim_tags_ctags_binary='~/bin/phpctags'"
  171. " Java config
  172. autocmd FileType java setlocal omnifunc=javacomplete#Complete
  173. " Python-mode config
  174. let g:pymode_lint_on_write = 0
  175. " Vimtex{{{
  176. if !exists('g:neocomplete#sources#omni#input_patterns')
  177. let g:neocomplete#sources#omni#input_patterns = {}
  178. endif
  179. let g:neocomplete#sources#omni#input_patterns.tex =
  180. \ '\v\\%('
  181. \ . '\a*%(ref|cite)\a*%(\s*\[[^]]*\])?\s*\{[^{}]*'
  182. \ . '|includegraphics%(\s*\[[^]]*\])?\s*\{[^{}]*'
  183. \ . '|%(include|input)\s*\{[^{}]*'
  184. \ . ')'
  185. "}}}
  186. " C/C++
  187. autocmd FileType c,cpp,objc nnoremap <buffer><Leader>f :<C-u>ClangFormat<CR>
  188. autocmd FileType c,cpp,objc vnoremap <buffer><Leader>f :ClangFormat<CR>
  189. "}}}
  190. " Completion {{{
  191. " Use deoplete.
  192. let g:deoplete#enable_at_startup = 1
  193. " Use TAB to cycle between matches
  194. inoremap <silent><expr><tab> pumvisible() ? "\<c-n>" : "\<tab>"
  195. inoremap <silent><expr><s-tab> pumvisible() ? "\<c-p>" : "\<s-tab>"
  196. let g:deoplete#ignore_sources = get(g:, 'deoplete#ignore_sources', {})
  197. let g:deoplete#ignore_sources.php = ['omni']
  198. " Neosnippet Settings
  199. imap <C-k> <Plug>(neosnippet_expand_or_jump)
  200. smap <C-k> <Plug>(neosnippet_expand_or_jump)
  201. xmap <C-k> <Plug>(neosnippet_expand_target)
  202. " SuperTab like snippets behavior.
  203. "imap <expr><TAB>
  204. " \ pumvisible() ? "\<C-n>" :
  205. " \ neosnippet#expandable_or_jumpable() ?
  206. " \ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
  207. smap <expr><TAB> neosnippet#expandable_or_jumpable() ?
  208. \ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
  209. " For conceal markers.
  210. if has('conceal')
  211. set conceallevel=2 concealcursor=niv
  212. endif
  213. let g:neosnippet#snippets_directory = '~/.dotfiles/vim/neosnippets'
  214. "}}}