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.

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