Skip to content

Commit

Permalink
add --auto-preview as per Yggdroot#882
Browse files Browse the repository at this point in the history
  • Loading branch information
Yggdroot committed Apr 4, 2022
1 parent be58cc3 commit 8d143ac
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ optional arguments:
specifies the width of popup window, only available in popup mode.
--no-sort do not sort the result.
--case-insensitive fuzzy search case insensitively.
--auto-preview open preview window automatically.

subcommands:

Expand Down
1 change: 1 addition & 0 deletions autoload/leaderf/Any.vim
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ let g:Lf_CommonArguments = [
\ {"name": ["--popup-width"], "nargs": 1, "help": "specifies the width of popup window, only available in popup mode."},
\ {"name": ["--no-sort"], "nargs": 0, "help": "do not sort the result."},
\ {"name": ["--case-insensitive"], "nargs": 0, "help": "fuzzy search case insensitively."},
\ {"name": ["--auto-preview"], "nargs": 0, "help": "open preview window automatically."},
\]

" arguments is something like g:Lf_CommonArguments
Expand Down
3 changes: 3 additions & 0 deletions autoload/leaderf/python/leaderf/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,9 @@ def _needPreview(self, preview):
preview:
if True, always preview the result no matter what `g:Lf_PreviewResult` is.
"""
if "--auto-preview" in self._arguments:
return True

preview_dict = {k.lower(): v for k, v in lfEval("g:Lf_PreviewResult").items()}
category = self._getExplorer().getStlCategory()
if not preview and int(preview_dict.get(category.lower(), 0)) == 0:
Expand Down

0 comments on commit 8d143ac

Please sign in to comment.