Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filename_first doesn't works with buffer list #3157

Open
Wordluc opened this issue Jun 7, 2024 · 2 comments
Open

filename_first doesn't works with buffer list #3157

Wordluc opened this issue Jun 7, 2024 · 2 comments
Labels
bug Something isn't working Windows Relates to window operating system

Comments

@Wordluc
Copy link

Wordluc commented Jun 7, 2024

Description

When using Telescope.nvim to display buffers, the buffer list does not show the file names first. This issue occurs even though the path_display option is set to show file names first (for files/grep, this setting works correctly).

image

Neovim version

NVIM v0.9.5
Build type: RelWithDebInfo
LuaJIT 2.1.1703942320

Operating system and version

Windows 11

Telescope version / branch / rev

master

checkhealth telescope

Checking for required plugins ~
- OK plenary installed.
- OK nvim-treesitter installed.

Checking external dependencies ~
- OK rg: found ripgrep 14.1.0 (rev e50df40a19)
- WARNING fd: not found. Install [sharkdp/fd](https://github.com/sharkdp/fd) for extended capabilities

Steps to reproduce

set the options
path_display = { filename_first = { reverse_directories = false } }
after (restart nvim), the options is applied of the other search but buffer

Expected behavior

see each each buffer with the name first

Actual behavior

some buffer have the name first other not

Minimal config

require("telescope").setup {
	defaults = {
		path_display = {
			filename_first = {
				reverse_directories = false
			}
		},
		file_ignore_patterns = { "./^.git/*", "./node_modules/*", "node_modules", "^node_modules/*", "node_modules/*" },
	} 
}
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
vim.keymap.set('n', '<leader>fvv', function()
	builtin.grep_string({ search = vim.fn.input("Grep > ") })
end)
vim.keymap.set('v', '<leader>fvv', function()
	vim.cmd('noau normal! "ay"')
	builtin.grep_string({ search = vim.fn.getreg("a") })
end)
vim.keymap.set('n', '<leader>fb', function()
	builtin.buffers({ sort_mru = true })
end)

vim.keymap.set('n', '<leader>fg', function()
	builtin.lsp_references()
end)
vim.keymap.set('n', '<leader>fv', builtin.live_grep, {})

vim.keymap.set('n', '<leader>fs', builtin.tagstack, {})

@Wordluc Wordluc added the bug Something isn't working label Jun 7, 2024
@Wordluc
Copy link
Author

Wordluc commented Jun 7, 2024

Bug:
Basically, the path sometimes uses "/" and other times "\". The firstname option works with "\", so I replaced "/" with "\". After that, the option works correctly.
I modified the file: __internal.lua.

Temporary solution used:

		local info = vim.fn.getbufinfo(bufnr)[1]
		info.name = info.name:gsub("[/]", "\\")
		local element = {
			bufnr = bufnr,
			flag = flag,
			info = info,
		}

@Wordluc Wordluc changed the title filename_first doentst works with buffer list filename_first doesn't works with buffer list Jun 8, 2024
@jamestrew jamestrew added the Windows Relates to window operating system label Jun 9, 2024
@Wordluc
Copy link
Author

Wordluc commented Jun 19, 2024

fixing pull request: #3176 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Windows Relates to window operating system
Projects
None yet
Development

No branches or pull requests

2 participants