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