diff options
| author | oberblastmeister <61095988+oberblastmeister@users.noreply.github.com> | 2021-01-05 02:50:44 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-05 08:50:44 +0100 |
| commit | f750159203077b00cecdd9f68c254aa70d10f879 (patch) | |
| tree | f0f75896f15cb4d8fb31ac5f30beeccf2e5414e3 /lua | |
| parent | 9503603f888305ec799c9346f51a6e3da7f5b89b (diff) | |
feat: add actions.get_current_line (#391)
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/telescope/actions/init.lua | 4 | ||||
| -rw-r--r-- | lua/telescope/pickers.lua | 3 |
2 files changed, 7 insertions, 0 deletions
diff --git a/lua/telescope/actions/init.lua b/lua/telescope/actions/init.lua index fdd400c..6ffb3ef 100644 --- a/lua/telescope/actions/init.lua +++ b/lua/telescope/actions/init.lua @@ -43,6 +43,10 @@ function actions.get_selected_entry() return state.get_global_key('selected_entry') end +function actions.get_current_line() + return state.get_global_key('current_line') +end + function actions.preview_scrolling_up(prompt_bufnr) actions.get_current_picker(prompt_bufnr).previewer:scroll_fn(-30) end diff --git a/lua/telescope/pickers.lua b/lua/telescope/pickers.lua index 96af5b6..67553c2 100644 --- a/lua/telescope/pickers.lua +++ b/lua/telescope/pickers.lua @@ -524,6 +524,9 @@ function Picker:find() error('Unknown selection strategy: ' .. selection_strategy) end + local current_line = vim.api.nvim_get_current_line():sub(self.prompt_prefix:len() + 1) + state.set_global_key('current_line', current_line) + self:clear_extra_rows(results_bufnr) self:highlight_displayed_rows(results_bufnr, prompt) |
