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

Adds option to reverse the path_display #3005

Closed
wants to merge 4 commits into from

Conversation

alycklama
Copy link
Contributor

Description

Long paths make it sometimes difficult to see the file name. You can create a custom formatter, but I thought it would be great if we can have a format similar to Intelij, where the file name is in front.

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

I've tested my code with the following configurations:

Simple config:

          path_display = {
            "reverse"
          },
image

Extended config:

          path_display = {
            reverse = {
              file_sep = " ",
              dir_open_sep = "(",
              dir_close_sep = ")",
            }
          },
image

Configuration:

  • Neovim version (nvim --version): NVIM v0.9.5 | Build type: Release | LuaJIT 2.1.1710088188
  • Operating system and version: MacOs 13.6.4 (22G513)

Checklist:

  • [ x ] My code follows the style guidelines of this project (stylua)
  • [ x ] I have performed a self-review of my own code
  • [ x ] I have commented my code, particularly in hard-to-understand areas
  • [ x ] I have made corresponding changes to the documentation (lua annotations)

Copy link
Contributor

@jamestrew jamestrew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, something like this has been a pretty heavily requested feature.
#2014

I think ideally, we'd like to have some highlighting added to this like shown in the many examples in that issue but I think this is a start.

Some other thoughts:

  • you'll need to recreate the PR against the master branch - we don't really merge PRs into 0.1.x much less new feature
  • I'm working through some Windows related bugs related to path_display so until I finish that, this PR will likely be on hold

lua/telescope/utils.lua Show resolved Hide resolved
@@ -130,6 +130,29 @@ utils.filter_symbols = function(results, opts)
end
end

utils.path_reverse = (function(filepath, file_sep, dir_open_sep, dir_close_sep)
local dirs = vim.split(filepath, "/")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wouldn't be compatible on Windows with how we currently preserve backslash path separators for Windows.

@alycklama
Copy link
Contributor Author

I've opened a new PR based on master:
#3010

@alycklama alycklama closed this Mar 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants