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.

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