diff options
| author | TJ DeVries <devries.timothyj@gmail.com> | 2020-08-27 23:37:41 -0400 |
|---|---|---|
| committer | TJ DeVries <devries.timothyj@gmail.com> | 2020-08-27 23:37:41 -0400 |
| commit | 5eb1971dd89b11c8262d8857435944be2832ee85 (patch) | |
| tree | cccc77f78d66d50c61ddc68d9cfd2b69f3d173fe /lua/telescope/builtin.lua | |
| parent | 4100795d0ca64b2afd073e90435374a16f3ae962 (diff) | |
feat: no preview option
Diffstat (limited to 'lua/telescope/builtin.lua')
| -rw-r--r-- | lua/telescope/builtin.lua | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lua/telescope/builtin.lua b/lua/telescope/builtin.lua index 9ff8f2b..a1e8437 100644 --- a/lua/telescope/builtin.lua +++ b/lua/telescope/builtin.lua @@ -11,7 +11,19 @@ local sorters = require('telescope.sorters') local builtin = {} -builtin.git_files = function() +local ifnil = function(x, was_nil, was_not_nil) + if x == nil then + return was_nil + else + return was_not_nil + end +end + +builtin.git_files = function(opts) + opts = opts or {} + + local show_preview = ifnil(opts.show_preview, true, opts.show_preview) + -- TODO: Auto select bottom row -- TODO: filter out results when they don't match at all anymore. @@ -29,7 +41,7 @@ builtin.git_files = function() local file_previewer = previewers.cat local file_picker = pickers.new { - previewer = file_previewer + previewer = show_preview and file_previewer, } -- local file_sorter = telescope.sorters.get_ngram_sorter() |
