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.

337 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 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 'ludovicchabant/vim-gutentags', { 'for': ['php', 'c', 'cpp'] }
  44. Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } " fuzzy file finder
  45. Plug 'junegunn/fzf.vim' " vim integration for fzf
  46. if has("nvim")
  47. " Problems with Syntastic in vim
  48. Plug 'airblade/vim-gitgutter' " git status in gutter column
  49. endif
  50. " html / templates
  51. Plug 'mattn/emmet-vim', { 'for': ['html', 'php', 'gohtmltmpl', 'vue'] } " emmet support for vim - easily create markdup wth CSS-like syntax
  52. Plug 'gregsexton/MatchTag', { 'for': ['html', 'php', 'gohtmltmpl', 'vue'] } " match tags in html, similar to paren support
  53. Plug 'othree/html5.vim', { 'for': ['html', 'php', 'gohtmltmpl', 'vue'] } " html5 support
  54. " JavaScript
  55. Plug 'gavocanov/vim-js-indent', { 'for': [ 'javascript' ]} " JavaScript indent support
  56. Plug 'moll/vim-node', { 'for': [ 'javascript', 'vue' ]} " node support
  57. "Plug 'othree/yajs.vim', { 'for': [ 'javascript', 'vue' ]} " JavaScript syntax plugin
  58. "Plug 'othree/es.next.syntax.vim', { 'for': [ 'javascript', 'vue' ]} " ES6 and beyond syntax
  59. Plug 'ternjs/tern_for_vim', { 'for':[ 'javascript', 'vue' ], 'do': 'npm install' } " Ternjs for vim
  60. Plug 'https://github.com/othree/jspc.vim', { 'for': [ 'javascript', 'vue' ]} " Function parameter completion
  61. Plug 'heavenshell/vim-jsdoc', { 'for': [ 'javascript', 'vue' ]} " Generate JSDoc comments
  62. Plug 'posva/vim-vue', { 'for': [ 'javascript', 'html', 'vue' ] } " vue.js integration
  63. " Go
  64. Plug 'fatih/vim-go', { 'for': [ 'go', 'html', 'gohtmltmpl' ], 'do': ':GoInstallBinaries' } " go support
  65. " LaTeX
  66. Plug 'lervag/vimtex', { 'for': 'tex' }
  67. " Markdown
  68. Plug 'suan/vim-instant-markdown', { 'for': 'markdown' }
  69. Plug 'tpope/vim-markdown', { 'for': 'markdown'}
  70. " Colorschemes
  71. Plug 'altercation/vim-colors-solarized'
  72. " TOML
  73. Plug 'cespare/vim-toml', { 'for': 'toml' }
  74. " Haskell
  75. Plug 'bitc/vim-hdevtools', { 'for': 'haskell' }
  76. Plug 'nbouscal/vim-stylish-haskell', { 'for': 'haskell' }
  77. " C/C++
  78. Plug 'Rip-Rip/clang_complete', { 'for': ['c', 'cpp'], 'do': 'make install' }
  79. let g:clang_library_path='/usr/lib/llvm-4.0/lib/libclang-4.0.so.1'
  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. " Completion {{{
  195. if !has("nvim")
  196. "Note: This option must be set in .vimrc(_vimrc). NOT IN .gvimrc(_gvimrc)!
  197. " Disable AutoComplPop.
  198. let g:acp_enableAtStartup = 0
  199. " Use neocomplete.
  200. let g:neocomplete#enable_at_startup = 1
  201. " Use smartcase.
  202. let g:neocomplete#enable_smart_case = 1
  203. " Set minimum syntax keyword length.
  204. let g:neocomplete#sources#syntax#min_keyword_length = 3
  205. " Define dictionary.
  206. let g:neocomplete#sources#dictionary#dictionaries = {
  207. \ 'default' : '',
  208. \ 'vimshell' : $HOME.'/.vimshell_hist',
  209. \ 'scheme' : $HOME.'/.gosh_completions'
  210. \ }
  211. " Define keyword.
  212. if !exists('g:neocomplete#keyword_patterns')
  213. let g:neocomplete#keyword_patterns = {}
  214. endif
  215. let g:neocomplete#keyword_patterns['default'] = '\h\w*'
  216. " Plugin key-mappings.
  217. inoremap <expr><C-g> neocomplete#undo_completion()
  218. inoremap <expr><C-l> neocomplete#complete_common_string()
  219. " Recommended key-mappings.
  220. " <CR>: close popup and save indent.
  221. inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>
  222. function! s:my_cr_function()
  223. return (pumvisible() ? "\<C-y>" : "" ) . "\<CR>"
  224. " For no inserting <CR> key.
  225. "return pumvisible() ? "\<C-y>" : "\<CR>"
  226. endfunction
  227. " <TAB>: completion.
  228. inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
  229. " <C-h>, <BS>: close popup and delete backword char.
  230. inoremap <expr><C-h> neocomplete#smart_close_popup()."\<C-h>"
  231. inoremap <expr><BS> neocomplete#smart_close_popup()."\<C-h>"
  232. " Close popup by <Space>.
  233. "inoremap <expr><Space> pumvisible() ? "\<C-y>" : "\<Space>"
  234. " AutoComplPop like behavior.
  235. "let g:neocomplete#enable_auto_select = 1
  236. " Shell like behavior(not recommended).
  237. "set completeopt+=longest
  238. "let g:neocomplete#enable_auto_select = 1
  239. "let g:neocomplete#disable_auto_complete = 1
  240. "inoremap <expr><TAB> pumvisible() ? "\<Down>" : "\<C-x>\<C-u>"
  241. " Enable omni completion.
  242. autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
  243. autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
  244. autocmd FileType javascript setlocal omnifunc=tern#Complete
  245. autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
  246. autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
  247. " Enable heavy omni completion.
  248. if !exists('g:neocomplete#sources#omni#input_patterns')
  249. let g:neocomplete#sources#omni#input_patterns = {}
  250. endif
  251. "let g:neocomplete#sources#omni#input_patterns.php = '[^. \t]->\h\w*\|\h\w*::'
  252. "let g:neocomplete#sources#omni#input_patterns.c = '[^.[:digit:] *\t]\%(\.\|->\)'
  253. "let g:neocomplete#sources#omni#input_patterns.cpp = '[^.[:digit:] *\t]\%(\.\|->\)\|\h\w*::'
  254. " For perlomni.vim setting.
  255. " https://github.com/c9s/perlomni.vim
  256. let g:neocomplete#sources#omni#input_patterns.perl = '\h\w*->\h\w*\|\h\w*::'
  257. else
  258. " Use deoplete.
  259. let g:deoplete#enable_at_startup = 1
  260. " Use TAB to cycle between matches
  261. inoremap <silent><expr><tab> pumvisible() ? "\<c-n>" : "\<tab>"
  262. inoremap <silent><expr><s-tab> pumvisible() ? "\<c-p>" : "\<s-tab>"
  263. let g:deoplete#ignore_sources = get(g:, 'deoplete#ignore_sources', {})
  264. let g:deoplete#ignore_sources.php = ['omni']
  265. endif
  266. " Neosnippet Settings
  267. imap <C-k> <Plug>(neosnippet_expand_or_jump)
  268. smap <C-k> <Plug>(neosnippet_expand_or_jump)
  269. xmap <C-k> <Plug>(neosnippet_expand_target)
  270. " SuperTab like snippets behavior.
  271. "imap <expr><TAB>
  272. " \ pumvisible() ? "\<C-n>" :
  273. " \ neosnippet#expandable_or_jumpable() ?
  274. " \ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
  275. smap <expr><TAB> neosnippet#expandable_or_jumpable() ?
  276. \ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
  277. " For conceal markers.
  278. if has('conceal')
  279. set conceallevel=2 concealcursor=niv
  280. endif
  281. let g:neosnippet#snippets_directory = '~/.dotfiles/vim/neosnippets'
  282. "}}}
  283. set foldmethod=marker"