tmux-plugins / tmux-open

Tmux key bindings for quick opening of a highlighted file or url
MIT License
619 stars 63 forks source link

[bug] url containing '#' will fail #53

Closed Freed-Wu closed 1 year ago

Freed-Wu commented 1 year ago
set -g @plugin tmux-plugins/tmux-open
set -g @open x

select a url containing #, (e.g.., https://pytorch.org/docs/stable/optim.html#how-to-adjust-learning-rate), press x, tmux will open https://pytorch.org/docs/stable/optim.htmldesktopow-to-adjust-learning-rate, not containing #h (my host name is desktop). Bug comes from https://github.com/tmux-plugins/tmux-open/blob/master/open.tmux#L39, should escape # to ##:

$ man tmux
...
     ‘#S’; ‘##’ is replaced by a single ‘#’, ‘#,’ by a ‘,’ and ‘#}’ by a ‘}’.
...

If tmux run-shell -b 'xdg-open https://pytorch.org/docs/stable/optim.html#how-to-adjust-learning-rate', the bug will occur. The correct way is tmux run-shell -b 'xdg-open https://pytorch.org/docs/stable/optim.html##how-to-adjust-learning-rate'

Thanks.