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.

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