Skip to content

Conversation

@jakem72360
Copy link

Files that are selected with ranger are now opened using a path relative to the working directory, rather than an absolute path if the former is shorter. This behaviour produces better tab names since nearby files in a project are likely to be shown relative, whilst files being worked on elsewhere in the system are shown by their absolute path(s). Files in the same directory do not include any path information.

@francoiscabrol
Copy link
Owner

It looks to be a good approach but it did not work for me locally. I got the following error

Erreur détectée en traitant function 263 :
ligne    9 :
E121: Undefined variable: a:edit_cmd
Appuyez sur ENTRÉE ou tapez une commande pour continuer

@jakem72360
Copy link
Author

Out of curiosity, are you using Vim, or Neovim? I haven't tested this with Neovim

@francoiscabrol
Copy link
Owner

neovim, maybe this is why :)

@francoiscabrol
Copy link
Owner

I have a new error now: command not found: realpath. It is a linux command that does not exist on MacOS. Maybe you can find a vim command that returns the same path?

@jakem72360
Copy link
Author

@francoiscabrol the easiest workaround I can think of, would be to install GNU coreutils like so; brew install coreutils.

There doesn't seem to be any easy solution from what I can find. It seems the cleanest, most platform-independent method would be to write a recursive function in vimscript to convert absolute paths to relative. For now, I've added a conditional statement to check for the realpath executable. The relative path functionality will be disabled if it's not present.

Let me know which approach works best for you

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.

2 participants