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 compatibility #171

Closed
curio77 opened this issue Dec 22, 2019 · 12 comments
Closed

fish compatibility #171

curio77 opened this issue Dec 22, 2019 · 12 comments
Labels
bug Something isn't working

Comments

@curio77
Copy link

curio77 commented Dec 22, 2019

Describe the bug
In fish, navi works as expected for some variables in commands, while for others, it just inserts query instead of prompting for a selection. It is not clear to me what the discriminating factor is.

To Reproduce
Steps to reproduce the behavior:

  1. Set up navi in fish as described.
  2. Open navi via Ctrl-G.
  3. From the default cheats, select the docker-compose up -d <service_name> cheat that ships with navi.
  4. See that this gets expanded into docker-compose up -d query.

Expected behavior
navi should prompt for a service name.

Versions:

  • OS: Linux (Gentoo, but shouldn't matter)
  • fish v3.0.2
@curio77 curio77 added the bug Something isn't working label Dec 22, 2019
@denisidoro
Copy link
Owner

What does navi --version output?

@denisidoro
Copy link
Owner

Does this work when using bash, for instance?

@curio77
Copy link
Author

curio77 commented Dec 22, 2019

It's up-to-date (GitHub HEAD), v0.17.0.

@curio77
Copy link
Author

curio77 commented Dec 22, 2019

In Bash everything works fine, i.e., in the example, I get the expected prompt to select a service.

@denisidoro
Copy link
Owner

denisidoro commented Dec 22, 2019

Could you please check the behavior when calling navi --no-autoselect?

@denisidoro
Copy link
Owner

There was a typo on my previous message. I've fixed it

@curio77
Copy link
Author

curio77 commented Dec 22, 2019

Then I do get an input prompt. So one cause appears to be having input-only variables (that would auto-select to none).

However, in another case, I observe the same effect (artifical example):

# Test
true <foo>

$ foo: echo 1 2 3 | tr " " "\n"

Here, I too get that query inserted (yielding true query), even though there's a list (1, 2, and 3) to select from. With --no-auto-select, navi returns to the command line without filling in anything (command is blank). In bash, I get the expected selection list.

@denisidoro
Copy link
Owner

denisidoro commented Jan 14, 2020

Hi, @curio77. Sorry for the extremely late response. I was on vacations.

I'm not able to reproduce the problem. Using fish 3.0.2 on OSX I am able to select the values accordingly.

Do you still face this issue in the latest version? I know I'm asking too much, but maybe you could find a minimal docker image that has this problem?

I wonder if there's a system-level config/binary determining this, as you reported two bugs I'm not able to reproduce.

@denisidoro
Copy link
Owner

I've run this in a docker container and wasn't able to reproduce as well: https://www.katacoda.com/denisidoro/scenarios/navi:

cd "$(navi home)/cheats"
vi test.cheat # and paste the code below
cd
echo foo > "my file.txt"
echo bar > "my 'file.txt"
navi # eventually it will print foo/bar
% test

# Test echo
echo <foo>

# Test fs
cat <file>

$ foo: echo 1 2 3 | tr " " "\n"
$ file: ls

@curio77
Copy link
Author

curio77 commented Jan 15, 2020

Ah, so after some further experimentation, I've found out that my issue only crops up if I invoke navi via Ctrl+G. When I enter navi manually, it does indeed work.

I set up navi in fish via source (navi widget fish) in a config file (as is the result of the regular navi setup process for fish). Could you please try reproducing via Ctrl+G?

@curio77
Copy link
Author

curio77 commented Jan 16, 2020

Instead of pressing Ctrl+G, you can of course also run navi-widget if the navi plugin is set up, then the effects are the same. In the navi-widget function, there even is indeed that literal "query" string. FWIW, for me, the function looks like this:

function navi-widget -d "Show cheat sheets"
  begin
    stty sane
    env NAVI_USE_FZF_ALL_INPUTS=true navi --print query (commandline) | perl -pe 'chomp if eof' | read -lz result
    and commandline -- $result
  end
  commandline -f repaint
end

denisidoro added a commit that referenced this issue Jan 17, 2020
@denisidoro
Copy link
Owner

Fixed by #174

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants