feat: support opts.workspace (#68)

This commit is contained in:
Munif Tanjim 2022-08-12 19:42:45 +06:00 committed by GitHub
parent 388016c512
commit 32f4b59ea1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 3 deletions

View File

@ -85,14 +85,28 @@ If no database is found when running Neovim with the plugin installed, a new one
## Usage ## Usage
``` ```vim
:Telescope frecency :Telescope frecency
``` ```
..or to map to a key:
or to map to a key:
```lua ```lua
vim.api.nvim_set_keymap("n", "<leader><leader>", "<Cmd>lua require('telescope').extensions.frecency.frecency()<CR>", {noremap = true, silent = true}) vim.api.nvim_set_keymap("n", "<leader><leader>", "<Cmd>lua require('telescope').extensions.frecency.frecency()<CR>", {noremap = true, silent = true})
``` ```
Use a specific workspace tag:
```vim
:Telescope frecency workspace=CWD
```
or
```lua
vim.api.nvim_set_keymap("n", "<leader><leader>", "<Cmd>lua require('telescope').extensions.frecency.frecency({ workspace = 'CWD' })<CR>", {noremap = true, silent = true})
```
Filter tags are applied by typing the `:tag:` name (adding surrounding colons) in the finder query. Filter tags are applied by typing the `:tag:` name (adding surrounding colons) in the finder query.
Entering `:<Tab>` will trigger omnicompletion for available tags. Entering `:<Tab>` will trigger omnicompletion for available tags.

View File

@ -194,7 +194,7 @@ local frecency = function(opts)
if matched then if matched then
query_text = query_text:sub(matched:len() + 1) query_text = query_text:sub(matched:len() + 1)
end end
new_filter = new_filter or state.default_workspace new_filter = new_filter or opts.workspace or state.default_workspace
local new_finder local new_finder
local results_updated = update_results(new_filter) local results_updated = update_results(new_filter)