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.

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