feat(config): allow the configuration of filename modifiers#983
Open
ffknob wants to merge 1 commit intofolke:mainfrom
Open
feat(config): allow the configuration of filename modifiers#983ffknob wants to merge 1 commit intofolke:mainfrom
ffknob wants to merge 1 commit intofolke:mainfrom
Conversation
Contributor
|
This PR is stale because it has been open 30 days with no activity. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Just a tweak I've came up with. I work in some Java projects in which my files are stored deeply in the directories structure. When triggering the buffers UI in my Lazyvim (
<leader>b) I'm not able to see the filename because it is hidden by the UI's width limitation.I discovered that the filename used in the buffers list is actually defined through the fnamemodify() Vim function, which takes a string as argument with some pattern that will convert the full path of the file in many ways, including just the filename, which is what I prefer.
The PR changes the defaults config object so a new
filename_modifierparameter could be set by the user. This value will then be used in thebufname()function, keeping the current ":~:." pattern as a default.After changing the plugin's code I'm now able to have the following config customization file in my Lazyvim:
{ "folke/which-key.nvim", opts = { filename_modifier = ":t." }, }, }Now instead of having this in my buffers menu...
...I can easily identify the buffers by its names:
I don't know if there was another easier way to achieve the same thing, just went ahead with this tweak and it'sworking for me.
Related Issue(s)
Screenshots