You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now, if we save a session with many opened buffers (mksession) and later open all of them with "so", this snippet doesn't work very well, the buffer name gets truncated:
telescope: health#telescope#check
Checking for required plugins ~
- OK plenary installed.
- OK nvim-treesitter installed.
Checking external dependencies ~
- OK rg: found ripgrep 14.1.0
- OK fd: found fd 10.1.0
===== Installed extensions ===== ~
Telescope Extension: `advanced_git_search` ~
- No healthcheck provided
Telescope Extension: `ascii` ~
- No healthcheck provided
Telescope Extension: `color_names` ~
- No healthcheck provided
Telescope Extension: `conflicts` ~
- No healthcheck provided
Telescope Extension: `emoji` ~
- No healthcheck provided
Telescope Extension: `env` ~
- No healthcheck provided
Telescope Extension: `file_browser` ~
- No healthcheck provided
Telescope Extension: `fzf` ~
- OK lib working as expected
- OK file_sorter correctly configured
- OK generic_sorter correctly configured
Telescope Extension: `git_diffs` ~
- No healthcheck provided
Telescope Extension: `git_submodules` ~
- No healthcheck provided
Telescope Extension: `gitmoji` ~
- No healthcheck provided
Telescope Extension: `glyph` ~
- No healthcheck provided
Telescope Extension: `http` ~
- No healthcheck provided
Telescope Extension: `node_modules` ~
- No healthcheck provided
Telescope Extension: `noice` ~
- No healthcheck provided
Telescope Extension: `notify` ~
- No healthcheck provided
Telescope Extension: `recent_files` ~
- No healthcheck provided
Telescope Extension: `session-lens` ~
- No healthcheck provided
Telescope Extension: `software-licenses` ~
- No healthcheck provided
Telescope Extension: `terraform_doc` ~
- No healthcheck provided
Telescope Extension: `tmux` ~
- No healthcheck provided
Telescope Extension: `whaler` ~
- No healthcheck provided
Telescope Extension: `xray23` ~
- No healthcheck provided
Telescope Extension: `z` ~
- No healthcheck provided
Steps to reproduce
Using the referred snippet for the Telescope Buffers, open many buffers manually (2 or 3 should be enough)
Run: Telescope buffers
This works just fine and all buffers are shown. Now, continuing ...
Save session: mksession /tmp/mysession
Quit nvim
Open nvim without providing any filename
Load saved session: so /tmp/mysession
Run: Telescope buffers
The buffer names are not shown when using the snippet "to look like leaderF" .. but using the standard Telescope Buffers then it works fine.
Expected behavior
Snippet "Customize buffers display to look like LeaderF" to display the buffers names properly, as the standard "Buffers" do.
Actual behavior
Snippet "Customize buffers display to look like LeaderF" does not display buffers name, after loading a saved session.
ps:
The minimal version works fine with standard config but after adding the buffers display configuration to look like LeaderF, then "Telescope buffers" is not showing anything
Any idea what's wrong with this minimal?
Minimal config
-- I'm having some issues adding the referred snippet to this minimal-- This minimal was working fine, but after adding the referred snippet now something got brokenlocalroot=vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .reprofor_, nameinipairs { "config", "data", "state", "cache" } dovim.env[("XDG_%s_HOME"):format(name:upper())] =root.."/" ..nameend-- bootstrap lazylocallazypath=root.."/plugins/lazy.nvim"ifnotvim.uv.fs_stat(lazypath) thenvim.fn.system {
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
lazypath,
}
endvim.opt.runtimepath:prepend(lazypath)
-- install pluginslocalplugins= {
{
"nvim-telescope/telescope.nvim",
dependencies= {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons",
},
config=function()
-- ADD INIT.LUA SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUErequire("telescope").setup {
pickers= {
buffers= {
-- entry_maker = require"custom_buffers_picker".gen_from_buffer_like_leaderf()entry_maker=function ()
-- In: lua/rc/telescope/my_make_entry.lualocalmy_make_entry= {}
localdevicons=require"nvim-web-devicons"localentry_display=require("telescope.pickers.entry_display")
localfilter=vim.tbl_filterlocalmap=vim.tbl_mapfunctionmy_make_entry.gen_from_buffer_like_leaderf(opts)
opts=optsor {}
localdefault_icons, _=devicons.get_icon("file", "", {default=true})
localbufnrs=filter(function(b)
return1==vim.fn.buflisted(b)
end, vim.api.nvim_list_bufs())
localmax_bufnr=math.max(unpack(bufnrs))
localbufnr_width=#tostring(max_bufnr)
localmax_bufname=math.max(
unpack(
map(function(bufnr)
returnvim.fn.strdisplaywidth(vim.fn.fnamemodify(vim.api.nvim_buf_get_name(bufnr), ":p:t"))
end, bufnrs)
)
)
localdisplayer=entry_display.create {
separator="",
items= {
{ width=bufnr_width },
{ width=4 },
{ width=vim.fn.strwidth(default_icons) },
{ width=max_bufname },
{ remaining=true },
},
}
localmake_display=function(entry)
returndisplayer {
{entry.bufnr, "TelescopeResultsNumber"},
{entry.indicator, "TelescopeResultsComment"},
{entry.devicons, entry.devicons_highlight},
entry.file_name,
-- {entry.dir_name, "Comment"}
{entry.dir_name, "FoldColumn"}
}
endreturnfunction(entry)
localbufname=entry.info.name~="" andentry.info.nameor"[No Name]"localhidden=entry.info.hidden==1and"h" or"a"localreadonly=vim.api.nvim_buf_get_option(entry.bufnr, "readonly") and"=" or""localchanged=entry.info.changed==1and"" or""localindicator=entry.flag..hidden..readonly..changed-- local indicator = "" .. "" .. readonly .. changed-- local indicator = changedlocaldir_name=vim.fn.fnamemodify(bufname, ":p:h")
localfile_name=vim.fn.fnamemodify(bufname, ":p:t")
localicons, highlight=devicons.get_icon(bufname, string.match(bufname, "%a+$"), { default=true })
return {
valid=true,
value=bufname,
ordinal=entry.bufnr.." : " ..file_name,
display=make_display,
bufnr=entry.bufnr,
lnum=entry.info.lnum~=0andentry.info.lnumor1,
indicator=indicator,
devicons=icons,
devicons_highlight=highlight,
file_name=file_name,
dir_name=dir_name,
}
endendreturnmy_make_entryend
}
},
}
end,
},
}
require("lazy").setup(plugins, {
root=root.."/plugins",
})
The text was updated successfully, but these errors were encountered:
rodhash
changed the title
Configuration Recipes: Customize buffers display to look like LeaderF bug -- this doesn't work when loading buffers from "loadview"
Configuration Recipes: Customize buffers display to look like LeaderF bug -- this doesn't work when loading buffers from "mksession"
Aug 16, 2024
The buffer names get truncated after restoring a session:
But if I go back to the standard config, buffer names appear as expected (not truncated):
My main issue with the standard config (which works fine) is, sometimes it shows long path before the filename.. so it gets messy .. that's why I'm looking for the leaderF style
Hmm... I'm not able to replace this
Looks like the custom gen_from_buffers_like_leaderf is handling the getting of the buffer filename with the longest length.
You may need to do some debugging on your end.
Alternatively, on the master branch, there is a path_display = { 'filename_first' } option that yields similar results.
eg: :Telescope buffers path_display={'filename_first'}
Description
This snippet below works just fine if we open many buffers manually:
https://github.com/nvim-telescope/telescope.nvim/wiki/Configuration-Recipes#customize-buffers-display-to-look-like-leaderf
For instance:
Now, if we save a session with many opened buffers (mksession) and later open all of them with "so", this snippet doesn't work very well, the buffer name gets truncated:
Neovim version
Operating system and version
macOS 14.6.1
Telescope version / branch / rev
0.1.8
checkhealth telescope
Steps to reproduce
Telescope buffers
This works just fine and all buffers are shown. Now, continuing ...
Telescope buffers
The buffer names are not shown when using the snippet "to look like leaderF" .. but using the standard Telescope Buffers then it works fine.
Expected behavior
Snippet "Customize buffers display to look like LeaderF" to display the buffers names properly, as the standard "Buffers" do.
Actual behavior
Snippet "Customize buffers display to look like LeaderF" does not display buffers name, after loading a saved session.
ps:
The minimal version works fine with standard config but after adding the buffers display configuration to look like LeaderF, then "Telescope buffers" is not showing anything
Any idea what's wrong with this minimal?
Minimal config
The text was updated successfully, but these errors were encountered: