nvim-telescope / telescope.nvim

Find, Filter, Preview, Pick. All lua, all the time.
MIT License
15.69k stars 830 forks source link

How to change tags picker's file path width? #1820

Closed crusj closed 2 years ago

crusj commented 2 years ago

Description

I can not find the way by docs

Neovim version

0.6.1

Operating system and version

macos 12.0.1

checkhealth telescope

-- This file can be loaded by calling `lua require('plugins')` from your init.vim

-- Only required if you have packer configured as `opt`
vim.cmd [[packadd packer.nvim]]

return require('packer').startup(function()
  -- Packer can manage itself
    use 'wbthomason/packer.nvim'
    use 'neovim/nvim-lspconfig' -- Collection of configurations for the built-in LSP client
    use 'kyazdani42/nvim-web-devicons'
    use 'overcache/NeoSolarized'
    use {'neoclide/coc.nvim', branch = 'release'}
    use 'gfanto/fzf-lsp.nvim'
    use 'nvim-treesitter/nvim-treesitter'
    use {
        'nvim-lualine/lualine.nvim',
        requires = { 'kyazdani42/nvim-web-devicons', opt = true }
    }
    use {
        'kyazdani42/nvim-tree.lua',
        requires = {
            'kyazdani42/nvim-web-devicons', -- optional, for file icon
        },
        config = function() require'nvim-tree'.setup {} end
    }
    use 'bagrat/vim-buffet'
    use 'voldikss/vim-floaterm'
    use 'nvim-lua/plenary.nvim'
    use 'hoschi/yode-nvim'
    use {
        'nvim-telescope/telescope.nvim',
        requires = { {'nvim-lua/plenary.nvim'}
    },
    use {
        'nvim-telescope/telescope-fzf-native.nvim',
        run = 'make' 
    }
}
end)

Steps to reproduce

:Telescope tags

Expected behavior

No response

Actual behavior

图片

Minimal config

-- This file can be loaded by calling `lua require('plugins')` from your init.vim

-- Only required if you have packer configured as `opt`
vim.cmd [[packadd packer.nvim]]

return require('packer').startup(function()
  -- Packer can manage itself
    use 'wbthomason/packer.nvim'
    use 'neovim/nvim-lspconfig' -- Collection of configurations for the built-in LSP client
    use 'kyazdani42/nvim-web-devicons'
    use 'overcache/NeoSolarized'
    use {'neoclide/coc.nvim', branch = 'release'}
    use 'gfanto/fzf-lsp.nvim'
    use 'nvim-treesitter/nvim-treesitter'
    use {
        'nvim-lualine/lualine.nvim',
        requires = { 'kyazdani42/nvim-web-devicons', opt = true }
    }
    use {
        'kyazdani42/nvim-tree.lua',
        requires = {
            'kyazdani42/nvim-web-devicons', -- optional, for file icon
        },
        config = function() require'nvim-tree'.setup {} end
    }
    use 'bagrat/vim-buffet'
    use 'voldikss/vim-floaterm'
    use 'nvim-lua/plenary.nvim'
    use 'hoschi/yode-nvim'
    use {
        'nvim-telescope/telescope.nvim',
        requires = { {'nvim-lua/plenary.nvim'}
    },
    use {
        'nvim-telescope/telescope-fzf-native.nvim',
        run = 'make' 
    }
}
end)
Conni2461 commented 2 years ago

currently hardcoded. https://github.com/nvim-telescope/telescope.nvim/blob/master/lua/telescope/make_entry.lua#L921

Good first issue could be an additional options that you can access from opts.

ankush commented 2 years ago

was unrelated so opened new issue: https://github.com/nvim-telescope/telescope.nvim/issues/1834

crusj commented 2 years ago

currently hardcoded. https://github.com/nvim-telescope/telescope.nvim/blob/master/lua/telescope/make_entry.lua#L921

Good first issue could be an additional options that you can access from opts.

IThanks, I adjusted it manually

KiLLeRRaT commented 9 months ago

I know this is old, but I've just created a quick custom function which will set my fname_width based on my current tmux pane width, so I can always have fname_width as a proportion of my current pane width.

Thought it could be useful to someone.

M.lsp_references = function()
    -- get pane width from tmux and use half the width for the fname_width
    local fname_width = math.floor(vim.fn.system("tmux display -p '#{pane_width}'") / 2)
    -- Maybe running outside of tmux
    if fname_width == 0 then
        fname_width = 30
    end
    require('telescope.builtin').lsp_references({fname_width = fname_width })
end
jamestrew commented 9 months ago

we just recently merged into master a change to remove the fname_width option from many pickers due to how clumsy having <file path> | <line text> looked. This led to fname_width never being great. Always cutting out the path or taking too much space and leaving a bunch of whitespace. Going forward, the file path and the text are shown as one concatenated string like so image

https://github.com/nvim-telescope/telescope.nvim/pull/2842

KiLLeRRaT commented 9 months ago

we just recently merged into master a change to remove the fname_width option from many pickers due to how clumsy having <file path> | <line text> looked. This led to fname_width never being great. Always cutting out the path or taking too much space and leaving a bunch of whitespace. Going forward, the file path and the text are shown as one concatenated string like so image

2842

Hi @jamestrew that looks nice! And eliminates the whole problem. I'm looking forward to using that in the future :)

Cheers,