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.

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