denisidoro / navi

An interactive cheatsheet tool for the command-line
Apache License 2.0
15.24k stars 508 forks source link

command not found error #794

Open lisiur opened 2 years ago

lisiur commented 2 years ago

Describe the bug An error occurred after exec navi in powershell:
/bin/bash: line1: C:Users***.cargobinnavi.exe: command not found

To Reproduce Steps to reproduce the behavior:

  1. cargo install navi
  2. exec navi in powershell
  3. error occurred

Expected behavior A clear and concise description of what you expected to happen. no error

Screenshots If applicable, add screenshots to help explain your problem. image

Versions: 2.20.1

Additional context Add any other context about the problem here. Using windows terminal

welcome[bot] commented 2 years ago

Thanks for opening your first issue here! In case you're facing a bug, please update navi to the latest version first. Maybe the bug is already solved! :)

xBLACKICEx commented 1 year ago

get same error OS: Windows Version: navi 2.20.1 installed by scoop (i chided install by cargo buy is the same prorble) 图片

alexvy86 commented 1 year ago

I think you need to change the shell.command configuration option in the navi config file (normally under C:\Users\<username>\AppData\Roaming\navi\config.yaml, like this:

shell:
  command: cmd

I'm just starting to use navi in Windows, but I can confirm this works even if you use Powershell (I imagine this just makes navi itself run under cmd when invoked). And trying to use pwsh here (Powershell 7) instead of cmd, I ran into other errors when trying to select a command that uses variables:

image

EDIT: ah, the issue when using shell.command: pwsh seems to be already reported.

alexvy86 commented 1 year ago

It'd be great if navi auto-detected which OS it is installed on, and updated the config appropriately.

antonkrusche commented 1 month ago

I have found a workaround for this problem.

You can set the following environment variables in your .bashrc (if you are using git for windows): export NAVI_FZF_OVERRIDES="--preview='navi preview {}'" export NAVI_FZF_OVERRIDES_VAR="--preview='navi preview-var {+} {q} variable '"

If navi is in your PATH this will enable most of navis previewing capabilities.

For powershell you can probably set these environment variables equivalently. Either in your powershell configuration or simply in your Windows configuration.

@denisidoro I did not program in rust before so I can't make a PR out of that but it seems that in actor.rs line 64: let exe = fs::exe_string(); in structures.rs line 48: filesystem::exe_string() do not work well under windows how it is currently used because of the classic slash backslash problem.