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.

287 lines
9.5 KiB

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