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.

265 lines
8.7 KiB

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 '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 'tpope/vim-dadbod' " Modern database interface for Vim
  15. Plug 'tpope/vim-dispatch' " Needed for dadbod
  16. Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } " file tree
  17. Plug 'Xuyuanp/nerdtree-git-plugin', { 'on': 'NERDTreeToggle' }
  18. Plug 'scrooloose/nerdcommenter' " better commenting
  19. Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } " completion engine
  20. Plug 'Shougo/neosnippet.vim' " snippet engine
  21. Plug 'Shougo/neosnippet-snippets' " snippets
  22. Plug 'easymotion/vim-easymotion' " better motion with leader
  23. Plug 'bling/vim-airline' " statusline
  24. Plug 'w0rp/ale' " asynchronous linting engine
  25. Plug 'godlygeek/tabular' " Align text on symbols
  26. Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } " fuzzy file finder
  27. Plug 'junegunn/fzf.vim' " vim integration for fzf
  28. Plug 'airblade/vim-gitgutter' " git status in gutter column
  29. Plug 'radenling/vim-dispatch-neovim' " support for :Start command, needed in dadbod
  30. " html / templates{{{
  31. Plug 'mattn/emmet-vim', { 'for': ['html', 'php', 'gohtmltmpl', 'vue'] } " emmet support for vim - easily create markdup wth CSS-like syntax
  32. Plug 'gregsexton/MatchTag', { 'for': ['html', 'php', 'gohtmltmpl', 'vue'] } " match tags in html, similar to paren support
  33. Plug 'othree/html5.vim', { 'for': ['html', 'php', 'gohtmltmpl', 'vue'] } " html5 support
  34. Plug 'lumiliet/vim-twig', { 'for': ['html'] } " twig syntax 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. Plug 'python-mode/python-mode', { 'for': 'python', 'branch': 'develop' }
  82. "}}}
  83. " Java{{{
  84. Plug 'artur-shaik/vim-javacomplete2', { 'for': 'java' }
  85. "}}}
  86. " MIPS{{{
  87. Plug 'vim-scripts/mips.vim'
  88. "}}}
  89. " Rust {{{
  90. Plug 'sebastianmarkow/deoplete-rust', {'for': 'rust' }
  91. "}}}
  92. " All of your Plugins must be added before the following line
  93. call plug#end() " required
  94. filetype plugin indent on " required
  95. " }}}
  96. " THEME{{{
  97. colorscheme solarized
  98. set background=dark
  99. " Use light theme if whole shell is in light mode
  100. let themeenv=$THEME_SWITCHER
  101. if themeenv=='light'
  102. set background=light
  103. endif
  104. " }}}
  105. " SETTINGS{{{
  106. set number " line numbers
  107. set autoread " reload file automatically
  108. set colorcolumn=80 " highlight column 80
  109. set history=1000
  110. set wildignore+=node_modules " ignore node_modules folder from file search
  111. " make comments and HTML attributes italic
  112. highlight Comment cterm=italic
  113. highlight htmlArg cterm=italic
  114. set autoindent " automatically set indent of new line
  115. set smartindent
  116. set tabstop=4
  117. set shiftwidth=4
  118. set expandtab
  119. " toggle invisible characters
  120. set list
  121. set listchars=tab:→\ ,eol,trail:⋅,extends:❯,precedes:❮
  122. set showbreak=
  123. set ttyfast " faster redrawing
  124. set diffopt+=vertical
  125. set laststatus=2 " show the satus line all the time
  126. set so=7 " set 7 lines to the cursors - when moving vertical
  127. set wildmenu " enhanced command line completion
  128. set hidden " current buffer can be put into background
  129. set showcmd " show incomplete commands
  130. " set noshowmode " don't show which mode disabled for PowerLine
  131. set wildmode=list:longest " complete files like a shell
  132. set scrolloff=3 " lines of text around cursor
  133. set shell=$SHELL
  134. set cmdheight=1 " command bar height
  135. set title " set terminal title
  136. set foldmethod=marker" " folds are marked with {{{}}}
  137. " Uncomment the following to have Vim jump to the last position when
  138. " reopening a file
  139. if has("autocmd")
  140. au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
  141. \| exe "normal! g'\"" | endif
  142. endif
  143. " Setting for correct mips syntax highlighting
  144. au BufReadPost *.mips set syntax=mips
  145. " }}}
  146. " MAPPINGS{{{
  147. let mapleader = ","
  148. " CtrlP for Tags
  149. nnoremap <leader><C-p> :CtrlPTag<cr>
  150. " fzf bindings
  151. nmap <C-p> :Files<CR>
  152. nmap <leader><C-p> :Tags<CR>
  153. " Toggle NERDTree
  154. nmap <silent> <leader>k :NERDTreeToggle<cr>
  155. " expand to the path of the file in the current buffer
  156. nmap <silent> <leader>y :NERDTreeFind<cr>
  157. " Allow saving of files as sudo when I forgot to start vim using sudo.
  158. cmap w!! w !sudo tee > /dev/null %
  159. "Toggle set paste
  160. nmap <leader>tp :set paste!<cr>
  161. " scroll the viewport faster
  162. nnoremap <C-e> 3<C-e>
  163. nnoremap <C-y> 3<C-y>
  164. " ctrl-r in visual mode to replace selected text
  165. vnoremap <C-r> "hy:%s/<C-r>h//g<left><left>
  166. nmap <leader>an :ALENext<cr>
  167. "}}}
  168. " P L U G I N S{{{
  169. let NERDTreeShowHidden=1
  170. let g:airline_powerline_fonts = 1
  171. " ALE {{{
  172. let g:airline#extensions#ale#enabled = 1
  173. "}}}
  174. let vim_tags_ctags_binary='~/bin/phpctags'"
  175. " Java config
  176. autocmd FileType java setlocal omnifunc=javacomplete#Complete
  177. " Python-mode config
  178. let g:pymode_lint_on_write = 0
  179. " Vimtex{{{
  180. if !exists('g:neocomplete#sources#omni#input_patterns')
  181. let g:neocomplete#sources#omni#input_patterns = {}
  182. endif
  183. let g:neocomplete#sources#omni#input_patterns.tex =
  184. \ '\v\\%('
  185. \ . '\a*%(ref|cite)\a*%(\s*\[[^]]*\])?\s*\{[^{}]*'
  186. \ . '|includegraphics%(\s*\[[^]]*\])?\s*\{[^{}]*'
  187. \ . '|%(include|input)\s*\{[^{}]*'
  188. \ . ')'
  189. "}}}
  190. " C/C++
  191. autocmd FileType c,cpp,objc nnoremap <buffer><Leader>f :<C-u>ClangFormat<CR>
  192. autocmd FileType c,cpp,objc vnoremap <buffer><Leader>f :ClangFormat<CR>
  193. "}}}
  194. " Completion {{{
  195. " Use deoplete.
  196. let g:deoplete#enable_at_startup = 1
  197. " Use TAB to cycle between matches
  198. inoremap <silent><expr><tab> pumvisible() ? "\<c-n>" : "\<tab>"
  199. inoremap <silent><expr><s-tab> pumvisible() ? "\<c-p>" : "\<s-tab>"
  200. let g:deoplete#ignore_sources = get(g:, 'deoplete#ignore_sources', {})
  201. let g:deoplete#ignore_sources.php = ['omni']
  202. " Neosnippet Settings
  203. imap <C-k> <Plug>(neosnippet_expand_or_jump)
  204. smap <C-k> <Plug>(neosnippet_expand_or_jump)
  205. xmap <C-k> <Plug>(neosnippet_expand_target)
  206. " SuperTab like snippets behavior.
  207. "imap <expr><TAB>
  208. " \ pumvisible() ? "\<C-n>" :
  209. " \ neosnippet#expandable_or_jumpable() ?
  210. " \ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
  211. smap <expr><TAB> neosnippet#expandable_or_jumpable() ?
  212. \ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
  213. " For conceal markers.
  214. if has('conceal')
  215. set conceallevel=2 concealcursor=niv
  216. endif
  217. let g:neosnippet#snippets_directory = '~/.dotfiles/vim/neosnippets'
  218. "}}}