Skip to content

Make it even easier to program in Rust within the fish shell!

Notifications You must be signed in to change notification settings

kpbaks/rust.fish

Repository files navigation

rust.fish

Installation

fisher install kpbaks/rust.fish

Abbreviations

abbr -a cg cargo
abbr -a cga cargo add
abbr -a cgad cargo add --dev
abbr -a cgb cargo build --jobs "(math (nproc) - 1)"
abbr -a cgbr cargo build --jobs "(math (nproc) - 1)" --release
abbr -a cgc cargo check
abbr -a cgd cargo doc --open
abbr -a cgi cargo install --jobs "(math (nproc) - 1)"
abbr -a cgil cargo install --jobs "(math (nproc) - 1)" --locked
abbr -a cgmt --set-cursor --function abbr_cargo_metadata
abbr -a cgr --function abbr_cargo_run
abbr -a cgrb --set-cursor --function abbr_cargo_run_bin
abbr -a cgrr --function abbr_cargo_run_release
abbr -a cgrrb --set-cursor --function abbr_cargo_run_release_bin
abbr -a cgs cargo-search --limit=10
abbr -a cgt cargo test
abbr -a cgu cargo update
abbr -a cgbi cargo binstall # `cargo install binstall`
abbr -a cge cargo expand # `cargo install cargo-expand`
abbr -a cgm cargo-modules # `cargo install cargo-modules`
abbr -a cgmb --set-cursor --function abbr_cargo_modules_structure_bin
abbr -a cgml cargo-modules structure --lib
abbr -a cgmo cargo-modules orphans
abbr -a cgw cargo watch # `cargo install cargo-watch`
set -l cargo_watch_flags
set -a cargo_watch_flags --why # show paths that changed
set -a cargo_watch_flags --postpone # postpone first run until a file changes
set -a cargo_watch_flags --clear # clear the screen before each run
set -a cargo_watch_flags --notify # send desktop notification when watchexec notices
abbr -a cgwc cargo watch $cargo_watch_flags --exec check
abbr -a cgwt cargo watch $cargo_watch_flags --exec test
set -l rust_edition 2021
abbr -a rfmt rustfmt --edition=$rust_edition
abbr -a rfmtc rustfmt --edition=$rust_edition --check

Keybinds

alt-b<kdb> Shuffle between RUST_BACKTRACE={0,1,full}

Functions

cargo-search

A wrapper around cargo search that displays the results in a table. With the option to easily add any of the crates to the current project. image

If you have taplo cargo-search will additionally check the search results against your [dependencies] and [dev-dependencies] in $PWD/Cargo.toml (if it exist) to see if you already have any of them added, or if some of them can be updated to a newer version.

image

rust-smells

A wrapper around rg ...

TODO explain what it does and insert a screenshot

Completions

cargo add and cargo search have been enhanced such that they complete the crate names from crates.io.

image

Settings

Variable Description Default Value Constraint
rust_fish_default_rust_backtrace_level The default value of RUST_BACKTRACE set with abbreviations like cgb 0 one of: 0, 1 or full
rust_fish_default_rust_log_level The default value of RUST_LOG set with abbreviations like cgr info one of: off, trace, debug, info, warn or error

About

Make it even easier to program in Rust within the fish shell!

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published