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

carapace creates a new ~/.config/carapace in every directory the nushell open in #1073

Closed
2 of 13 tasks
mwmcode opened this issue Jan 2, 2025 · 5 comments
Closed
2 of 13 tasks
Labels
bug Something isn't working darwin fund Fundable with polar.sh nushell

Comments

@mwmcode
Copy link

mwmcode commented Jan 2, 2025

Current Behavior

carapace creates ~/.config/carapace in every directory the terminal starts from. [screen recording below]

Expected Behavior

It should only create carapace/ in the actual home directory (~/.config/carapace)

Steps To Reproduce

  1. configure the terminal to open new windows/tabs/panes to the current working directory
  2. cd ~/Desktop
  3. open a new tab or pane (will open to ~/Desktop per config in step 1)
  4. ls -la will show a newly created ~ folder , which contains .config/carapase/[overlays,specs]...

Demo:

carapace-issue.mov

Version

carapace-bin 1.1.1

OS

  • Darwin
  • Linux
  • Termux
  • Windows

Shell

  • Bash
  • Cmd
  • Elvish
  • Fish
  • Nushell
  • Oil
  • Powershell
  • Xonsh
  • Zsh

Anything else?

env.nu

$env.CARAPACE_BRIDGES = 'zsh,fish,bash,inshellisense' # optional

config.nu

# carapace
mkdir ~/.cache/carapace
carapace _carapace nushell | save --force ~/.cache/carapace/init.nu
source ~/.cache/carapace/init.nu

Polar

Fund with Polar
@mwmcode mwmcode added bug Something isn't working fund Fundable with polar.sh labels Jan 2, 2025
@ZerdoX-x
Copy link

ZerdoX-x commented Jan 2, 2025

remove mkdir and carapace _carapace nushell lines from your config.nu

@ZerdoX-x
Copy link

ZerdoX-x commented Jan 2, 2025

I agree docs should separate config lines from one time commands
image

@mwmcode
Copy link
Author

mwmcode commented Jan 2, 2025

like this carapace-sh/carapace-bin#2674 ?

@rsteube
Copy link
Member

rsteube commented Jan 2, 2025

Not sure yet what is going wrong here.
I would have expected some issues on windows as the documentation is currently pretty focussed on unix/darwin with ~ (homedir expansion).

On darwin this should work though.


About the instructions:

## ~/.config/nushell/env.nu
$env.CARAPACE_BRIDGES = 'zsh,fish,bash,inshellisense' # optional
mkdir ~/.cache/carapace
carapace _carapace nushell | save --force ~/.cache/carapace/init.nu

This is indeed meant to run each time to adapt to any changes between carapace versions.
(just seeing the mkdir is missing -p but seems that's not an issue)

#~/.config/nushell/config.nu
source ~/.cache/carapace/init.nu 

Nushell has a compile behaviour where the file must already exist to be sourced.
Hence the trick above with env.nu (we adopted this from starship).


I'd assume the ~ homedir expansion isn't working somewhere.
Are you using XDG environment variables?

@mwmcode
Copy link
Author

mwmcode commented Jan 3, 2025

Thanks for the suggestion. It was XDG_CONFIG_HOME being misconfigured 🤦‍♂️.

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

No branches or pull requests

3 participants