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

vim-slime should ask for a socket path, not a socket name #99

Closed
thejohnfreeman opened this issue May 26, 2016 · 1 comment
Closed

vim-slime should ask for a socket path, not a socket name #99

thejohnfreeman opened this issue May 26, 2016 · 1 comment

Comments

@thejohnfreeman
Copy link
Contributor

tmux supports two ways to pick the session's socket from the command line:

-L : User passes a name of a socket that exists in $TMPDIR
-S : User passes an absolute path to a socket

On shared hosts, it is not safe to have tmux putting its sockets into the default value for $TMPDIR, /tmp, because they are likely to be blown away. However, it is often undesirable to set $TMPDIR to a path in the home directory because other processes can fill it up with garbage. tmux switched to a separate variable, $TMUX_TMPDIR, but not until recently, some time after the latest version in use at my company (1.8). Altogether, it makes the use of -L very hard to get right. For example, vim-slime simply cannot function when I use 1.8, keep my tmux socket in my home directory on a shared machine, but leave $TMPDIR unset or pointing at /tmp.

To get around this issue, I think it would be better if vim-slime asked for a full path to the socket and used -S internally. This will require plugin users to type more than a socket name, but I imagine the vast majority of users are sending snippets to the same session, not a different session. The current session's socket path is kept in $TMUX and can be parsed in vim with split($TMUX, ',')[0]. It can be used as the default path and fit the needs of most users 1. I have made this improvement before for vim-tmux-navigator. I will be happy to volunteer a patch this evening, but it will be your decision whether to accept it.

Footnotes

  1. I honestly suspect it will fit the need of every user, and thus the prompt can be removed entirely, but I might be wrong.

thejohnfreeman added a commit to thejohnfreeman/vim-slime that referenced this issue May 26, 2016
Pull default from `$TMUX` in environment.

Closes jpalardy#99
thejohnfreeman added a commit to thejohnfreeman/vim-slime that referenced this issue May 26, 2016
Pull default from `$TMUX` in environment.

Closes jpalardy#99
@jpalardy
Copy link
Owner

I commented on the PR.

I'm not quick sure what the right solution is…

thejohnfreeman added a commit to thejohnfreeman/vim-slime that referenced this issue Jun 11, 2016
Pull default from `$TMUX` in environment.

Closes jpalardy#99
thejohnfreeman added a commit to thejohnfreeman/vim-slime that referenced this issue Feb 9, 2017
- Pull default socket path from `$TMUX` environment variable, if it exists.
- Pass -S or -L to tmux command depending on whether the socket path is
  absolute or relative.

Closes jpalardy#99
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

2 participants