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

Improve Documentation on how to persist aliases #901

Open
thadguidry opened this issue May 5, 2023 · 7 comments
Open

Improve Documentation on how to persist aliases #901

thadguidry opened this issue May 5, 2023 · 7 comments

Comments

@thadguidry
Copy link

In the docs https://www.nushell.sh/book/aliases.html there is this statement:

For more details about how to persist aliases so that they're visible when you start up Nushell, see the configuration chapter.

However, if you click on that configuration chapter link and then search the page, you only see a small confusing snippet of a nuopen override example for MacOS, and nowhere else does it show how to persist aliases.

echo $nu.scope.aliases does work to show current aliases made in a session, but there should be a way to persist them much more easily somehow?

@thadguidry
Copy link
Author

thadguidry commented May 5, 2023

It was suggested on Discord that:

Just type alias ll = ls -l into your config.nu, it should work.

But actually that does not. The config reports an error during nushell startup.

@fdncred
Copy link
Contributor

fdncred commented May 5, 2023

I put this alias ll = ls -l at the top of my config and restarted nushell and ll works without issue. $nu.scope.aliases and help aliases both list the alias.

@thadguidry thadguidry changed the title How to persist aliases needs to be documented in a section Improve Documentation on how to persist aliases May 5, 2023
@thadguidry
Copy link
Author

Thanks, yes, I was able to finally get them to persist. Now we just need someone to work on this issue to improve the docs!

@fdncred
Copy link
Contributor

fdncred commented May 5, 2023

It says, add them to the config file. What are you thinking about changing?

@thadguidry
Copy link
Author

lots of TYPES of things can be added into the config file. Variables, Commands (def's), etc.
I honestly didn't know WHICH type or syntax to actually use to declare aliases because no simple example was shown or mentioned. The config file is technically TYPE aware, in that it is parsed for substructures. WHICH substructure to use to declare aliases is currently not clear without an example in the docs on that configuration page.

Also, it could further help to ship inside the default config.nu file at the top with a commented out

# The below syntax is how aliases can be declared.  Uncomment and add more.
# alias echohi = echo "hello world"

This would also make things much more understandable as well.

@fdncred
Copy link
Contributor

fdncred commented May 6, 2023

I've said for a long time that the default_config.nu should have a bunch of comments to explain the syntax. So, I'd support such a change.

@Denis4l
Copy link

Denis4l commented Jul 6, 2023

Agree for the comment into the default_config.nu , and I shall say more : the doc may explain how to parse a file in a way to keep everything clean like https://discord.com/channels/601130461678272522/1103191812061011968/1103323548493303890
no ?

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

3 participants