diff options
| author | TJ DeVries <devries.timothyj@gmail.com> | 2020-09-11 15:28:32 -0400 |
|---|---|---|
| committer | TJ DeVries <devries.timothyj@gmail.com> | 2020-09-11 15:28:32 -0400 |
| commit | f47f1dc03712bf49bf278e103e5196a09c5a6210 (patch) | |
| tree | a4507c4e9152fe60e2a5646c27af6eb4e7fd03c1 /lua/telescope/make_entry.lua | |
| parent | a9404201a9ea3170d9b12620024602ed58750b1f (diff) | |
feat: make buffer work much better
Diffstat (limited to 'lua/telescope/make_entry.lua')
| -rw-r--r-- | lua/telescope/make_entry.lua | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lua/telescope/make_entry.lua b/lua/telescope/make_entry.lua index b595ffc..35fef98 100644 --- a/lua/telescope/make_entry.lua +++ b/lua/telescope/make_entry.lua @@ -180,10 +180,23 @@ function make_entry.gen_from_quickfix(opts) end function make_entry.gen_from_buffer(opts) + local get_position = function(entry) + local tabpage_wins = vim.api.nvim_tabpage_list_wins(0) + for k, v in ipairs(tabpage_wins) do + if entry == vim.api.nvim_win_get_buf(v) then + return vim.api.nvim_win_get_cursor(v) + end + end + + return {} + end + return function(entry) local bufnr_str = tostring(entry) local bufname = vim.api.nvim_buf_get_name(entry) + local position = get_position(entry) + if '' == bufname then return nil end @@ -197,6 +210,8 @@ function make_entry.gen_from_buffer(opts) bufnr = entry, filename = bufname, + + lnum = position[1] or 1, } end end |
