nvim-telescope / telescope.nvim

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

Display line number with filename when using `filename_first` #3156

Open mehalter opened 1 month ago

mehalter commented 1 month ago

Is your feature request related to a problem? Please describe.

When I'm using the relatively new filename_first path_display option, specifically with the buffer picker, it can be a bit jarring when the line number is displayed after the path rather than after the filename.

2024-06-07_11:07:27_screenshot

The line number is really "operating" on the filename and not on the directory. Also because the directory highlighting most of the time is a bit more dimmed than the filename and the line number they feel a bit separated for the two parts that are being shown as the "most important"

Describe the solution you'd like

Add a configuration option similar to the reverse_directories to relocate the line number displaying to be next to the filename.

rather than being something like

utils.lua lua/telescope:686

It would be displayed as

utils.lua:686 lua/telescope

Describe alternatives you've considered

I believe there is a solution to be able to implement this as a custom make_entry function but this takes some deep understanding of how to write these functions for a small change. Also I think this could be something that many people may find benefit in which makes it seem like it would be a good option to include

jamestrew commented 1 month ago

No I agree, the current behavior wasn't meant to be a long term thing.

leet0rz commented 2 weeks ago

Sorry to ask here but I filename_first does not seem to be working for me, I recently updated to the latest telescope. This is the correct code right?:

require("telescope").setup {
    defaults = {
        path_display = {
            filename_first = {
                reverse_directories = false,
            }
        },
        sorting_strategy = "ascending",
        layout_strategy = "horizontal",
        layout_config = {
            horizontal = {
                prompt_position = "top",
            }
        },
    },
}

Thanks.