cybu.nvim
cybu.nvim copied to clipboard
feat: add an option to make the path `shortened`
Added an option to make the path shortened.
Hey, this looks cool, and I'm inclined to merge it with some minor changes. Are you OK with implementing some suggestions, I make, and we merge it then?
Ofc! Glad you like it.
Great! I would like to synchronize the looks with the shorten
option of telescope.
Here are pics for comparison:
Notable differences, telescope (upper image) only uses the relative paths, when shorten
is set, adds the first char after an .
for a dot directory and per default the /
separator is displayed on Linux.
To keep the combination absolute + shorten, one could implement the shorten functionality under a new option key, e.g., style = { shorten_path = true/false }
or style = { path_abbreviation = 'shorten'/'default' }
, to make it easier to implement another abbreviation variant (like telescope's 'smart'
) in the future.
I think the last one is a bug, vim.fn.has('win32')
returns "0" on Linux, which is truthy in Lua.
If I understand you correctly, you want to:
- have an option to make the path relative and absolute
- make some minor changes (fixes, naming, change the location of the functions, etc.)
If that's so - I'll surely do the second, but I think that adding an option for relative and absolute path is for another PR.
It'd be lovely if you could try that PR locally because I'm not in a position right now to try it on linux, but I believe it should work no problem.
Yes, I will do it soon.
Regarding 1: It is probably a minor misunderstanding, what I meant, was to keep the current style = {path = "relative", -- absolute, relative, tail}
option and to introduce a new option (e.g.: style = { path_abbreviation = 'shorten'/'default' }
) for the new functionality.
This yields the possibility to shorten relative AND absolute paths, and chance to introduce new abbreviation options easier in the future without breaking changes and could be probably done in relatively few lines of code.
Oh, that actually makes sense. How about instead of path_abbrievation = 'shorten'/'default'
- path_abbrievation = 'shorten'/'none'
or even shorten_path = true/false
?
path_abbrevation = 'shorten'/'none'
sounds good to me (in case there will be another abbreviation scheme in the future, this will prevent breaking changes)
It'd be lovely if you could try that PR locally because I'm not in a position right now to try it on linux, but I believe it should work no problem.
Yes, it works fine now on Linux, and the improvements you made look good too.
It should be good now.
Fixed it.
But oof, don't mind the commit name, I changed them to abbreviation
, not abbrevation
, just a typo in the commit :(.
Oh man! Right. Really sorry, I'm a bit dizzy. Hope it's all good now, thanks for your suggestions.