Coder Social home page Coder Social logo

Comments (7)

fdncred avatar fdncred commented on September 6, 2024 3

When I create scripts that I always want to be loaded, I put them in a folder that nushell can reach without changes. For nushell that means anywhere setup in NU_LIB_DIRS. Any file within that list of folders can be sourced without the need to specify the full path.

For me that means that I modify my env.nu with something like this.

# By default, <nushell-config-dir>/scripts is added
let-env NU_LIB_DIRS = [
    ($nu.config-path | path dirname | path join 'scripts')
    '/Users/fdncred/src/forks/nu_scripts'
]

Now, anything in nu_scripts can be sourced in my config.nu like this (because all of these are below the path I added above).

# external completions
use "custom-completions/cargo/cargo-completions.nu" *
use "custom-completions/git/git-completions.nu" *
use "custom-completions/winget/winget-completions.nu" *

# get_weather
use "weather/get-weather.nu" get_weather

from nu_scripts.

amtoine avatar amtoine commented on September 6, 2024 1

maybe in a new kde subdirectory inside ./custom-completions/? 😋

following the convention of the other subdirectories, you might want to put a README and a kde-completions.nu file 👍

from nu_scripts.

amtoine avatar amtoine commented on September 6, 2024 1

Are scripts from this repo automatically installed with Nushell or not? thinking I am not sure...

as @fdncred said, they are not 🤔
scripts need to be available in your NU_LIB_DIRS path, defined in env.nu 👍

if you add the path to your local copy of the nu_scripts to your NU_LIB_DIRS, they will be sourced when nushell starts 😉

from nu_scripts.

amtoine avatar amtoine commented on September 6, 2024 1

for instance, here is my NU_LIB_DIRS, because i define scripts inside ~/.config/nushell/lib/... which is not a standard location for that 😋

let-env NU_LIB_DIRS = [
    ($nu.config-path | path dirname | path join 'lib')
    ($nu.config-path | path dirname | path join 'lib' "core")
    ($nu.config-path | path dirname | path join 'lib' "scripts")
    ($nu.config-path | path dirname | path join 'lib' "personal")
]

hope that's clear 😌

from nu_scripts.

EmilyGraceSeville7cf avatar EmilyGraceSeville7cf commented on September 6, 2024

Are scripts from this repo automatically installed with Nushell or not? 🤔 I am not sure...

from nu_scripts.

amtoine avatar amtoine commented on September 6, 2024

When I create scripts that I always want to be loaded, I put them in a folder that nushell can reach without changes. For nushell that means anywhere setup in NU_LIB_DIRS. Any file within that list of folders can be sourced without the need to specify the full path.

definitely something i did not mention, thanks 😌

@EmilySeville7cfg, it depends on whether you want to share your completion script with the community 😉

from nu_scripts.

EmilyGraceSeville7cf avatar EmilyGraceSeville7cf commented on September 6, 2024

I guess I can close this issue as my question is solved. ;)

from nu_scripts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.