Skip to content

Commit 4bb36f6

Browse files
committed
Add -reverse option
1 parent 75aa5be commit 4bb36f6

File tree

4 files changed

+28
-0
lines changed

4 files changed

+28
-0
lines changed

autoload/flog.vim

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ function! flog#get_internal_default_args() abort
205205
\ 'bisect': v:false,
206206
\ 'no_merges': v:false,
207207
\ 'reflog': v:false,
208+
\ 'reverse': v:false,
208209
\ 'no_graph': v:false,
209210
\ 'no_patch': v:false,
210211
\ 'skip': v:null,
@@ -308,6 +309,8 @@ function! flog#parse_set_args(args, current_args, defaults) abort
308309
let a:current_args.no_merges = v:true
309310
elseif l:arg ==# '-reflog'
310311
let a:current_args.reflog = v:true
312+
elseif l:arg ==# '-reverse'
313+
let a:current_args.reverse = v:true
311314
elseif l:arg ==# '-no-graph'
312315
let a:current_args.no_graph = v:true
313316
elseif l:arg ==# '-no-patch'
@@ -812,6 +815,9 @@ function! flog#build_log_args() abort
812815
if l:opts.reflog
813816
let l:args .= ' --reflog'
814817
endif
818+
if l:opts.reverse
819+
let l:args .= ' --reverse'
820+
endif
815821
if l:opts.no_patch
816822
let l:args .= ' --no-patch'
817823
endif
@@ -1105,6 +1111,9 @@ function! flog#set_graph_buffer_title() abort
11051111
if l:opts.reflog
11061112
let l:title .= ' [reflog]'
11071113
endif
1114+
if l:opts.reverse
1115+
let l:title .= ' [reverse]'
1116+
endif
11081117
if l:opts.no_graph
11091118
let l:title .= ' [no_graph]'
11101119
endif
@@ -1270,6 +1279,12 @@ function! flog#toggle_reflog_option() abort
12701279
call flog#populate_graph_buffer()
12711280
endfunction
12721281

1282+
function! flog#toggle_reverse_option() abort
1283+
let l:state = flog#get_state()
1284+
let l:state.reverse = l:state.reverse ? v:false : v:true
1285+
call flog#populate_graph_buffer()
1286+
endfunction
1287+
12731288
function! flog#toggle_no_graph_option() abort
12741289
let l:state = flog#get_state()
12751290
let l:state.no_graph = l:state.no_graph ? v:false : v:true

doc/flog.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ COMMANDS *flog-commands*
2929
-bisect Enable the "--bisect" argument by default.
3030
-no-merges Enable the "--no-merges" argument by default.
3131
-reflog Enable the "--reflog" argument by default.
32+
-reverse Enable the "--reverse" argument by default.
3233
-no-graph Disable the "--graph" argument by default.
3334
-no-patch Enable the "--no-patch" argument by default.
3435
-skip=<number> Passed to "--skip", skipping that number of commits by
@@ -245,6 +246,12 @@ gp *flog-gp*
245246
Toggle the "--no-patch" argument. Useful while the "-limit" option is
246247
specified.
247248

249+
gsr *<Plug>(FlogToggleReverse)*
250+
*flog-gsr*
251+
252+
Toggle the "--reverse" argument. Does not conflict with other sort options.
253+
Mnemonic: "sort reverse".
254+
248255
*<Plug>(FlogUpdate)*
249256
u *flog-u*
250257

ftplugin/floggraph.vim

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,11 @@ if !hasmapto('<Plug>(FlogToggleReflog)')
127127
endif
128128
nnoremap <buffer> <silent> <Plug>(FlogToggleReflog) :call flog#toggle_reflog_option()<CR>
129129
130+
if !hasmapto('<Plug>(FlogToggleReverse)')
131+
nmap <buffer> gsr <Plug>(FlogToggleReverse)
132+
endif
133+
nnoremap <buffer> <silent> <Plug>(FlogToggleReverse) :call flog#toggle_reverse_option()<CR>
134+
130135
if !hasmapto('<Plug>(FlogToggleNoGraph)')
131136
nmap <buffer> gx <Plug>(FlogToggleNoGraph)
132137
endif

plugin/flog.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ let g:flog_default_completion = [
8686
\ '-raw-args=',
8787
\ '-reflog ',
8888
\ '-rev=',
89+
\ '-reverse',
8990
\ '-search=',
9091
\ '-skip='
9192
\ ]

0 commit comments

Comments
 (0)