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

Smart Selection "Word bounded by WS" now omits trailing * or @ character #431

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

alanhoyle
Copy link

@alanhoyle alanhoyle commented Dec 21, 2020

This changes the default behavior of Smart Selection so that the "word bounded by Whitespace" regex does not include trailing @ or * characters by default. This improves behavior of the selector for those of us who use ls -F by default.

ls -F displays a character at the end of a filename to indicate special file types or directories. E.g. it adds a "*" to executable files and an "@" at the end of symbolic links. The default regex of \S+ includes those characters which can cause weird side effects with a typical pattern of use like this ls, user selects filename, user pastes into another command line window. The default would include executable_file* or symbolic_link@ which doesn't exist or might refer to multiple files.

The trailing * is especially troublesome in cases where there are multiple files of the same name. For example:

$ ls -F /usr/bin/* |grep ssh
/usr/bin/ssh*
/usr/bin/ssh-add*
/usr/bin/ssh-agent*
/usr/bin/ssh-copy-id*
/usr/bin/ssh-keygen*
/usr/bin/ssh-keyscan*

If someone tries to run /usr/bin/ssh* we'll get en error as the shell will expand to include the other files:

$ /usr/bin/ssh*
ssh: Could not resolve hostname /usr/bin/ssh-add: nodename nor servname provided, or not known

@gnachman
Copy link
Owner

I also use ls -F so I can definitely sympathize with this desire, but I don't think enough people use it to justify changing this default.

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