Skip to content

Commit

Permalink
Use --sourced instead of --self (functionality reversed).
Browse files Browse the repository at this point in the history
This naming more closely matches the behavior. With --no-self, self
timings were still utilized (as part of self+sourced). Now, with
--no-sourced, source timings are not utilized.
  • Loading branch information
dstein64 committed Jul 26, 2021
1 parent a35b775 commit 6190857
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
12 changes: 6 additions & 6 deletions autoload/startuptime.vim
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ function! s:Augment(items, options) abort
let l:result = deepcopy(a:items)
for l:item in l:result
if l:item.type ==# s:sourcing_event_type
let l:key = a:options.self ? 'self' : 'self+sourced'
let l:key = a:options.sourced ? 'self+sourced' : 'self'
elseif l:item.type ==# s:other_event_type
let l:key = 'elapsed'
else
Expand Down Expand Up @@ -915,7 +915,7 @@ function! s:Options(args) abort
let l:options = {
\ 'help': 0,
\ 'other_events': g:startuptime_other_events,
\ 'self': g:startuptime_self,
\ 'sourced': g:startuptime_sourced,
\ 'sort': g:startuptime_sort,
\ 'sourcing_events': g:startuptime_sourcing_events,
\ 'tries': g:startuptime_tries,
Expand All @@ -931,8 +931,8 @@ function! s:Options(args) abort
break
elseif l:arg ==# '--other-events' || l:arg ==# '--no-other-events'
let l:options.other_events = l:arg ==# '--other-events'
elseif l:arg ==# '--self' || l:arg ==# '--no-self'
let l:options.self = l:arg ==# '--self'
elseif l:arg ==# '--sourced' || l:arg ==# '--no-sourced'
let l:options.sourced = l:arg ==# '--sourced'
elseif l:arg ==# '--sort' || l:arg ==# '--no-sort'
let l:options.sort = l:arg ==# '--sort'
elseif l:arg ==# '--sourcing-events' || l:arg ==# '--no-sourcing-events'
Expand Down Expand Up @@ -963,7 +963,7 @@ function! startuptime#CompleteOptions(...) abort
let l:args = [
\ '--help',
\ '--other-events', '--no-other-events',
\ '--self', '--no-self',
\ '--sourced', '--no-sourced',
\ '--sort', '--no-sort',
\ '--sourcing-events', '--no-sourcing-events',
\ '--tries',
Expand All @@ -976,7 +976,7 @@ endfunction
" \ [--sort] [--no-sort]
" \ [--sourcing-events] [--no-sourcing-events]
" \ [--other-events] [--no-other-events]
" \ [--self] [--no-self]
" \ [--sourced] [--no-sourced]
" \ [--tries INT]
function! startuptime#StartupTime(mods, ...) abort
if !has('nvim') && !has('terminal')
Expand Down
13 changes: 7 additions & 6 deletions doc/startuptime.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,16 @@ Arguments ~
events are included.
* `--other-events` and `--no-other-events` specify whether other events
are included.
* `--self` and `--no-self` specify whether to use 'self' timings for sourcing
events (otherwise, 'self+sourced' timings are used).
* `--sourced` and `--no-sourced` specify whether to use 'self+sourced' timings
for sourcing events (otherwise, 'self' timings are used).
* `--tries` specifies how many startup times are averaged.
* `--help` shows this help documentation.
>
:StartupTime
\ [--sort] [--no-sort]
\ [--sourcing-events] [--no-sourcing-events]
\ [--other-events] [--no-other-events]
\ [--self] [--no-self]
\ [--sourced] [--no-sourced]
\ [--tries INT]
\ [--help]
Expand Down Expand Up @@ -114,9 +114,10 @@ than these options.
*g:startuptime_other_events* `1`
Specifies whether other events are
are included
*g:startuptime_self* `0`
Specifies whether to use 'self'
timings for sourcing events
*g:startuptime_sourced* `1`
Specifies whether to include
'sourced' timings (in addition to
'self' timings) for sourcing events
*g:startuptime_event_width* `20`
Event column width
*g:startuptime_time_width* `6`
Expand Down
2 changes: 1 addition & 1 deletion doc/tags
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ g:startuptime_more_info_key_seq startuptime.txt /*g:startuptime_more_info_key_se
g:startuptime_other_events startuptime.txt /*g:startuptime_other_events*
g:startuptime_percent_width startuptime.txt /*g:startuptime_percent_width*
g:startuptime_plot_width startuptime.txt /*g:startuptime_plot_width*
g:startuptime_self startuptime.txt /*g:startuptime_self*
g:startuptime_sort startuptime.txt /*g:startuptime_sort*
g:startuptime_sourced startuptime.txt /*g:startuptime_sourced*
g:startuptime_sourcing_events startuptime.txt /*g:startuptime_sourcing_events*
g:startuptime_split_edit_key_seq startuptime.txt /*g:startuptime_split_edit_key_seq*
g:startuptime_startup_indent startuptime.txt /*g:startuptime_startup_indent*
Expand Down
4 changes: 4 additions & 0 deletions plugin/startuptime.vim
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ let g:startuptime_sort = get(g:, 'startuptime_sort', 1)
let g:startuptime_tries = get(g:, 'startuptime_tries', 1)
let g:startuptime_sourcing_events = get(g:, 'startuptime_sourcing_events', 1)
let g:startuptime_other_events = get(g:, 'startuptime_other_events', 1)
" '--self' was removed, with '--sourced' being used now to control the same
" setting (but reversed). The following handling allows configurations to
" continue working if 'startuptime_self' was specified.
let g:startuptime_self = get(g:, 'startuptime_self', 0)
let g:startuptime_sourced = get(g:, 'startuptime_sourced', !g:startuptime_self)

let g:startuptime_startup_indent =
\ get(g:, 'startuptime_startup_indent', 7)
Expand Down

0 comments on commit 6190857

Please sign in to comment.