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

Navigator doesn't recognize system editor symbolic link. (& fix) #186

Closed
stevefan opened this issue Nov 1, 2017 · 7 comments
Closed

Navigator doesn't recognize system editor symbolic link. (& fix) #186

stevefan opened this issue Nov 1, 2017 · 7 comments

Comments

@stevefan
Copy link

stevefan commented Nov 1, 2017

For Ubuntu 16.04

I found that only when I called vim as my system editor, the navigator keys wouldn't let me switch between vim splits.

After some investigating, I found that this was because the regex didn't catch that I was using the system editor.

My fix is to tac on |editor in the regex in ~/.tmux.conf:

is_vim="ps -o state= -o comm= -t '#{pane_tty}' \  
    | grep -iqE '^[^TXZ ]+ +(\\S+\/)?g?(view|n?vim?x?|editor)(diff)?$'"

A note about this could be useful in the README.

A better solution would be to find out the actual bin, if symbolic linked to, though the ps call would be.

edits**
specified OS & file with the modified line

@blueyed
Copy link
Collaborator

blueyed commented Nov 1, 2017

So the bin is editor then?
How does it happen? Is this a symlink somehow? (as with Debian/Ubuntu)
Does it also reflect what you have in $EDITOR?

@stevefan
Copy link
Author

stevefan commented Nov 1, 2017

This is for Ubuntu 16.04.
No $EDITOR variable.

It happens through update-alternatives.
sudo update-alternatives --install /usr/bin/editor editor /path/to/vim 1

@blueyed
Copy link
Collaborator

blueyed commented Nov 1, 2017

I see.
/usr/bin/editor is not a symlink though is it?
Anyway, I think the pattern should just match it, and also be more friendly to NixOS (#171).
@christoomey's call I guess.

I am still up for the fork mentioned in #170 (comment), but am happy enough with my own local version for now.

@christoomey
Copy link
Owner

Hi @stevefan, thanks for sharing and for the detailed writeup and proposed solution.

I try to be cautious with extending the match pattern as I think a false positive is possibly worse (you'd be stuck in tmux w/ the nav keys being sent through to the underlying process) than the current failure mode, and adding |editor feels like it could open the door to false positives.

I'm thinking a bit about how to strike the right balance between keeping the core super stable, while making it "just work" for as many configurations as possible. I'll keep this open for now while I think through the options, but as it stands I'm hopeful that the fix of updating the pattern in your ~/.tmux.conf covers your needs.

@stevefan
Copy link
Author

stevefan commented Nov 2, 2017

@blueyed Dug a little bit into the update-alternatives system, it uses symlinks.

lrwxrwxrwx  1 root root  24 Jun 18 14:31  /usr/bin/editor -> /etc/alternatives/editor*
lrwxrwxrwx  1 root root  18 Nov  2 10:32  /etc/alternatives/editor -> /usr/local/bin/vim*

@blueyed
Copy link
Collaborator

blueyed commented Apr 30, 2018

#201 solves this.

@stevefan
Copy link
Author

closing as solved

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

No branches or pull requests

3 participants