diff options
| author | kkharji <kkharji@protonmail.com> | 2022-11-23 19:26:29 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-23 17:26:29 +0100 |
| commit | 5e16fbc8eac42280ae6e18ca38098a833c5e08ba (patch) | |
| tree | 48c8ad555ee385302d0f1be6a8d4501e3a28d7c7 /doc | |
| parent | 7a4ffef931769c3fe7544214ed7ffde5852653f6 (diff) | |
feat(picker): command history filter (#2132)
* feat(picker): command history filter
I've recently start using command history. For sometime was a bit annoyed of unrelevant commands
like edit/write and others (most likely only used once)
I've considered using lua patterns, however, logical `or` isn't a thing. Additionally, passing a list of lua patterns and checking each pattern for each command history entry felt tedious.
This PR introduce a new optional function to filter command history items.
For example, in my configurations
~~~lua
local command_history_ignore = vim.regex "edit\\|Move\\|write\\|Write\\|e\\s\\|lua\\sI("
overrides.command_history = minimal {
prompt_prefix = "CMDHistory> ",
filter_fn = function(item)
if #item < 3 then
return false
else
return not command_history_ignore:match_str(item)
end
end,
}
~~~
* [docgen] Update doc/telescope.txt
skip-checks: true
Co-authored-by: Github Actions <actions@github>
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/telescope.txt | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/doc/telescope.txt b/doc/telescope.txt index 42e1006..6bb4947 100644 --- a/doc/telescope.txt +++ b/doc/telescope.txt @@ -1213,6 +1213,10 @@ builtin.command_history({opts}) *telescope.builtin.command_history()* Parameters: ~ {opts} (table) options to pass to the picker + Options: ~ + {filter_fn} (function) filter fn(cmd:string). true if the history + command should be presented. + builtin.search_history({opts}) *telescope.builtin.search_history()* Lists searches that were executed recently, and reruns them on `<cr>` |
