Skip to content

Commit

Permalink
Improve hide_source_names behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
Shougo committed Mar 8, 2015
1 parent f957aca commit 0eb368a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion autoload/unite/candidates.vim
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ function! s:recache_candidates_loop(context, is_force) "{{{
endif
endfor

if !a:context.hide_source_names && len(unite.sources) > 1
if !a:context.hide_source_names
let unite.max_source_name =
\ max(map(candidate_sources, 'len(v:val)')) + 1
endif
Expand Down
4 changes: 4 additions & 0 deletions autoload/unite/init.vim
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ function! unite#init#_context(context, ...) "{{{
if context.path != '' && context.path !~ '/$'
let context.path .= '/'
endif
if len(source_names) == 1
\ && !get(context, 'no_hide_source_names', 0)
let context.hide_source_names = 1
endif

let context.is_changed = 0

Expand Down
3 changes: 2 additions & 1 deletion doc/unite.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1876,7 +1876,8 @@ the context dictionary.
-hide-source-names
Hides source names.
Note: Source highlight will be overwritten by other sources.
Default: no-hide-source-names
Default: no-hide-source-names (single source)
hide-source-names (multiple sources)

*unite-options-max-multi-lines*
-max-multi-lines={max-lines}
Expand Down

0 comments on commit 0eb368a

Please sign in to comment.