diff options
-rw-r--r-- | .vim/after/plugin/fzf.vim | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/.vim/after/plugin/fzf.vim b/.vim/after/plugin/fzf.vim index 2101b90..0694caa 100644 --- a/.vim/after/plugin/fzf.vim +++ b/.vim/after/plugin/fzf.vim @@ -27,6 +27,10 @@ function! s:fzf_qf_sink(line) abort execute 'edit +' . line.lnum . ' ' . line.filename endfunction +let s:command_git_main_branch = 'git symbolic-ref --short refs/remotes/origin/HEAD' +let s:command_git_patch_files_changed = 'git diff --name-only --merge-base $(' + \ . s:command_git_main_branch . ')' + command! FzfQuickFix call fzf#run({ \ 'source': map(getqflist(), function('s:fzf_qf')), \ 'down': 20, @@ -42,6 +46,11 @@ if executable('fzf') && get(g:, 'loaded_fzf', 0) == 1 \ 'rg --hidden --column --line-number --no-heading --color=always --smart-case --glob !.git ' . <q-args>, 1, \ fzf#vim#with_preview(), <bang>0) + command! FzfGitChangedFiles call fzf#run({ + \ 'source': s:command_git_patch_files_changed, + \ 'sink': 'e' + \ }) + noremap <leader>ff :FzfFiles<CR> noremap <leader>fgf :FzfGFiles<CR> noremap <leader>fb :FzfBuffers<CR> @@ -49,8 +58,8 @@ if executable('fzf') && get(g:, 'loaded_fzf', 0) == 1 noremap <leader>ft :FzfBTags<CR> noremap <leader>fT :FzfTags<CR> noremap <leader>fr :FzfRg<space> - noremap <leader>fc :FzfHistory:<CR> - noremap <leader>fC :FzfCommands<CR> + noremap <leader>fc :FzfCommands<CR> + nnoremap <leader>fC :FzfGitChangedFiles<CR> noremap <leader>fgc :FzfBCommits<CR> noremap <leader>fgC :FzfCommits<CR> noremap <leader>fl :FzfBLines<CR> |