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.

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