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.

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