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

Shell history should have the actual command that was run instead of "F somenumber" #59

Open
ggada opened this issue Sep 30, 2018 · 0 comments

Comments

@ggada
Copy link

ggada commented Sep 30, 2018

sack stores F somenumber in shell history instead of the actual editor command that was run. Across multiple searches these aren't the same locations. Sack functionality should be decoupled from shell history so exact locations can be revisited via shell history.

$ sack something
...
$ F 1
...
$ <press up> # this should give the actual editor command that was run and not F 1

These lines added to the sack script (at line 163 in ~/bin/sack) work in zsh.

HISTFILE=~/.zhistory # or wherever your history is
sed -i '$ d' \$HISTFILE # delete the F somenumber that was added
/bin/zsh -ic "print -s \$sack__editor +\$sack__line \"\$sack__file\"" # add actual command to the shell history
\$sack__editor +\$sack__line "\$sack__file"

If you run a sack search now, the shell history stores the actual locations visited. You might want to do fc -R in zsh.

Let me know what you think of this feature and if it could be implemented in a portable way that works across shells. Would be happy to submit a PR.

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

1 participant