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.

319 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 'davidhalter/jedi-vim', { 'for': 'python', 'do': 'pip install jedi' }
  75. Plug 'zchee/deoplete-jedi', { '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. else
  241. " Use deoplete.
  242. let g:deoplete#enable_at_startup = 1
  243. " Use TAB to cycle between matches
  244. inoremap <silent><expr><tab> pumvisible() ? "\<c-n>" : "\<tab>"
  245. inoremap <silent><expr><s-tab> pumvisible() ? "\<c-p>" : "\<s-tab>"
  246. let g:deoplete#ignore_sources = get(g:, 'deoplete#ignore_sources', {})
  247. let g:deoplete#ignore_sources.php = ['omni']
  248. endif
  249. " Neosnippet Settings
  250. imap <C-k> <Plug>(neosnippet_expand_or_jump)
  251. smap <C-k> <Plug>(neosnippet_expand_or_jump)
  252. xmap <C-k> <Plug>(neosnippet_expand_target)
  253. " SuperTab like snippets behavior.
  254. "imap <expr><TAB>
  255. " \ pumvisible() ? "\<C-n>" :
  256. " \ neosnippet#expandable_or_jumpable() ?
  257. " \ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
  258. smap <expr><TAB> neosnippet#expandable_or_jumpable() ?
  259. \ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
  260. " For conceal markers.
  261. if has('conceal')
  262. set conceallevel=2 concealcursor=niv
  263. endif
  264. let g:neosnippet#snippets_directory = '~/.dotfiles/vim/neosnippets'
  265. "}}}
  266. set foldmethod=marker"