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

[fish] Support multiline commands #954

Merged
merged 1 commit into from
Jun 25, 2017
Merged

[fish] Support multiline commands #954

merged 1 commit into from
Jun 25, 2017

Conversation

tomfitzhenry
Copy link
Contributor

@tomfitzhenry tomfitzhenry commented Jun 22, 2017

Tested to work against fish 2.4 on Debian Stretch. I will be able to test against OS X tomorrow.

Fix found by @amosbird at #953 (comment)

closes #436

@tomfitzhenry tomfitzhenry mentioned this pull request Jun 22, 2017
1 task
@@ -44,7 +44,7 @@ function fzf_key_bindings
set -q FZF_TMUX_HEIGHT; or set FZF_TMUX_HEIGHT 40%
begin
set -lx FZF_DEFAULT_OPTS "--height $FZF_TMUX_HEIGHT $FZF_DEFAULT_OPTS --tiebreak=index --bind=ctrl-r:toggle-sort $FZF_CTRL_R_OPTS +m"
history | eval (__fzfcmd) -q '(commandline)' | read -l result
history -z | eval (__fzfcmd) --read0 -q '(commandline)' | perl -pe 'chomp if eof' | read -lz result
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chomp if eof will remove the last character, which is always a newline character, when history -z is used.

Ideally we'd be able to do this with just coreutils or fish, rather than perl. Anyone know how?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, the patch looks good to me. Just note that fzf currently prints a new line character as ?, this can be improved in the future.

Yeah, it would be nice if we don't have to use perl here, but if there's no other solution, I'm okay with it. (FWIW, head -c -1 doesn't work on macOS)

@junegunn junegunn merged commit dbcaec5 into junegunn:master Jun 25, 2017
@junegunn
Copy link
Owner

Merged, thanks. I'll consider changing how fzf displays new line character in the new version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fish: In ^r, multiline commands become multiple separate commands
2 participants