diff options
| author | TJ DeVries <devries.timothyj@gmail.com> | 2020-09-05 07:34:38 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-05 07:34:38 -0400 |
| commit | c70d6e58a0ab09db1ee57aded0695d350db2dd83 (patch) | |
| tree | 7215ab223c65788c9218923f6c7ee0c61550991c /lua/telescope/make_entry.lua | |
| parent | 4abb5f7867fb087aa69bcd49d40537609a1e2e46 (diff) | |
feat: add buffer list (#30)
NOTE: Buffer entry sometimes uses unstyled window, and I can't figure out why.
* feat: add buffers
* fixup
Diffstat (limited to 'lua/telescope/make_entry.lua')
| -rw-r--r-- | lua/telescope/make_entry.lua | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lua/telescope/make_entry.lua b/lua/telescope/make_entry.lua index 09c7d30..7c35699 100644 --- a/lua/telescope/make_entry.lua +++ b/lua/telescope/make_entry.lua @@ -169,4 +169,26 @@ function make_entry.gen_from_quickfix(opts) end end +function make_entry.gen_from_buffer(opts) + return function(entry) + local bufnr_str = tostring(entry) + local bufname = vim.api.nvim_buf_get_name(entry) + + if '' == bufname then + return nil + end + + return { + valid = true, + + value = bufname, + ordinal = bufnr_str .. " : " .. bufname, + display = bufnr_str .. " : " .. bufname, + + bufnr = entry, + filename = bufname, + } + end +end + return make_entry |
