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