From 32f4b59ea10921d8699c2f649a3ad1bc047b00f5 Mon Sep 17 00:00:00 2001 From: Munif Tanjim Date: Fri, 12 Aug 2022 19:42:45 +0600 Subject: [PATCH] feat: support opts.workspace (#68) --- README.md | 18 ++++++++++++++++-- lua/telescope/_extensions/frecency.lua | 2 +- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b5ee199..43cc0af 100644 --- a/README.md +++ b/README.md @@ -85,14 +85,28 @@ If no database is found when running Neovim with the plugin installed, a new one ## Usage -``` +```vim :Telescope frecency ``` -..or to map to a key: + +or to map to a key: ```lua vim.api.nvim_set_keymap("n", "", "lua require('telescope').extensions.frecency.frecency()", {noremap = true, silent = true}) ``` + +Use a specific workspace tag: + +```vim +:Telescope frecency workspace=CWD +``` + +or + +```lua +vim.api.nvim_set_keymap("n", "", "lua require('telescope').extensions.frecency.frecency({ workspace = 'CWD' })", {noremap = true, silent = true}) +``` + Filter tags are applied by typing the `:tag:` name (adding surrounding colons) in the finder query. Entering `:` will trigger omnicompletion for available tags. diff --git a/lua/telescope/_extensions/frecency.lua b/lua/telescope/_extensions/frecency.lua index 1a26738..8acc3f6 100644 --- a/lua/telescope/_extensions/frecency.lua +++ b/lua/telescope/_extensions/frecency.lua @@ -194,7 +194,7 @@ local frecency = function(opts) if matched then query_text = query_text:sub(matched:len() + 1) end - new_filter = new_filter or state.default_workspace + new_filter = new_filter or opts.workspace or state.default_workspace local new_finder local results_updated = update_results(new_filter)