diff --git a/autoload/flog.vim b/autoload/flog.vim index 13fcf3e..5ccc834 100644 --- a/autoload/flog.vim +++ b/autoload/flog.vim @@ -205,6 +205,7 @@ function! flog#get_internal_default_args() abort \ 'bisect': v:false, \ 'no_merges': v:false, \ 'reflog': v:false, + \ 'reverse': v:false, \ 'no_graph': v:false, \ 'no_patch': v:false, \ 'skip': v:null, @@ -308,6 +309,8 @@ function! flog#parse_set_args(args, current_args, defaults) abort let a:current_args.no_merges = v:true elseif l:arg ==# '-reflog' let a:current_args.reflog = v:true + elseif l:arg ==# '-reverse' + let a:current_args.reverse = v:true elseif l:arg ==# '-no-graph' let a:current_args.no_graph = v:true elseif l:arg ==# '-no-patch' @@ -812,6 +815,9 @@ function! flog#build_log_args() abort if l:opts.reflog let l:args .= ' --reflog' endif + if l:opts.reverse + let l:args .= ' --reverse' + endif if l:opts.no_patch let l:args .= ' --no-patch' endif @@ -1105,6 +1111,9 @@ function! flog#set_graph_buffer_title() abort if l:opts.reflog let l:title .= ' [reflog]' endif + if l:opts.reverse + let l:title .= ' [reverse]' + endif if l:opts.no_graph let l:title .= ' [no_graph]' endif @@ -1270,6 +1279,12 @@ function! flog#toggle_reflog_option() abort call flog#populate_graph_buffer() endfunction +function! flog#toggle_reverse_option() abort + let l:state = flog#get_state() + let l:state.reverse = l:state.reverse ? v:false : v:true + call flog#populate_graph_buffer() +endfunction + function! flog#toggle_no_graph_option() abort let l:state = flog#get_state() let l:state.no_graph = l:state.no_graph ? v:false : v:true diff --git a/doc/flog.txt b/doc/flog.txt index 5eb22a5..1e084e6 100644 --- a/doc/flog.txt +++ b/doc/flog.txt @@ -29,6 +29,7 @@ COMMANDS *flog-commands* -bisect Enable the "--bisect" argument by default. -no-merges Enable the "--no-merges" argument by default. -reflog Enable the "--reflog" argument by default. + -reverse Enable the "--reverse" argument by default. -no-graph Disable the "--graph" argument by default. -no-patch Enable the "--no-patch" argument by default. -skip= Passed to "--skip", skipping that number of commits by @@ -245,6 +246,12 @@ gp *flog-gp* Toggle the "--no-patch" argument. Useful while the "-limit" option is specified. +gsr *(FlogToggleReverse)* + *flog-gsr* + + Toggle the "--reverse" argument. Does not conflict with other sort options. + Mnemonic: "sort reverse". + *(FlogUpdate)* u *flog-u* diff --git a/ftplugin/floggraph.vim b/ftplugin/floggraph.vim index 3e73538..6e3b63c 100644 --- a/ftplugin/floggraph.vim +++ b/ftplugin/floggraph.vim @@ -127,6 +127,11 @@ if !hasmapto('(FlogToggleReflog)') endif nnoremap (FlogToggleReflog) :call flog#toggle_reflog_option() +if !hasmapto('(FlogToggleReverse)') + nmap gsr (FlogToggleReverse) +endif +nnoremap (FlogToggleReverse) :call flog#toggle_reverse_option() + if !hasmapto('(FlogToggleNoGraph)') nmap gx (FlogToggleNoGraph) endif diff --git a/plugin/flog.vim b/plugin/flog.vim index 41bfa7a..9bea7d2 100644 --- a/plugin/flog.vim +++ b/plugin/flog.vim @@ -86,6 +86,7 @@ let g:flog_default_completion = [ \ '-raw-args=', \ '-reflog ', \ '-rev=', + \ '-reverse', \ '-search=', \ '-skip=' \ ]