diff options
| author | TJ DeVries <devries.timothyj@gmail.com> | 2020-08-28 00:32:55 -0400 |
|---|---|---|
| committer | TJ DeVries <devries.timothyj@gmail.com> | 2020-08-28 00:32:55 -0400 |
| commit | 1278173acf49fa2910832df282460d8e1f6bfbbd (patch) | |
| tree | 5c2e64bbc6dbb6d7819f336c6e9cc4211aa6e2ca /lua | |
| parent | f2fcdcb6751701db94236d534db72346f7c118d6 (diff) | |
Add devicons if u got em. Rockerboo plz adds docs. Much love. Bed time NOW!
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/telescope/pickers.lua | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lua/telescope/pickers.lua b/lua/telescope/pickers.lua index b5e418a..3350192 100644 --- a/lua/telescope/pickers.lua +++ b/lua/telescope/pickers.lua @@ -10,6 +10,8 @@ local Entry = require('telescope.entry') local Sorter = require('telescope.sorters').Sorter local Previewer = require('telescope.previewers').Previewer +local has_devicons, devicons = pcall(require, 'nvim-web-devicons') + local pickers = {} local ifnil = function(x, was_nil, was_not_nil) if x == nil then return was_nil else return was_not_nil end end @@ -191,8 +193,15 @@ function Picker:find(opts) return end + local display = entry.display + + if has_devicons then + local icon = devicons.get_icon(display, vim.fn.fnamemodify(display, ":e")) + display = (icon or ' ') .. ' ' .. display + end + -- log.info("Setting row", row, "with value", entry) - vim.api.nvim_buf_set_lines(results_bufnr, row, row + 1, false, {entry.display}) + vim.api.nvim_buf_set_lines(results_bufnr, row, row + 1, false, {display}) end )) |
