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.

336 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 '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 'ternjs/tern_for_vim', { 'for':[ 'javascript', 'vue' ], 'do': 'npm install' } " Ternjs for vim
  59. Plug 'https://github.com/othree/jspc.vim', { 'for': [ 'javascript', 'vue' ]} " Function parameter completion
  60. Plug 'heavenshell/vim-jsdoc', { 'for': [ 'javascript', 'vue' ]} " Generate JSDoc comments
  61. Plug 'posva/vim-vue', { 'for': [ 'javascript', 'html', 'vue' ] } " vue.js integration
  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. " PHP
  80. "Plug 'shawncplus/phpcomplete.vim', { 'for': 'php', 'do': 'curl -Ss http://vim-php.com/phpctags/install/phpctags.phar > ~/bin/phpctags && chmod +x ~/bin/phpctags' }
  81. Plug 'lvht/phpcd.vim', { 'for': 'php', 'do': 'composer install' }
  82. Plug 'captbaritone/better-indent-support-for-php-with-html', { 'for': 'php' }
  83. " Python
  84. Plug 'davidhalter/jedi-vim', { 'for': 'python', 'do': 'pip install jedi' }
  85. Plug 'zchee/deoplete-jedi', { 'for': 'python' }
  86. " Java
  87. Plug 'artur-shaik/vim-javacomplete2', { 'for': 'java' }
  88. " All of your Plugins must be added before the following line
  89. call plug#end() " required
  90. filetype plugin indent on " required
  91. " }}}
  92. " THEME{{{
  93. colorscheme solarized
  94. set background=dark"
  95. let themeenv=$THEME_SWITCHER
  96. if themeenv=='light'
  97. set background=light
  98. endif
  99. " }}}
  100. " SETTINGS{{{
  101. set number
  102. set autoread
  103. set colorcolumn=80
  104. set history=1000
  105. set wildignore+=node_modules
  106. " make comments and HTML attributes italic
  107. highlight Comment cterm=italic
  108. highlight htmlArg cterm=italic
  109. set autoindent " automatically set indent of new line
  110. set smartindent
  111. set tabstop=4
  112. set shiftwidth=4
  113. set expandtab
  114. " toggle invisible characters
  115. set list
  116. set listchars=tab:→\ ,eol:¬,trail:⋅,extends:❯,precedes:❮
  117. set showbreak=↪
  118. set ttyfast " faster redrawing
  119. set diffopt+=vertical
  120. set laststatus=2 " show the satus line all the time
  121. set so=7 " set 7 lines to the cursors - when moving vertical
  122. set wildmenu " enhanced command line completion
  123. set hidden " current buffer can be put into background
  124. set showcmd " show incomplete commands
  125. " set noshowmode " don't show which mode disabled for PowerLine
  126. set wildmode=list:longest " complete files like a shell
  127. set scrolloff=3 " lines of text around cursor
  128. set shell=$SHELL
  129. set cmdheight=1 " command bar height
  130. set title " set terminal title
  131. " Uncomment the following to have Vim jump to the last position when
  132. " reopening a file
  133. if has("autocmd")
  134. au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
  135. \| exe "normal! g'\"" | endif
  136. endif
  137. " }}}
  138. " MAPPINGS{{{
  139. let mapleader = ","
  140. " CtrlP for Tags
  141. nnoremap <leader><C-p> :CtrlPTag<cr>
  142. " fzf bindings
  143. nmap <C-p> :Files<CR>
  144. nmap <leader><C-p> :Tags<CR>
  145. " Toggle NERDTree
  146. nmap <silent> <leader>k :NERDTreeToggle<cr>
  147. " expand to the path of the file in the current buffer
  148. nmap <silent> <leader>y :NERDTreeFind<cr>
  149. " Allow saving of files as sudo when I forgot to start vim using sudo.
  150. cmap w!! w !sudo tee > /dev/null %
  151. "Toggle set paste
  152. nmap <leader>tp :set paste!<cr>
  153. " scroll the viewport faster
  154. nnoremap <C-e> 3<C-e>
  155. nnoremap <C-y> 3<C-y>
  156. " ctrl-r in visual mode to replace selected text
  157. vnoremap <C-r> "hy:%s/<C-r>h//g<left><left>
  158. "}}}
  159. " P L U G I N S{{{
  160. let NERDTreeShowHidden=1
  161. let g:airline_powerline_fonts = 1
  162. " Syntastic{{{
  163. if !has("nvim")
  164. let g:syntastic_always_populate_loc_list = 1
  165. let g:syntastic_auto_loc_list = 1
  166. let g:syntastic_check_on_open = 1
  167. let g:syntastic_check_on_wq = 0
  168. let g:syntastic_aggregate_errors = 1
  169. set statusline+=%#warningmsg#
  170. set statusline+=%{SyntasticStatuslineFlag()}
  171. set statusline+=%*
  172. endif
  173. "}}}
  174. " ALE {{{
  175. let g:airline#extensions#ale#enabled = 1
  176. "}}}
  177. let vim_tags_ctags_binary='~/bin/phpctags'"
  178. " Java config
  179. autocmd FileType java setlocal omnifunc=javacomplete#Complete
  180. " Python-mode config
  181. let g:pymode_lint_on_write = 0
  182. " Vimtex
  183. if !exists('g:neocomplete#sources#omni#input_patterns')
  184. let g:neocomplete#sources#omni#input_patterns = {}
  185. endif
  186. let g:neocomplete#sources#omni#input_patterns.tex =
  187. \ '\v\\%('
  188. \ . '\a*%(ref|cite)\a*%(\s*\[[^]]*\])?\s*\{[^{}]*'
  189. \ . '|includegraphics%(\s*\[[^]]*\])?\s*\{[^{}]*'
  190. \ . '|%(include|input)\s*\{[^{}]*'
  191. \ . ')'
  192. "}}}
  193. " Completion {{{
  194. if !has("nvim")
  195. "Note: This option must be set in .vimrc(_vimrc). NOT IN .gvimrc(_gvimrc)!
  196. " Disable AutoComplPop.
  197. let g:acp_enableAtStartup = 0
  198. " Use neocomplete.
  199. let g:neocomplete#enable_at_startup = 1
  200. " Use smartcase.
  201. let g:neocomplete#enable_smart_case = 1
  202. " Set minimum syntax keyword length.
  203. let g:neocomplete#sources#syntax#min_keyword_length = 3
  204. " Define dictionary.
  205. let g:neocomplete#sources#dictionary#dictionaries = {
  206. \ 'default' : '',
  207. \ 'vimshell' : $HOME.'/.vimshell_hist',
  208. \ 'scheme' : $HOME.'/.gosh_completions'
  209. \ }
  210. " Define keyword.
  211. if !exists('g:neocomplete#keyword_patterns')
  212. let g:neocomplete#keyword_patterns = {}
  213. endif
  214. let g:neocomplete#keyword_patterns['default'] = '\h\w*'
  215. " Plugin key-mappings.
  216. inoremap <expr><C-g> neocomplete#undo_completion()
  217. inoremap <expr><C-l> neocomplete#complete_common_string()
  218. " Recommended key-mappings.
  219. " <CR>: close popup and save indent.
  220. inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>
  221. function! s:my_cr_function()
  222. return (pumvisible() ? "\<C-y>" : "" ) . "\<CR>"
  223. " For no inserting <CR> key.
  224. "return pumvisible() ? "\<C-y>" : "\<CR>"
  225. endfunction
  226. " <TAB>: completion.
  227. inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
  228. " <C-h>, <BS>: close popup and delete backword char.
  229. inoremap <expr><C-h> neocomplete#smart_close_popup()."\<C-h>"
  230. inoremap <expr><BS> neocomplete#smart_close_popup()."\<C-h>"
  231. " Close popup by <Space>.
  232. "inoremap <expr><Space> pumvisible() ? "\<C-y>" : "\<Space>"
  233. " AutoComplPop like behavior.
  234. "let g:neocomplete#enable_auto_select = 1
  235. " Shell like behavior(not recommended).
  236. "set completeopt+=longest
  237. "let g:neocomplete#enable_auto_select = 1
  238. "let g:neocomplete#disable_auto_complete = 1
  239. "inoremap <expr><TAB> pumvisible() ? "\<Down>" : "\<C-x>\<C-u>"
  240. " Enable omni completion.
  241. autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
  242. autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
  243. autocmd FileType javascript setlocal omnifunc=tern#Complete
  244. autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
  245. autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
  246. " Enable heavy omni completion.
  247. if !exists('g:neocomplete#sources#omni#input_patterns')
  248. let g:neocomplete#sources#omni#input_patterns = {}
  249. endif
  250. "let g:neocomplete#sources#omni#input_patterns.php = '[^. \t]->\h\w*\|\h\w*::'
  251. "let g:neocomplete#sources#omni#input_patterns.c = '[^.[:digit:] *\t]\%(\.\|->\)'
  252. "let g:neocomplete#sources#omni#input_patterns.cpp = '[^.[:digit:] *\t]\%(\.\|->\)\|\h\w*::'
  253. " For perlomni.vim setting.
  254. " https://github.com/c9s/perlomni.vim
  255. let g:neocomplete#sources#omni#input_patterns.perl = '\h\w*->\h\w*\|\h\w*::'
  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. " Neosnippet Settings
  266. imap <C-k> <Plug>(neosnippet_expand_or_jump)
  267. smap <C-k> <Plug>(neosnippet_expand_or_jump)
  268. xmap <C-k> <Plug>(neosnippet_expand_target)
  269. " SuperTab like snippets behavior.
  270. "imap <expr><TAB>
  271. " \ pumvisible() ? "\<C-n>" :
  272. " \ neosnippet#expandable_or_jumpable() ?
  273. " \ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
  274. smap <expr><TAB> neosnippet#expandable_or_jumpable() ?
  275. \ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
  276. " For conceal markers.
  277. if has('conceal')
  278. set conceallevel=2 concealcursor=niv
  279. endif
  280. let g:neosnippet#snippets_directory = '~/.dotfiles/vim/neosnippets'
  281. "}}}
  282. set foldmethod=marker"