Comments (7)
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.
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.
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.
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.
Are scripts from this repo automatically installed with Nushell or not? 🤔 I am not sure...
from nu_scripts.
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.
I guess I can close this issue as my question is solved. ;)
from nu_scripts.
Related Issues (20)
- nu_conda list should show which environments are activated HOT 1
- Nuscript's for Pacman
- Module `rbenv` can't export command named same as module. HOT 3
- Add a basic level of CI for this repo HOT 3
- winget-completions.nu with problems? HOT 4
- Conda documentation HOT 3
- Admin commands Question HOT 1
- Fix: nushell at 0.88.0 `start` and `end` are deprecated HOT 1
- tokyo-night theme uses tokyo-storm palette HOT 7
- [new script] is dark_mode mac HOT 1
- The direnv hooks are very confusing HOT 1
- `main` branch CI is not working as expected HOT 1
- git branch cleanup returns errors. HOT 4
- PR 816 Broke Anaconda Activation Support on Windows
- 'winget show' errors on specific packages
- wrong syntax for accessing host name in `nu_conda_2/conda.nu` HOT 1
- Theme preview doesn't show "string" label when a closure is used in `color_config` HOT 6
- Winget completions does not work on too large number of rows HOT 1
- Remove pixi completions
- Use --no-color for git completion commands HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nu_scripts.