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.

320 lines
11 KiB

8 years ago
8 years ago
8 years ago
7 years ago
7 years ago
8 years ago
8 years ago
8 years ago
7 years ago
7 years ago
7 years ago
7 years ago
8 years ago
8 years ago
7 years ago
8 years ago
8 years ago
8 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("~/.vim/autoload/plug.vim"))
  6. execute '!curl -fLo ~/.vim/autoload/plug.vim https://raw.github.com/junegunn/vim-plug/master/plug.vim'
  7. endif
  8. call plug#begin()
  9. " alternatively, pass a path where Vundle should install plugins
  10. "call vundle#begin('~/some/path/here')
  11. " let Vundle manage Vundle, required
  12. Plug 'VundleVim/Vundle.vim'
  13. Plug 'tpope/vim-fugitive' " Git integration
  14. Plug 'tpope/vim-sensible'
  15. Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } " file tree
  16. Plug 'Xuyuanp/nerdtree-git-plugin', { 'on': 'NERDTreeToggle' }
  17. Plug 'scrooloose/nerdcommenter' " better commenting
  18. if has("nvim")
  19. Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
  20. else
  21. Plug 'Shougo/neocomplete.vim'
  22. endif
  23. Plug 'Shougo/neosnippet.vim' " snippet engine
  24. Plug 'Shougo/neosnippet-snippets' " snippets
  25. Plug 'easymotion/vim-easymotion' " better motion with leader
  26. Plug 'bling/vim-airline'
  27. Plug 'tpope/vim-ragtag'
  28. Plug 'tpope/vim-surround' " better handling of surrounding markers
  29. Plug 'tpope/vim-repeat' " repeat last command with .
  30. Plug 'vim-syntastic/syntastic' " automatic linters
  31. Plug 'altercation/vim-colors-solarized' " solarized theme
  32. Plug 'godlygeek/tabular' " Align text on symbols
  33. Plug 'ludovicchabant/vim-gutentags', { 'for': ['php', 'c', 'cpp'] }
  34. Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } " fuzzy file finder
  35. Plug 'junegunn/fzf.vim' " vim integration for fzf
  36. if has("nvim")
  37. " Problems with Syntastic in vim
  38. Plug 'airblade/vim-gitgutter' " git status in gutter column
  39. endif
  40. " html / templates
  41. Plug 'mattn/emmet-vim', { 'for': ['html', 'php', 'gohtmltmpl', 'vue'] } " emmet support for vim - easily create markdup wth CSS-like syntax
  42. Plug 'gregsexton/MatchTag', { 'for': ['html', 'php', 'gohtmltmpl', 'vue'] } " match tags in html, similar to paren support
  43. Plug 'othree/html5.vim', { 'for': ['html', 'php', 'gohtmltmpl', 'vue'] } " html5 support
  44. " JavaScript
  45. Plug 'gavocanov/vim-js-indent', { 'for': [ 'javascript' ]} " JavaScript indent support
  46. Plug 'moll/vim-node', { 'for': [ 'javascript', 'vue' ]} " node support
  47. "Plug 'othree/yajs.vim', { 'for': [ 'javascript', 'vue' ]} " JavaScript syntax plugin
  48. "Plug 'othree/es.next.syntax.vim', { 'for': [ 'javascript', 'vue' ]} " ES6 and beyond syntax
  49. Plug 'ternjs/tern_for_vim', { 'for':[ 'javascript', 'vue' ], 'do': 'npm install' } " Ternjs for vim
  50. Plug 'https://github.com/othree/jspc.vim', { 'for': [ 'javascript', 'vue' ]} " Function parameter completion
  51. Plug 'heavenshell/vim-jsdoc', { 'for': [ 'javascript', 'vue' ]} " Generate JSDoc comments
  52. Plug 'posva/vim-vue', { 'for': [ 'javascript', 'html', 'vue' ] } " vue.js integration
  53. " Go
  54. Plug 'fatih/vim-go', { 'for': [ 'go', 'html', 'gohtmltmpl' ], 'do': ':GoInstallBinaries' } " go support
  55. " LaTeX
  56. Plug 'lervag/vimtex', { 'for': 'tex' }
  57. " Markdown
  58. Plug 'suan/vim-instant-markdown', { 'for': 'markdown' }
  59. Plug 'tpope/vim-markdown', { 'for': 'markdown'}
  60. " Colorschemes
  61. Plug 'altercation/vim-colors-solarized'
  62. " TOML
  63. Plug 'cespare/vim-toml', { 'for': 'toml' }
  64. " Haskell
  65. Plug 'bitc/vim-hdevtools', { 'for': 'haskell' }
  66. Plug 'nbouscal/vim-stylish-haskell', { 'for': 'haskell' }
  67. " C/C++
  68. Plug 'Rip-Rip/clang_complete', { 'for': ['c', 'cpp'], 'do': 'make install' }
  69. let g:clang_library_path='/usr/lib/llvm-4.0/lib/libclang-4.0.so.1'
  70. " PHP
  71. "Plug 'shawncplus/phpcomplete.vim', { 'for': 'php', 'do': 'curl -Ss http://vim-php.com/phpctags/install/phpctags.phar > ~/bin/phpctags && chmod +x ~/bin/phpctags' }
  72. Plug 'lvht/phpcd.vim', { 'for': 'php', 'do': 'composer install' }
  73. Plug 'captbaritone/better-indent-support-for-php-with-html', { 'for': 'php' }
  74. " Python
  75. Plug 'davidhalter/jedi-vim', { 'for': 'python', 'do': 'pip install jedi' }
  76. Plug 'zchee/deoplete-jedi', { 'for': 'python' }
  77. " Java
  78. Plug 'artur-shaik/vim-javacomplete2', { 'for': 'java' }
  79. " All of your Plugins must be added before the following line
  80. call plug#end() " required
  81. filetype plugin indent on " required
  82. " }}}
  83. " THEME{{{
  84. colorscheme solarized
  85. set background=dark"
  86. let themeenv=$THEME_SWITCHER
  87. if themeenv=='light'
  88. set background=light
  89. endif
  90. " }}}
  91. " SETTINGS{{{
  92. set number
  93. set autoread
  94. set colorcolumn=80
  95. set history=1000
  96. set wildignore+=node_modules
  97. " make comments and HTML attributes italic
  98. highlight Comment cterm=italic
  99. highlight htmlArg cterm=italic
  100. set autoindent " automatically set indent of new line
  101. set smartindent
  102. set tabstop=4
  103. set shiftwidth=4
  104. set expandtab
  105. " toggle invisible characters
  106. set list
  107. set listchars=tab:→\ ,eol:¬,trail:⋅,extends:❯,precedes:❮
  108. set showbreak=↪
  109. set ttyfast " faster redrawing
  110. set diffopt+=vertical
  111. set laststatus=2 " show the satus line all the time
  112. set so=7 " set 7 lines to the cursors - when moving vertical
  113. set wildmenu " enhanced command line completion
  114. set hidden " current buffer can be put into background
  115. set showcmd " show incomplete commands
  116. " set noshowmode " don't show which mode disabled for PowerLine
  117. set wildmode=list:longest " complete files like a shell
  118. set scrolloff=3 " lines of text around cursor
  119. set shell=$SHELL
  120. set cmdheight=1 " command bar height
  121. set title " set terminal title
  122. " Uncomment the following to have Vim jump to the last position when
  123. " reopening a file
  124. if has("autocmd")
  125. au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
  126. \| exe "normal! g'\"" | endif
  127. endif
  128. " }}}
  129. " MAPPINGS{{{
  130. let mapleader = ","
  131. " CtrlP for Tags
  132. nnoremap <leader><C-p> :CtrlPTag<cr>
  133. " fzf bindings
  134. nmap <C-p> :Files<CR>
  135. nmap <leader><C-p> :Tags<CR>
  136. " Toggle NERDTree
  137. nmap <silent> <leader>k :NERDTreeToggle<cr>
  138. " expand to the path of the file in the current buffer
  139. nmap <silent> <leader>y :NERDTreeFind<cr>
  140. " Allow saving of files as sudo when I forgot to start vim using sudo.
  141. cmap w!! w !sudo tee > /dev/null %
  142. "Toggle set paste
  143. nmap <leader>tp :set paste!<cr>
  144. " scroll the viewport faster
  145. nnoremap <C-e> 3<C-e>
  146. nnoremap <C-y> 3<C-y>
  147. " ctrl-r in visual mode to replace selected text
  148. vnoremap <C-r> "hy:%s/<C-r>h//g<left><left>
  149. "}}}
  150. " P L U G I N S{{{
  151. let NERDTreeShowHidden=1
  152. let g:airline_powerline_fonts = 1
  153. " Syntastic
  154. let g:syntastic_always_populate_loc_list = 1
  155. let g:syntastic_auto_loc_list = 1
  156. let g:syntastic_check_on_open = 1
  157. let g:syntastic_check_on_wq = 0
  158. let g:syntastic_aggregate_errors = 1
  159. set statusline+=%#warningmsg#
  160. set statusline+=%{SyntasticStatuslineFlag()}
  161. set statusline+=%*
  162. let vim_tags_ctags_binary='~/bin/phpctags'"
  163. " Java config
  164. autocmd FileType java setlocal omnifunc=javacomplete#Complete
  165. " Python-mode config
  166. let g:pymode_lint_on_write = 0
  167. " Vimtex
  168. if !exists('g:neocomplete#sources#omni#input_patterns')
  169. let g:neocomplete#sources#omni#input_patterns = {}
  170. endif
  171. let g:neocomplete#sources#omni#input_patterns.tex =
  172. \ '\v\\%('
  173. \ . '\a*%(ref|cite)\a*%(\s*\[[^]]*\])?\s*\{[^{}]*'
  174. \ . '|includegraphics%(\s*\[[^]]*\])?\s*\{[^{}]*'
  175. \ . '|%(include|input)\s*\{[^{}]*'
  176. \ . ')'
  177. "}}}
  178. " Completion {{{
  179. if !has("nvim")
  180. "Note: This option must be set in .vimrc(_vimrc). NOT IN .gvimrc(_gvimrc)!
  181. " Disable AutoComplPop.
  182. let g:acp_enableAtStartup = 0
  183. " Use neocomplete.
  184. let g:neocomplete#enable_at_startup = 1
  185. " Use smartcase.
  186. let g:neocomplete#enable_smart_case = 1
  187. " Set minimum syntax keyword length.
  188. let g:neocomplete#sources#syntax#min_keyword_length = 3
  189. " Define dictionary.
  190. let g:neocomplete#sources#dictionary#dictionaries = {
  191. \ 'default' : '',
  192. \ 'vimshell' : $HOME.'/.vimshell_hist',
  193. \ 'scheme' : $HOME.'/.gosh_completions'
  194. \ }
  195. " Define keyword.
  196. if !exists('g:neocomplete#keyword_patterns')
  197. let g:neocomplete#keyword_patterns = {}
  198. endif
  199. let g:neocomplete#keyword_patterns['default'] = '\h\w*'
  200. " Plugin key-mappings.
  201. inoremap <expr><C-g> neocomplete#undo_completion()
  202. inoremap <expr><C-l> neocomplete#complete_common_string()
  203. " Recommended key-mappings.
  204. " <CR>: close popup and save indent.
  205. inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>
  206. function! s:my_cr_function()
  207. return (pumvisible() ? "\<C-y>" : "" ) . "\<CR>"
  208. " For no inserting <CR> key.
  209. "return pumvisible() ? "\<C-y>" : "\<CR>"
  210. endfunction
  211. " <TAB>: completion.
  212. inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
  213. " <C-h>, <BS>: close popup and delete backword char.
  214. inoremap <expr><C-h> neocomplete#smart_close_popup()."\<C-h>"
  215. inoremap <expr><BS> neocomplete#smart_close_popup()."\<C-h>"
  216. " Close popup by <Space>.
  217. "inoremap <expr><Space> pumvisible() ? "\<C-y>" : "\<Space>"
  218. " AutoComplPop like behavior.
  219. "let g:neocomplete#enable_auto_select = 1
  220. " Shell like behavior(not recommended).
  221. "set completeopt+=longest
  222. "let g:neocomplete#enable_auto_select = 1
  223. "let g:neocomplete#disable_auto_complete = 1
  224. "inoremap <expr><TAB> pumvisible() ? "\<Down>" : "\<C-x>\<C-u>"
  225. " Enable omni completion.
  226. autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
  227. autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
  228. autocmd FileType javascript setlocal omnifunc=tern#Complete
  229. autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
  230. autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
  231. " Enable heavy omni completion.
  232. if !exists('g:neocomplete#sources#omni#input_patterns')
  233. let g:neocomplete#sources#omni#input_patterns = {}
  234. endif
  235. "let g:neocomplete#sources#omni#input_patterns.php = '[^. \t]->\h\w*\|\h\w*::'
  236. "let g:neocomplete#sources#omni#input_patterns.c = '[^.[:digit:] *\t]\%(\.\|->\)'
  237. "let g:neocomplete#sources#omni#input_patterns.cpp = '[^.[:digit:] *\t]\%(\.\|->\)\|\h\w*::'
  238. " For perlomni.vim setting.
  239. " https://github.com/c9s/perlomni.vim
  240. let g:neocomplete#sources#omni#input_patterns.perl = '\h\w*->\h\w*\|\h\w*::'
  241. else
  242. " Use deoplete.
  243. let g:deoplete#enable_at_startup = 1
  244. " Use TAB to cycle between matches
  245. inoremap <silent><expr><tab> pumvisible() ? "\<c-n>" : "\<tab>"
  246. inoremap <silent><expr><s-tab> pumvisible() ? "\<c-p>" : "\<s-tab>"
  247. let g:deoplete#ignore_sources = get(g:, 'deoplete#ignore_sources', {})
  248. let g:deoplete#ignore_sources.php = ['omni']
  249. endif
  250. " Neosnippet Settings
  251. imap <C-k> <Plug>(neosnippet_expand_or_jump)
  252. smap <C-k> <Plug>(neosnippet_expand_or_jump)
  253. xmap <C-k> <Plug>(neosnippet_expand_target)
  254. " SuperTab like snippets behavior.
  255. "imap <expr><TAB>
  256. " \ pumvisible() ? "\<C-n>" :
  257. " \ neosnippet#expandable_or_jumpable() ?
  258. " \ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
  259. smap <expr><TAB> neosnippet#expandable_or_jumpable() ?
  260. \ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
  261. " For conceal markers.
  262. if has('conceal')
  263. set conceallevel=2 concealcursor=niv
  264. endif
  265. let g:neosnippet#snippets_directory = '~/.dotfiles/vim/neosnippets'
  266. "}}}
  267. set foldmethod=marker"