Skip to content

Commit

Permalink
feat: support opts.workspace (nvim-telescope#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
MunifTanjim authored and astutecat committed Sep 30, 2022
1 parent a993df7 commit 588267e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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", "<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.
Entering `:<Tab>` will trigger omnicompletion for available tags.

Expand Down
2 changes: 1 addition & 1 deletion lua/telescope/_extensions/frecency.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 588267e

Please sign in to comment.