From dd97e412a57516decf092184c0583c02fdbb95ce Mon Sep 17 00:00:00 2001 From: Chris Pride Date: Mon, 4 Jan 2016 15:59:19 -0800 Subject: [PATCH] Pull out the git log options as an option. In my environment '--graph' is a kiss of death. It results in seeing nothing but graph lines due to the number of branches in flight. Secondly the colors baked into this break with my color scheme which has a background of black rending the date unreadable. So to solve this I need to be able to specify my own options, so add a new options g:fzf_commits_log_options to allow this. --- README.md | 3 +++ autoload/fzf/vim.vim | 2 +- doc/fzf-vim.txt | 6 +++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 827bb81..f3dfdd2 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,9 @@ let g:fzf_action = { " - window (nvim only) let g:fzf_layout = { 'down': '~40%' } +" For Commits and BCommits to customize the options used by 'git log': +let g:fzf_commits_log_options = '--graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr"' + " Advanced customization using autoload functions autocmd VimEnter * command! Colors \ call fzf#vim#colors({'left': '15%', 'options': '--reverse --margin 30%,0'}) diff --git a/autoload/fzf/vim.vim b/autoload/fzf/vim.vim index 5dd704a..c441e08 100644 --- a/autoload/fzf/vim.vim +++ b/autoload/fzf/vim.vim @@ -729,7 +729,7 @@ function! s:commits(buffer_local, args) return s:warn('Not in git repository') endif - let source = 'git log --graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr"' + let source = 'git log '.get(g:, 'fzf_commits_log_options', '--graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr"') let current = expand('%:S') let managed = 0 if !empty(current) diff --git a/doc/fzf-vim.txt b/doc/fzf-vim.txt index 6306a6e..2ebe3f1 100644 --- a/doc/fzf-vim.txt +++ b/doc/fzf-vim.txt @@ -115,7 +115,7 @@ But its functionality is still available via `call pathogen#helptags()`.) < Customization >_____________________________________________________________~ *fzf-vim-customization* - *g:fzf_action* *g:fzf_layout* + *g:fzf_action* *g:fzf_layout* *g:fzf_commits_log_options* > " This is the default extra key bindings let g:fzf_action = { @@ -126,6 +126,10 @@ But its functionality is still available via `call pathogen#helptags()`.) " Default fzf layout let g:fzf_layout = { 'down': '40%' } + " For Commits and BCommits to customize the options used by 'git log': + let g:fzf_commits_log_options = \ + '--graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr"' + " Advanced customization using autoload functions autocmd VimEnter * command! Colors \ call fzf#vim#colors({'left': '15%', 'options': '--reverse --margin 30%,0'})