Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(picker): allow appending original window <cWORD>, <cfile> and cursor line to prompt #3134

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
doc(picker): add docs for added actions
Change-Id: I8dffb8bf7cfd5eae41522840a12d0d91af8dc9ed
  • Loading branch information
younger-1 committed May 27, 2024
commit 9f2e6b1603f07ee912b00db98a9a05d5d6379f55
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ Many familiar mapping patterns are set up as defaults.
| `<C-q>` | Send all items not filtered to quickfixlist (qflist) |
| `<M-q>` | Send all selected items to qflist |
| `<C-r><C-w>` | Insert cword in original window into prompt (insert mode) |
| `<C-r><C-e>` | Insert cWORD in original window into prompt (insert mode) |
| `<C-r><C-l>` | Insert line in original window into prompt (insert mode) |

To see the full list of mappings, check out `lua/telescope/mappings.lua` and the
`default_mappings` table.
Expand Down
4 changes: 4 additions & 0 deletions lua/telescope/actions/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1496,11 +1496,15 @@ actions.insert_original_cword = function(prompt_bufnr)
current_picker:set_prompt(current_picker.original_cword, false)
end

--- Insert the WORD under the cursor of the original (pre-Telescope) window
---@param prompt_bufnr number: The prompt bufnr
actions.insert_original_cWORD = function(prompt_bufnr)
local current_picker = action_state.get_current_picker(prompt_bufnr)
current_picker:set_prompt(current_picker.original_cWORD, false)
end

--- Insert the line under the cursor of the original (pre-Telescope) window
---@param prompt_bufnr number: The prompt bufnr
actions.insert_original_cline = function(prompt_bufnr)
local current_picker = action_state.get_current_picker(prompt_bufnr)
current_picker:set_prompt(current_picker.original_cline, false)
Expand Down