diff options
| author | Kumar Damani <damani.kumar@gmail.com> | 2019-04-26 18:49:26 +0000 |
|---|---|---|
| committer | Kumar Damani <damani.kumar@gmail.com> | 2019-04-26 18:49:26 +0000 |
| commit | 5a6ed5fcb3b89d0c2b4e8ba2953c4ba806d4b171 (patch) | |
| tree | 5be0c043b0c8d632e35a8b4ef7e23452b103b94d /vim/.vim/plugged/fzf.vim/plugin | |
| parent | af821092fe78ef159d7cb6536bb006712dc01b9d (diff) | |
added vim dir
Diffstat (limited to 'vim/.vim/plugged/fzf.vim/plugin')
| -rw-r--r-- | vim/.vim/plugged/fzf.vim/plugin/fzf.vim | 149 |
1 files changed, 149 insertions, 0 deletions
diff --git a/vim/.vim/plugged/fzf.vim/plugin/fzf.vim b/vim/.vim/plugged/fzf.vim/plugin/fzf.vim new file mode 100644 index 0000000..a1f2c05 --- /dev/null +++ b/vim/.vim/plugged/fzf.vim/plugin/fzf.vim @@ -0,0 +1,149 @@ +" Copyright (c) 2015 Junegunn Choi +" +" MIT License +" +" Permission is hereby granted, free of charge, to any person obtaining +" a copy of this software and associated documentation files (the +" "Software"), to deal in the Software without restriction, including +" without limitation the rights to use, copy, modify, merge, publish, +" distribute, sublicense, and/or sell copies of the Software, and to +" permit persons to whom the Software is furnished to do so, subject to +" the following conditions: +" +" The above copyright notice and this permission notice shall be +" included in all copies or substantial portions of the Software. +" +" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +" NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +" LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +" OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +" WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +let s:cpo_save = &cpo +set cpo&vim +let s:is_win = has('win32') || has('win64') + +function! s:defs(commands) + let prefix = get(g:, 'fzf_command_prefix', '') + if prefix =~# '^[^A-Z]' + echoerr 'g:fzf_command_prefix must start with an uppercase letter' + return + endif + for command in a:commands + let name = ':'.prefix.matchstr(command, '\C[A-Z]\S\+') + if 2 != exists(name) + execute substitute(command, '\ze\C[A-Z]', prefix, '') + endif + endfor +endfunction + +call s:defs([ +\'command! -bang -nargs=? -complete=dir Files call fzf#vim#files(<q-args>, <bang>0)', +\'command! -bang -nargs=? GitFiles call fzf#vim#gitfiles(<q-args>, <bang>0)', +\'command! -bang -nargs=? GFiles call fzf#vim#gitfiles(<q-args>, <bang>0)', +\'command! -bar -bang -nargs=? -complete=buffer Buffers call fzf#vim#buffers(<q-args>, <bang>0)', +\'command! -bang -nargs=* Lines call fzf#vim#lines(<q-args>, <bang>0)', +\'command! -bang -nargs=* BLines call fzf#vim#buffer_lines(<q-args>, <bang>0)', +\'command! -bar -bang Colors call fzf#vim#colors(<bang>0)', +\'command! -bang -nargs=+ -complete=dir Locate call fzf#vim#locate(<q-args>, <bang>0)', +\'command! -bang -nargs=* Ag call fzf#vim#ag(<q-args>, <bang>0)', +\'command! -bang -nargs=* Rg call fzf#vim#grep("rg --column --line-number --no-heading --color=always --smart-case ".shellescape(<q-args>), 1, <bang>0)', +\'command! -bang -nargs=* Tags call fzf#vim#tags(<q-args>, <bang>0)', +\'command! -bang -nargs=* BTags call fzf#vim#buffer_tags(<q-args>, <bang>0)', +\'command! -bar -bang Snippets call fzf#vim#snippets(<bang>0)', +\'command! -bar -bang Commands call fzf#vim#commands(<bang>0)', +\'command! -bar -bang Marks call fzf#vim#marks(<bang>0)', +\'command! -bar -bang Helptags call fzf#vim#helptags(<bang>0)', +\'command! -bar -bang Windows call fzf#vim#windows(<bang>0)', +\'command! -bar -bang Commits call fzf#vim#commits(<bang>0)', +\'command! -bar -bang BCommits call fzf#vim#buffer_commits(<bang>0)', +\'command! -bar -bang Maps call fzf#vim#maps("n", <bang>0)', +\'command! -bar -bang Filetypes call fzf#vim#filetypes(<bang>0)', +\'command! -bang -nargs=* History call s:history(<q-args>, <bang>0)']) + +function! s:history(arg, bang) + let bang = a:bang || a:arg[len(a:arg)-1] == '!' + if a:arg[0] == ':' + call fzf#vim#command_history(bang) + elseif a:arg[0] == '/' + call fzf#vim#search_history(bang) + else + call fzf#vim#history(bang) + endif +endfunction + +function! fzf#complete(...) + return call('fzf#vim#complete', a:000) +endfunction + +if (has('nvim') || has('terminal') && has('patch-8.0.995')) && (get(g:, 'fzf_statusline', 1) || get(g:, 'fzf_nvim_statusline', 1)) + function! s:fzf_restore_colors() + if exists('#User#FzfStatusLine') + doautocmd User FzfStatusLine + else + if $TERM !~ "256color" + highlight default fzf1 ctermfg=1 ctermbg=8 guifg=#E12672 guibg=#565656 + highlight default fzf2 ctermfg=2 ctermbg=8 guifg=#BCDDBD guibg=#565656 + highlight default fzf3 ctermfg=7 ctermbg=8 guifg=#D9D9D9 guibg=#565656 + else + highlight default fzf1 ctermfg=161 ctermbg=238 guifg=#E12672 guibg=#565656 + highlight default fzf2 ctermfg=151 ctermbg=238 guifg=#BCDDBD guibg=#565656 + highlight default fzf3 ctermfg=252 ctermbg=238 guifg=#D9D9D9 guibg=#565656 + endif + setlocal statusline=%#fzf1#\ >\ %#fzf2#fz%#fzf3#f + endif + endfunction + + function! s:fzf_vim_term() + if get(w:, 'airline_active', 0) + let w:airline_disabled = 1 + autocmd BufWinLeave <buffer> let w:airline_disabled = 0 + endif + autocmd WinEnter,ColorScheme <buffer> call s:fzf_restore_colors() + + setlocal nospell + call s:fzf_restore_colors() + endfunction + + augroup _fzf_statusline + autocmd! + autocmd FileType fzf call s:fzf_vim_term() + augroup END +endif + +if !exists('g:fzf#vim#buffers') + let g:fzf#vim#buffers = {} +endif + +augroup fzf_buffers + autocmd! + if exists('*reltimefloat') + autocmd BufWinEnter,WinEnter * let g:fzf#vim#buffers[bufnr('')] = reltimefloat(reltime()) + else + autocmd BufWinEnter,WinEnter * let g:fzf#vim#buffers[bufnr('')] = localtime() + endif + autocmd BufDelete * silent! call remove(g:fzf#vim#buffers, expand('<abuf>')) +augroup END + +inoremap <expr> <plug>(fzf-complete-word) fzf#vim#complete#word() +if s:is_win + inoremap <expr> <plug>(fzf-complete-path) fzf#vim#complete#path('dir /s/b') + inoremap <expr> <plug>(fzf-complete-file) fzf#vim#complete#path('dir /s/b/a:-d') +else + inoremap <expr> <plug>(fzf-complete-path) fzf#vim#complete#path("find . -path '*/\.*' -prune -o -print \| sed '1d;s:^..::'") + inoremap <expr> <plug>(fzf-complete-file) fzf#vim#complete#path("find . -path '*/\.*' -prune -o -type f -print -o -type l -print \| sed 's:^..::'") +endif +inoremap <expr> <plug>(fzf-complete-file-ag) fzf#vim#complete#path('ag -l -g ""') +inoremap <expr> <plug>(fzf-complete-line) fzf#vim#complete#line() +inoremap <expr> <plug>(fzf-complete-buffer-line) fzf#vim#complete#buffer_line() + +nnoremap <silent> <plug>(fzf-maps-n) :<c-u>call fzf#vim#maps('n', 0)<cr> +inoremap <silent> <plug>(fzf-maps-i) <c-o>:call fzf#vim#maps('i', 0)<cr> +xnoremap <silent> <plug>(fzf-maps-x) :<c-u>call fzf#vim#maps('x', 0)<cr> +onoremap <silent> <plug>(fzf-maps-o) <c-c>:<c-u>call fzf#vim#maps('o', 0)<cr> + +let &cpo = s:cpo_save +unlet s:cpo_save + |
