diff --git a/fish/fish/completions/rustup.fish b/fish/fish/completions/rustup.fish new file mode 100644 index 0000000..c8c7141 --- /dev/null +++ b/fish/fish/completions/rustup.fish @@ -0,0 +1,257 @@ +# Print an optspec for argparse to handle cmd's options that are independent of any subcommand. +function __fish_rustup_global_optspecs + string join \n v/verbose q/quiet h/help V/version +end + +function __fish_rustup_needs_command + # Figure out if the current invocation already has a command. + set -l cmd (commandline -opc) + set -e cmd[1] + argparse -s (__fish_rustup_global_optspecs) -- $cmd 2>/dev/null + or return + if set -q argv[1] + # Also print the command, so this can be used to figure out what it is. + echo $argv[1] + return 1 + end + return 0 +end + +function __fish_rustup_using_subcommand + set -l cmd (__fish_rustup_needs_command) + test -z "$cmd" + and return 1 + contains -- $cmd[1] $argv +end + +complete -c rustup -n "__fish_rustup_needs_command" -s v -l verbose -d 'Set log level to \'DEBUG\' if \'RUSTUP_LOG\' is unset' +complete -c rustup -n "__fish_rustup_needs_command" -s q -l quiet -d 'Disable progress output, set log level to \'WARN\' if \'RUSTUP_LOG\' is unset' +complete -c rustup -n "__fish_rustup_needs_command" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_needs_command" -s V -l version -d 'Print version' +complete -c rustup -n "__fish_rustup_needs_command" -a "install" -d 'Install or update the given toolchains, or by default the active toolchain' +complete -c rustup -n "__fish_rustup_needs_command" -a "uninstall" -d 'Uninstall the given toolchains' +complete -c rustup -n "__fish_rustup_needs_command" -a "dump-testament" -d 'Dump information about the build' +complete -c rustup -n "__fish_rustup_needs_command" -a "toolchain" -d 'Install, uninstall, or list toolchains' +complete -c rustup -n "__fish_rustup_needs_command" -a "default" -d 'Set the default toolchain' +complete -c rustup -n "__fish_rustup_needs_command" -a "show" -d 'Show the active and installed toolchains or profiles' +complete -c rustup -n "__fish_rustup_needs_command" -a "update" -d 'Update Rust toolchains and rustup' +complete -c rustup -n "__fish_rustup_needs_command" -a "check" -d 'Check for updates to Rust toolchains and rustup' +complete -c rustup -n "__fish_rustup_needs_command" -a "target" -d 'Modify a toolchain\'s supported targets' +complete -c rustup -n "__fish_rustup_needs_command" -a "component" -d 'Modify a toolchain\'s installed components' +complete -c rustup -n "__fish_rustup_needs_command" -a "override" -d 'Modify toolchain overrides for directories' +complete -c rustup -n "__fish_rustup_needs_command" -a "run" -d 'Run a command with an environment configured for a given toolchain' +complete -c rustup -n "__fish_rustup_needs_command" -a "which" -d 'Display which binary will be run for a given command' +complete -c rustup -n "__fish_rustup_needs_command" -a "doc" -d 'Open the documentation for the current toolchain' +complete -c rustup -n "__fish_rustup_needs_command" -a "man" -d 'View the man page for a given command' +complete -c rustup -n "__fish_rustup_needs_command" -a "self" -d 'Modify the rustup installation' +complete -c rustup -n "__fish_rustup_needs_command" -a "set" -d 'Alter rustup settings' +complete -c rustup -n "__fish_rustup_needs_command" -a "completions" -d 'Generate tab-completion scripts for your shell' +complete -c rustup -n "__fish_rustup_needs_command" -a "help" -d 'Print this message or the help of the given subcommand(s)' +complete -c rustup -n "__fish_rustup_using_subcommand install" -l profile -r -f -a "minimal\t'' +default\t'' +complete\t''" +complete -c rustup -n "__fish_rustup_using_subcommand install" -s c -l component -d 'Comma-separated list of components to be added on installation' -r +complete -c rustup -n "__fish_rustup_using_subcommand install" -s t -l target -d 'Comma-separated list of targets to be added on installation' -r +complete -c rustup -n "__fish_rustup_using_subcommand install" -l no-self-update -d 'Don\'t perform self update when running the `rustup toolchain install` command' +complete -c rustup -n "__fish_rustup_using_subcommand install" -l force -d 'Force an update, even if some components are missing' +complete -c rustup -n "__fish_rustup_using_subcommand install" -l allow-downgrade -d 'Allow rustup to downgrade the toolchain to satisfy your component choice' +complete -c rustup -n "__fish_rustup_using_subcommand install" -l force-non-host -d 'Install toolchains that require an emulator. See https://github.com/rust-lang/rustup/wiki/Non-host-toolchains' +complete -c rustup -n "__fish_rustup_using_subcommand install" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand uninstall" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand dump-testament" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand toolchain; and not __fish_seen_subcommand_from list install uninstall link help" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand toolchain; and not __fish_seen_subcommand_from list install uninstall link help" -f -a "list" -d 'List installed toolchains' +complete -c rustup -n "__fish_rustup_using_subcommand toolchain; and not __fish_seen_subcommand_from list install uninstall link help" -f -a "install" -d 'Install or update the given toolchains, or by default the active toolchain' +complete -c rustup -n "__fish_rustup_using_subcommand toolchain; and not __fish_seen_subcommand_from list install uninstall link help" -f -a "uninstall" -d 'Uninstall the given toolchains' +complete -c rustup -n "__fish_rustup_using_subcommand toolchain; and not __fish_seen_subcommand_from list install uninstall link help" -f -a "link" -d 'Create a custom toolchain by symlinking to a directory' +complete -c rustup -n "__fish_rustup_using_subcommand toolchain; and not __fish_seen_subcommand_from list install uninstall link help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' +complete -c rustup -n "__fish_rustup_using_subcommand toolchain; and __fish_seen_subcommand_from list" -s v -l verbose -d 'Enable verbose output with toolchain information' +complete -c rustup -n "__fish_rustup_using_subcommand toolchain; and __fish_seen_subcommand_from list" -s q -l quiet -d 'Force the output to be a single column' +complete -c rustup -n "__fish_rustup_using_subcommand toolchain; and __fish_seen_subcommand_from list" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand toolchain; and __fish_seen_subcommand_from install" -l profile -r -f -a "minimal\t'' +default\t'' +complete\t''" +complete -c rustup -n "__fish_rustup_using_subcommand toolchain; and __fish_seen_subcommand_from install" -s c -l component -d 'Comma-separated list of components to be added on installation' -r +complete -c rustup -n "__fish_rustup_using_subcommand toolchain; and __fish_seen_subcommand_from install" -s t -l target -d 'Comma-separated list of targets to be added on installation' -r +complete -c rustup -n "__fish_rustup_using_subcommand toolchain; and __fish_seen_subcommand_from install" -l no-self-update -d 'Don\'t perform self update when running the `rustup toolchain install` command' +complete -c rustup -n "__fish_rustup_using_subcommand toolchain; and __fish_seen_subcommand_from install" -l force -d 'Force an update, even if some components are missing' +complete -c rustup -n "__fish_rustup_using_subcommand toolchain; and __fish_seen_subcommand_from install" -l allow-downgrade -d 'Allow rustup to downgrade the toolchain to satisfy your component choice' +complete -c rustup -n "__fish_rustup_using_subcommand toolchain; and __fish_seen_subcommand_from install" -l force-non-host -d 'Install toolchains that require an emulator. See https://github.com/rust-lang/rustup/wiki/Non-host-toolchains' +complete -c rustup -n "__fish_rustup_using_subcommand toolchain; and __fish_seen_subcommand_from install" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand toolchain; and __fish_seen_subcommand_from uninstall" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand toolchain; and __fish_seen_subcommand_from link" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand toolchain; and __fish_seen_subcommand_from help" -f -a "list" -d 'List installed toolchains' +complete -c rustup -n "__fish_rustup_using_subcommand toolchain; and __fish_seen_subcommand_from help" -f -a "install" -d 'Install or update the given toolchains, or by default the active toolchain' +complete -c rustup -n "__fish_rustup_using_subcommand toolchain; and __fish_seen_subcommand_from help" -f -a "uninstall" -d 'Uninstall the given toolchains' +complete -c rustup -n "__fish_rustup_using_subcommand toolchain; and __fish_seen_subcommand_from help" -f -a "link" -d 'Create a custom toolchain by symlinking to a directory' +complete -c rustup -n "__fish_rustup_using_subcommand toolchain; and __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' +complete -c rustup -n "__fish_rustup_using_subcommand default" -l force-non-host -d 'Install toolchains that require an emulator. See https://github.com/rust-lang/rustup/wiki/Non-host-toolchains' +complete -c rustup -n "__fish_rustup_using_subcommand default" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand show; and not __fish_seen_subcommand_from active-toolchain home profile help" -s v -l verbose -d 'Enable verbose output with rustc information for all installed toolchains' +complete -c rustup -n "__fish_rustup_using_subcommand show; and not __fish_seen_subcommand_from active-toolchain home profile help" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand show; and not __fish_seen_subcommand_from active-toolchain home profile help" -f -a "active-toolchain" -d 'Show the active toolchain' +complete -c rustup -n "__fish_rustup_using_subcommand show; and not __fish_seen_subcommand_from active-toolchain home profile help" -f -a "home" -d 'Display the computed value of RUSTUP_HOME' +complete -c rustup -n "__fish_rustup_using_subcommand show; and not __fish_seen_subcommand_from active-toolchain home profile help" -f -a "profile" -d 'Show the default profile used for the `rustup install` command' +complete -c rustup -n "__fish_rustup_using_subcommand show; and not __fish_seen_subcommand_from active-toolchain home profile help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' +complete -c rustup -n "__fish_rustup_using_subcommand show; and __fish_seen_subcommand_from active-toolchain" -s v -l verbose -d 'Enable verbose output with rustc information' +complete -c rustup -n "__fish_rustup_using_subcommand show; and __fish_seen_subcommand_from active-toolchain" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand show; and __fish_seen_subcommand_from home" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand show; and __fish_seen_subcommand_from profile" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand show; and __fish_seen_subcommand_from help" -f -a "active-toolchain" -d 'Show the active toolchain' +complete -c rustup -n "__fish_rustup_using_subcommand show; and __fish_seen_subcommand_from help" -f -a "home" -d 'Display the computed value of RUSTUP_HOME' +complete -c rustup -n "__fish_rustup_using_subcommand show; and __fish_seen_subcommand_from help" -f -a "profile" -d 'Show the default profile used for the `rustup install` command' +complete -c rustup -n "__fish_rustup_using_subcommand show; and __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' +complete -c rustup -n "__fish_rustup_using_subcommand update" -l no-self-update -d 'Don\'t perform self update when running the `rustup update` command' +complete -c rustup -n "__fish_rustup_using_subcommand update" -l force -d 'Force an update, even if some components are missing' +complete -c rustup -n "__fish_rustup_using_subcommand update" -l force-non-host -d 'Install toolchains that require an emulator. See https://github.com/rust-lang/rustup/wiki/Non-host-toolchains' +complete -c rustup -n "__fish_rustup_using_subcommand update" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand check" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand target; and not __fish_seen_subcommand_from list add remove help" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand target; and not __fish_seen_subcommand_from list add remove help" -f -a "list" -d 'List installed and available targets' +complete -c rustup -n "__fish_rustup_using_subcommand target; and not __fish_seen_subcommand_from list add remove help" -f -a "add" -d 'Add a target to a Rust toolchain' +complete -c rustup -n "__fish_rustup_using_subcommand target; and not __fish_seen_subcommand_from list add remove help" -f -a "remove" -d 'Remove a target from a Rust toolchain' +complete -c rustup -n "__fish_rustup_using_subcommand target; and not __fish_seen_subcommand_from list add remove help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' +complete -c rustup -n "__fish_rustup_using_subcommand target; and __fish_seen_subcommand_from list" -l toolchain -d 'Toolchain name, such as \'stable\', \'nightly\', or \'1.8.0\'. For more information see `rustup help toolchain`' -r +complete -c rustup -n "__fish_rustup_using_subcommand target; and __fish_seen_subcommand_from list" -l installed -d 'List only installed targets' +complete -c rustup -n "__fish_rustup_using_subcommand target; and __fish_seen_subcommand_from list" -s q -l quiet -d 'Force the output to be a single column' +complete -c rustup -n "__fish_rustup_using_subcommand target; and __fish_seen_subcommand_from list" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand target; and __fish_seen_subcommand_from add" -l toolchain -d 'Toolchain name, such as \'stable\', \'nightly\', or \'1.8.0\'. For more information see `rustup help toolchain`' -r +complete -c rustup -n "__fish_rustup_using_subcommand target; and __fish_seen_subcommand_from add" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand target; and __fish_seen_subcommand_from remove" -l toolchain -d 'Toolchain name, such as \'stable\', \'nightly\', or \'1.8.0\'. For more information see `rustup help toolchain`' -r +complete -c rustup -n "__fish_rustup_using_subcommand target; and __fish_seen_subcommand_from remove" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand target; and __fish_seen_subcommand_from help" -f -a "list" -d 'List installed and available targets' +complete -c rustup -n "__fish_rustup_using_subcommand target; and __fish_seen_subcommand_from help" -f -a "add" -d 'Add a target to a Rust toolchain' +complete -c rustup -n "__fish_rustup_using_subcommand target; and __fish_seen_subcommand_from help" -f -a "remove" -d 'Remove a target from a Rust toolchain' +complete -c rustup -n "__fish_rustup_using_subcommand target; and __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' +complete -c rustup -n "__fish_rustup_using_subcommand component; and not __fish_seen_subcommand_from list add remove help" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand component; and not __fish_seen_subcommand_from list add remove help" -f -a "list" -d 'List installed and available components' +complete -c rustup -n "__fish_rustup_using_subcommand component; and not __fish_seen_subcommand_from list add remove help" -f -a "add" -d 'Add a component to a Rust toolchain' +complete -c rustup -n "__fish_rustup_using_subcommand component; and not __fish_seen_subcommand_from list add remove help" -f -a "remove" -d 'Remove a component from a Rust toolchain' +complete -c rustup -n "__fish_rustup_using_subcommand component; and not __fish_seen_subcommand_from list add remove help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' +complete -c rustup -n "__fish_rustup_using_subcommand component; and __fish_seen_subcommand_from list" -l toolchain -d 'Toolchain name, such as \'stable\', \'nightly\', or \'1.8.0\'. For more information see `rustup help toolchain`' -r +complete -c rustup -n "__fish_rustup_using_subcommand component; and __fish_seen_subcommand_from list" -l installed -d 'List only installed components' +complete -c rustup -n "__fish_rustup_using_subcommand component; and __fish_seen_subcommand_from list" -s q -l quiet -d 'Force the output to be a single column' +complete -c rustup -n "__fish_rustup_using_subcommand component; and __fish_seen_subcommand_from list" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand component; and __fish_seen_subcommand_from add" -l toolchain -d 'Toolchain name, such as \'stable\', \'nightly\', or \'1.8.0\'. For more information see `rustup help toolchain`' -r +complete -c rustup -n "__fish_rustup_using_subcommand component; and __fish_seen_subcommand_from add" -l target -r +complete -c rustup -n "__fish_rustup_using_subcommand component; and __fish_seen_subcommand_from add" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand component; and __fish_seen_subcommand_from remove" -l toolchain -d 'Toolchain name, such as \'stable\', \'nightly\', or \'1.8.0\'. For more information see `rustup help toolchain`' -r +complete -c rustup -n "__fish_rustup_using_subcommand component; and __fish_seen_subcommand_from remove" -l target -r +complete -c rustup -n "__fish_rustup_using_subcommand component; and __fish_seen_subcommand_from remove" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand component; and __fish_seen_subcommand_from help" -f -a "list" -d 'List installed and available components' +complete -c rustup -n "__fish_rustup_using_subcommand component; and __fish_seen_subcommand_from help" -f -a "add" -d 'Add a component to a Rust toolchain' +complete -c rustup -n "__fish_rustup_using_subcommand component; and __fish_seen_subcommand_from help" -f -a "remove" -d 'Remove a component from a Rust toolchain' +complete -c rustup -n "__fish_rustup_using_subcommand component; and __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' +complete -c rustup -n "__fish_rustup_using_subcommand override; and not __fish_seen_subcommand_from list set unset help" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand override; and not __fish_seen_subcommand_from list set unset help" -f -a "list" -d 'List directory toolchain overrides' +complete -c rustup -n "__fish_rustup_using_subcommand override; and not __fish_seen_subcommand_from list set unset help" -f -a "set" -d 'Set the override toolchain for a directory' +complete -c rustup -n "__fish_rustup_using_subcommand override; and not __fish_seen_subcommand_from list set unset help" -f -a "unset" -d 'Remove the override toolchain for a directory' +complete -c rustup -n "__fish_rustup_using_subcommand override; and not __fish_seen_subcommand_from list set unset help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' +complete -c rustup -n "__fish_rustup_using_subcommand override; and __fish_seen_subcommand_from list" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand override; and __fish_seen_subcommand_from set" -l path -d 'Path to the directory' -r -F +complete -c rustup -n "__fish_rustup_using_subcommand override; and __fish_seen_subcommand_from set" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand override; and __fish_seen_subcommand_from unset" -l path -d 'Path to the directory' -r -F +complete -c rustup -n "__fish_rustup_using_subcommand override; and __fish_seen_subcommand_from unset" -l nonexistent -d 'Remove override toolchain for all nonexistent directories' +complete -c rustup -n "__fish_rustup_using_subcommand override; and __fish_seen_subcommand_from unset" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand override; and __fish_seen_subcommand_from help" -f -a "list" -d 'List directory toolchain overrides' +complete -c rustup -n "__fish_rustup_using_subcommand override; and __fish_seen_subcommand_from help" -f -a "set" -d 'Set the override toolchain for a directory' +complete -c rustup -n "__fish_rustup_using_subcommand override; and __fish_seen_subcommand_from help" -f -a "unset" -d 'Remove the override toolchain for a directory' +complete -c rustup -n "__fish_rustup_using_subcommand override; and __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' +complete -c rustup -n "__fish_rustup_using_subcommand run" -l install -d 'Install the requested toolchain if needed' +complete -c rustup -n "__fish_rustup_using_subcommand run" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand which" -l toolchain -d 'Toolchain name, such as \'stable\', \'nightly\', \'1.8.0\', or a custom toolchain name. For more information see `rustup help toolchain`' -r +complete -c rustup -n "__fish_rustup_using_subcommand which" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand doc" -l toolchain -d 'Toolchain name, such as \'stable\', \'nightly\', or \'1.8.0\'. For more information see `rustup help toolchain`' -r +complete -c rustup -n "__fish_rustup_using_subcommand doc" -l path -d 'Only print the path to the documentation' +complete -c rustup -n "__fish_rustup_using_subcommand doc" -l alloc -d 'The Rust core allocation and collections library' +complete -c rustup -n "__fish_rustup_using_subcommand doc" -l book -d 'The Rust Programming Language book' +complete -c rustup -n "__fish_rustup_using_subcommand doc" -l cargo -d 'The Cargo Book' +complete -c rustup -n "__fish_rustup_using_subcommand doc" -l clippy -d 'The Clippy Documentation' +complete -c rustup -n "__fish_rustup_using_subcommand doc" -l core -d 'The Rust Core Library' +complete -c rustup -n "__fish_rustup_using_subcommand doc" -l edition-guide -d 'The Rust Edition Guide' +complete -c rustup -n "__fish_rustup_using_subcommand doc" -l embedded-book -d 'The Embedded Rust Book' +complete -c rustup -n "__fish_rustup_using_subcommand doc" -l error-codes -d 'The Rust Error Codes Index' +complete -c rustup -n "__fish_rustup_using_subcommand doc" -l nomicon -d 'The Dark Arts of Advanced and Unsafe Rust Programming' +complete -c rustup -n "__fish_rustup_using_subcommand doc" -l proc_macro -d 'A support library for macro authors when defining new macros' +complete -c rustup -n "__fish_rustup_using_subcommand doc" -l reference -d 'The Rust Reference' +complete -c rustup -n "__fish_rustup_using_subcommand doc" -l rust-by-example -d 'A collection of runnable examples that illustrate various Rust concepts and standard libraries' +complete -c rustup -n "__fish_rustup_using_subcommand doc" -l rustc -d 'The compiler for the Rust programming language' +complete -c rustup -n "__fish_rustup_using_subcommand doc" -l rustdoc -d 'Documentation generator for Rust projects' +complete -c rustup -n "__fish_rustup_using_subcommand doc" -l std -d 'Standard library API documentation' +complete -c rustup -n "__fish_rustup_using_subcommand doc" -l style-guide -d 'The Rust Style Guide' +complete -c rustup -n "__fish_rustup_using_subcommand doc" -l test -d 'Support code for rustc\'s built in unit-test and micro-benchmarking framework' +complete -c rustup -n "__fish_rustup_using_subcommand doc" -l unstable-book -d 'The Unstable Book' +complete -c rustup -n "__fish_rustup_using_subcommand doc" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand man" -l toolchain -d 'Toolchain name, such as \'stable\', \'nightly\', or \'1.8.0\'. For more information see `rustup help toolchain`' -r +complete -c rustup -n "__fish_rustup_using_subcommand man" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand self; and not __fish_seen_subcommand_from update uninstall upgrade-data help" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand self; and not __fish_seen_subcommand_from update uninstall upgrade-data help" -f -a "update" -d 'Download and install updates to rustup' +complete -c rustup -n "__fish_rustup_using_subcommand self; and not __fish_seen_subcommand_from update uninstall upgrade-data help" -f -a "uninstall" -d 'Uninstall rustup' +complete -c rustup -n "__fish_rustup_using_subcommand self; and not __fish_seen_subcommand_from update uninstall upgrade-data help" -f -a "upgrade-data" -d 'Upgrade the internal data format' +complete -c rustup -n "__fish_rustup_using_subcommand self; and not __fish_seen_subcommand_from update uninstall upgrade-data help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' +complete -c rustup -n "__fish_rustup_using_subcommand self; and __fish_seen_subcommand_from update" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand self; and __fish_seen_subcommand_from uninstall" -s y +complete -c rustup -n "__fish_rustup_using_subcommand self; and __fish_seen_subcommand_from uninstall" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand self; and __fish_seen_subcommand_from upgrade-data" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand self; and __fish_seen_subcommand_from help" -f -a "update" -d 'Download and install updates to rustup' +complete -c rustup -n "__fish_rustup_using_subcommand self; and __fish_seen_subcommand_from help" -f -a "uninstall" -d 'Uninstall rustup' +complete -c rustup -n "__fish_rustup_using_subcommand self; and __fish_seen_subcommand_from help" -f -a "upgrade-data" -d 'Upgrade the internal data format' +complete -c rustup -n "__fish_rustup_using_subcommand self; and __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' +complete -c rustup -n "__fish_rustup_using_subcommand set; and not __fish_seen_subcommand_from default-host profile auto-self-update auto-install help" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand set; and not __fish_seen_subcommand_from default-host profile auto-self-update auto-install help" -f -a "default-host" -d 'The triple used to identify toolchains when not specified' +complete -c rustup -n "__fish_rustup_using_subcommand set; and not __fish_seen_subcommand_from default-host profile auto-self-update auto-install help" -f -a "profile" -d 'The default components installed with a toolchain' +complete -c rustup -n "__fish_rustup_using_subcommand set; and not __fish_seen_subcommand_from default-host profile auto-self-update auto-install help" -f -a "auto-self-update" -d 'The rustup auto self update mode' +complete -c rustup -n "__fish_rustup_using_subcommand set; and not __fish_seen_subcommand_from default-host profile auto-self-update auto-install help" -f -a "auto-install" -d 'The auto toolchain install mode' +complete -c rustup -n "__fish_rustup_using_subcommand set; and not __fish_seen_subcommand_from default-host profile auto-self-update auto-install help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' +complete -c rustup -n "__fish_rustup_using_subcommand set; and __fish_seen_subcommand_from default-host" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand set; and __fish_seen_subcommand_from profile" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand set; and __fish_seen_subcommand_from auto-self-update" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand set; and __fish_seen_subcommand_from auto-install" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand set; and __fish_seen_subcommand_from help" -f -a "default-host" -d 'The triple used to identify toolchains when not specified' +complete -c rustup -n "__fish_rustup_using_subcommand set; and __fish_seen_subcommand_from help" -f -a "profile" -d 'The default components installed with a toolchain' +complete -c rustup -n "__fish_rustup_using_subcommand set; and __fish_seen_subcommand_from help" -f -a "auto-self-update" -d 'The rustup auto self update mode' +complete -c rustup -n "__fish_rustup_using_subcommand set; and __fish_seen_subcommand_from help" -f -a "auto-install" -d 'The auto toolchain install mode' +complete -c rustup -n "__fish_rustup_using_subcommand set; and __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' +complete -c rustup -n "__fish_rustup_using_subcommand completions" -s h -l help -d 'Print help' +complete -c rustup -n "__fish_rustup_using_subcommand help; and not __fish_seen_subcommand_from install uninstall dump-testament toolchain default show update check target component override run which doc man self set completions help" -f -a "install" -d 'Install or update the given toolchains, or by default the active toolchain' +complete -c rustup -n "__fish_rustup_using_subcommand help; and not __fish_seen_subcommand_from install uninstall dump-testament toolchain default show update check target component override run which doc man self set completions help" -f -a "uninstall" -d 'Uninstall the given toolchains' +complete -c rustup -n "__fish_rustup_using_subcommand help; and not __fish_seen_subcommand_from install uninstall dump-testament toolchain default show update check target component override run which doc man self set completions help" -f -a "dump-testament" -d 'Dump information about the build' +complete -c rustup -n "__fish_rustup_using_subcommand help; and not __fish_seen_subcommand_from install uninstall dump-testament toolchain default show update check target component override run which doc man self set completions help" -f -a "toolchain" -d 'Install, uninstall, or list toolchains' +complete -c rustup -n "__fish_rustup_using_subcommand help; and not __fish_seen_subcommand_from install uninstall dump-testament toolchain default show update check target component override run which doc man self set completions help" -f -a "default" -d 'Set the default toolchain' +complete -c rustup -n "__fish_rustup_using_subcommand help; and not __fish_seen_subcommand_from install uninstall dump-testament toolchain default show update check target component override run which doc man self set completions help" -f -a "show" -d 'Show the active and installed toolchains or profiles' +complete -c rustup -n "__fish_rustup_using_subcommand help; and not __fish_seen_subcommand_from install uninstall dump-testament toolchain default show update check target component override run which doc man self set completions help" -f -a "update" -d 'Update Rust toolchains and rustup' +complete -c rustup -n "__fish_rustup_using_subcommand help; and not __fish_seen_subcommand_from install uninstall dump-testament toolchain default show update check target component override run which doc man self set completions help" -f -a "check" -d 'Check for updates to Rust toolchains and rustup' +complete -c rustup -n "__fish_rustup_using_subcommand help; and not __fish_seen_subcommand_from install uninstall dump-testament toolchain default show update check target component override run which doc man self set completions help" -f -a "target" -d 'Modify a toolchain\'s supported targets' +complete -c rustup -n "__fish_rustup_using_subcommand help; and not __fish_seen_subcommand_from install uninstall dump-testament toolchain default show update check target component override run which doc man self set completions help" -f -a "component" -d 'Modify a toolchain\'s installed components' +complete -c rustup -n "__fish_rustup_using_subcommand help; and not __fish_seen_subcommand_from install uninstall dump-testament toolchain default show update check target component override run which doc man self set completions help" -f -a "override" -d 'Modify toolchain overrides for directories' +complete -c rustup -n "__fish_rustup_using_subcommand help; and not __fish_seen_subcommand_from install uninstall dump-testament toolchain default show update check target component override run which doc man self set completions help" -f -a "run" -d 'Run a command with an environment configured for a given toolchain' +complete -c rustup -n "__fish_rustup_using_subcommand help; and not __fish_seen_subcommand_from install uninstall dump-testament toolchain default show update check target component override run which doc man self set completions help" -f -a "which" -d 'Display which binary will be run for a given command' +complete -c rustup -n "__fish_rustup_using_subcommand help; and not __fish_seen_subcommand_from install uninstall dump-testament toolchain default show update check target component override run which doc man self set completions help" -f -a "doc" -d 'Open the documentation for the current toolchain' +complete -c rustup -n "__fish_rustup_using_subcommand help; and not __fish_seen_subcommand_from install uninstall dump-testament toolchain default show update check target component override run which doc man self set completions help" -f -a "man" -d 'View the man page for a given command' +complete -c rustup -n "__fish_rustup_using_subcommand help; and not __fish_seen_subcommand_from install uninstall dump-testament toolchain default show update check target component override run which doc man self set completions help" -f -a "self" -d 'Modify the rustup installation' +complete -c rustup -n "__fish_rustup_using_subcommand help; and not __fish_seen_subcommand_from install uninstall dump-testament toolchain default show update check target component override run which doc man self set completions help" -f -a "set" -d 'Alter rustup settings' +complete -c rustup -n "__fish_rustup_using_subcommand help; and not __fish_seen_subcommand_from install uninstall dump-testament toolchain default show update check target component override run which doc man self set completions help" -f -a "completions" -d 'Generate tab-completion scripts for your shell' +complete -c rustup -n "__fish_rustup_using_subcommand help; and not __fish_seen_subcommand_from install uninstall dump-testament toolchain default show update check target component override run which doc man self set completions help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' +complete -c rustup -n "__fish_rustup_using_subcommand help; and __fish_seen_subcommand_from toolchain" -f -a "list" -d 'List installed toolchains' +complete -c rustup -n "__fish_rustup_using_subcommand help; and __fish_seen_subcommand_from toolchain" -f -a "install" -d 'Install or update the given toolchains, or by default the active toolchain' +complete -c rustup -n "__fish_rustup_using_subcommand help; and __fish_seen_subcommand_from toolchain" -f -a "uninstall" -d 'Uninstall the given toolchains' +complete -c rustup -n "__fish_rustup_using_subcommand help; and __fish_seen_subcommand_from toolchain" -f -a "link" -d 'Create a custom toolchain by symlinking to a directory' +complete -c rustup -n "__fish_rustup_using_subcommand help; and __fish_seen_subcommand_from show" -f -a "active-toolchain" -d 'Show the active toolchain' +complete -c rustup -n "__fish_rustup_using_subcommand help; and __fish_seen_subcommand_from show" -f -a "home" -d 'Display the computed value of RUSTUP_HOME' +complete -c rustup -n "__fish_rustup_using_subcommand help; and __fish_seen_subcommand_from show" -f -a "profile" -d 'Show the default profile used for the `rustup install` command' +complete -c rustup -n "__fish_rustup_using_subcommand help; and __fish_seen_subcommand_from target" -f -a "list" -d 'List installed and available targets' +complete -c rustup -n "__fish_rustup_using_subcommand help; and __fish_seen_subcommand_from target" -f -a "add" -d 'Add a target to a Rust toolchain' +complete -c rustup -n "__fish_rustup_using_subcommand help; and __fish_seen_subcommand_from target" -f -a "remove" -d 'Remove a target from a Rust toolchain' +complete -c rustup -n "__fish_rustup_using_subcommand help; and __fish_seen_subcommand_from component" -f -a "list" -d 'List installed and available components' +complete -c rustup -n "__fish_rustup_using_subcommand help; and __fish_seen_subcommand_from component" -f -a "add" -d 'Add a component to a Rust toolchain' +complete -c rustup -n "__fish_rustup_using_subcommand help; and __fish_seen_subcommand_from component" -f -a "remove" -d 'Remove a component from a Rust toolchain' +complete -c rustup -n "__fish_rustup_using_subcommand help; and __fish_seen_subcommand_from override" -f -a "list" -d 'List directory toolchain overrides' +complete -c rustup -n "__fish_rustup_using_subcommand help; and __fish_seen_subcommand_from override" -f -a "set" -d 'Set the override toolchain for a directory' +complete -c rustup -n "__fish_rustup_using_subcommand help; and __fish_seen_subcommand_from override" -f -a "unset" -d 'Remove the override toolchain for a directory' +complete -c rustup -n "__fish_rustup_using_subcommand help; and __fish_seen_subcommand_from self" -f -a "update" -d 'Download and install updates to rustup' +complete -c rustup -n "__fish_rustup_using_subcommand help; and __fish_seen_subcommand_from self" -f -a "uninstall" -d 'Uninstall rustup' +complete -c rustup -n "__fish_rustup_using_subcommand help; and __fish_seen_subcommand_from self" -f -a "upgrade-data" -d 'Upgrade the internal data format' +complete -c rustup -n "__fish_rustup_using_subcommand help; and __fish_seen_subcommand_from set" -f -a "default-host" -d 'The triple used to identify toolchains when not specified' +complete -c rustup -n "__fish_rustup_using_subcommand help; and __fish_seen_subcommand_from set" -f -a "profile" -d 'The default components installed with a toolchain' +complete -c rustup -n "__fish_rustup_using_subcommand help; and __fish_seen_subcommand_from set" -f -a "auto-self-update" -d 'The rustup auto self update mode' +complete -c rustup -n "__fish_rustup_using_subcommand help; and __fish_seen_subcommand_from set" -f -a "auto-install" -d 'The auto toolchain install mode' diff --git a/fish/fish/conf.d/fish_frozen_key_bindings.fish b/fish/fish/conf.d/fish_frozen_key_bindings.fish new file mode 100644 index 0000000..495aee9 --- /dev/null +++ b/fish/fish/conf.d/fish_frozen_key_bindings.fish @@ -0,0 +1,14 @@ +# This file was created by fish when upgrading to version 4.3, to migrate +# the 'fish_key_bindings' variable from its old default scope (universal) +# to its new default scope (global). We recommend you delete this file +# and configure key bindings in ~/.config/fish/config.fish if needed. + +# set --global fish_key_bindings fish_default_key_bindings + +# Prior to version 4.3, fish shipped an event handler that runs +# `set --universal fish_key_bindings fish_default_key_bindings` +# whenever the fish_key_bindings variable is erased. +# This means that as long as any fish < 4.3 is still running on this system, +# we cannot complete the migration. +# As a workaround, erase the universal variable at every shell startup. +set --erase --universal fish_key_bindings diff --git a/fish/fish/conf.d/fish_frozen_theme.fish b/fish/fish/conf.d/fish_frozen_theme.fish new file mode 100644 index 0000000..0caf65e --- /dev/null +++ b/fish/fish/conf.d/fish_frozen_theme.fish @@ -0,0 +1,37 @@ +# This file was created by fish when upgrading to version 4.3, to migrate +# theme variables from universal to global scope. +# Don't edit this file, as it will be written by the web-config tool (`fish_config`). +# To customize your theme, delete this file and see +# help interactive#syntax-highlighting +# or +# man fish-interactive | less +/^SYNTAX.HIGHLIGHTING +# for appropriate commands to add to ~/.config/fish/config.fish instead. +# See also the release notes for fish 4.3.0 (run `help relnotes`). + +set --global fish_color_autosuggestion brblack +set --global fish_color_cancel -r +set --global fish_color_command blue +set --global fish_color_comment red +set --global fish_color_cwd green +set --global fish_color_cwd_root red +set --global fish_color_end green +set --global fish_color_error brred +set --global fish_color_escape brcyan +set --global fish_color_history_current --bold +set --global fish_color_host normal +set --global fish_color_host_remote yellow +set --global fish_color_normal normal +set --global fish_color_operator brcyan +set --global fish_color_param cyan +set --global fish_color_quote yellow +set --global fish_color_redirection cyan --bold +set --global fish_color_search_match white --background=brblack +set --global fish_color_selection white --bold --background=brblack +set --global fish_color_status red +set --global fish_color_user brgreen +set --global fish_color_valid_path --underline +set --global fish_pager_color_completion normal +set --global fish_pager_color_description yellow -i +set --global fish_pager_color_prefix normal --bold --underline +set --global fish_pager_color_progress brwhite --background=cyan +set --global fish_pager_color_selected_background -r diff --git a/fish/fish/fish_variables b/fish/fish/fish_variables index 9c2de99..d1bd827 100644 --- a/fish/fish/fish_variables +++ b/fish/fish/fish_variables @@ -1,32 +1,4 @@ # This file contains fish universal variable definitions. # VERSION: 3.0 -SETUVAR __fish_initialized:3800 -SETUVAR fish_color_autosuggestion:brblack -SETUVAR fish_color_cancel:\x2dr -SETUVAR fish_color_command:blue -SETUVAR fish_color_comment:red -SETUVAR fish_color_cwd:green -SETUVAR fish_color_cwd_root:red -SETUVAR fish_color_end:green -SETUVAR fish_color_error:brred -SETUVAR fish_color_escape:brcyan -SETUVAR fish_color_history_current:\x2d\x2dbold -SETUVAR fish_color_host:normal -SETUVAR fish_color_host_remote:yellow -SETUVAR fish_color_normal:normal -SETUVAR fish_color_operator:brcyan -SETUVAR fish_color_param:cyan -SETUVAR fish_color_quote:yellow -SETUVAR fish_color_redirection:cyan\x1e\x2d\x2dbold -SETUVAR fish_color_search_match:white\x1e\x2d\x2dbackground\x3dbrblack -SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack -SETUVAR fish_color_status:red -SETUVAR fish_color_user:brgreen -SETUVAR fish_color_valid_path:\x2d\x2dunderline -SETUVAR fish_key_bindings:fish_default_key_bindings -SETUVAR fish_pager_color_completion:normal -SETUVAR fish_pager_color_description:yellow\x1e\x2di -SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline -SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan -SETUVAR fish_pager_color_selected_background:\x2dr -SETUVAR fish_user_paths:/opt/homebrew/opt/php\x408\x2e1/bin\x1e/Users/arc/\x2ecargo/bin\x1e/opt/homebrew/bin\x1e/usr/local/libexec\x1e/home/arc/\x2elocal/share/fnm +SETUVAR __fish_initialized:4300 +SETUVAR fish_user_paths:/opt/homebrew/opt/php\x408\x2e1/bin\x1e/Users/arc/\x2ecargo/bin\x1e/opt/homebrew/bin\x1e/usr/local/libexec\x1e/home/arc/\x2elocal/share/fnm\x1e/home/arc/vivado/2025\x2e2/Vivado/bin diff --git a/fish/fish/functions/!!.fish b/fish/fish/functions/!!.fish index 3bbe196..6bb279e 100644 --- a/fish/fish/functions/!!.fish +++ b/fish/fish/functions/!!.fish @@ -1,3 +1,3 @@ -function !! --wraps='code .' --description 'alias !! code .' - code . $argv +function !! --wraps='ssh 192.168.0.6' --description 'alias !! ssh 192.168.0.6' + ssh 192.168.0.6 $argv end diff --git a/neovim/nvim/init.lua b/neovim/nvim/init.lua index 596c61b..068d606 100644 --- a/neovim/nvim/init.lua +++ b/neovim/nvim/init.lua @@ -78,10 +78,10 @@ vim.opt.listchars = 'tab:^ ,nbsp:¬,extends:»,precedes:«,trail:•' -- Arc, March 20, 2025 -- Setting the filetype for Verilog vim.api.nvim_create_autocmd( - {"BufNewFile", "BufRead"}, { - pattern = {"*.v"}, - command = "set filetype=verilog", - } + { "BufNewFile", "BufRead" }, { + pattern = { "*.v" }, + command = "set filetype=verilog", + } ) ------------------------------------------------------------------------------- @@ -92,7 +92,7 @@ vim.api.nvim_create_autocmd( -- quick-open -- Replaced with FZF instead of Files because files pulls up empty for some reason - 2024-10-2 vim.keymap.set('', '', 'FZF') - -- vim.keymap.set('', '', 'Files') +-- vim.keymap.set('', '', 'Files') -- search buffers vim.keymap.set('n', ';', 'Buffers') -- quick-save @@ -166,8 +166,14 @@ vim.keymap.set('n', 'm', 'ct_') vim.keymap.set('', '', '') vim.keymap.set('i', '', '') +-- Allow virtual text +vim.diagnostic.config({ + virtual_text = true, + virtual_lines = false +}) + -- Use f2 to rename symbol (arc) - 2024-10-02 -vim.keymap.set('n', '', function () vim.lsp.buf.rename() end) +vim.keymap.set('n', '', function() vim.lsp.buf.rename() end) ------------------------------------------------------------------------------ -- -- autocommands @@ -214,13 +220,13 @@ vim.api.nvim_create_autocmd({ 'BufNewFile', 'BufRead' }, { -- also, produce "flowed text" wrapping -- https://brianbuccola.com/line-breaks-in-mutt-and-vim/ vim.api.nvim_create_autocmd('Filetype', { - pattern = 'mail', - group = email, - command = 'setlocal formatoptions+=w', + pattern = 'mail', + group = email, + command = 'setlocal formatoptions+=w', }) -- shorter columns in text because it reads better that way local text = vim.api.nvim_create_augroup('text', { clear = true }) -for _, pat in ipairs({'text', 'markdown', 'mail', 'gitcommit'}) do +for _, pat in ipairs({ 'text', 'markdown', 'mail', 'gitcommit' }) do vim.api.nvim_create_autocmd('Filetype', { pattern = pat, group = text, @@ -257,29 +263,6 @@ vim.opt.rtp:prepend(lazypath) -- then, setup! require("lazy").setup({ -- main color scheme - -- Switched to https://github.com/projekt0n/github-nvim-theme - -- - -- { - -- "projekt0n/github-nvim-theme", - -- lazy = false, -- load at start - -- priority = 1000, -- load first - -- config = function() - -- vim.cmd([[colorscheme github_dark]]) - -- vim.o.background = 'dark' - -- -- XXX: hi Normal ctermbg=NONE - -- -- Make comments more prominent -- they are important. - -- local bools = vim.api.nvim_get_hl(0, { name = 'Boolean' }) - -- vim.api.nvim_set_hl(0, 'Comment', bools) - -- -- Make it clearly visible which argument we're at. - -- local marked = vim.api.nvim_get_hl(0, { name = 'PMenu' }) - -- vim.api.nvim_set_hl(0, 'LspSignatureActiveParameter', { fg = marked.fg, bg = marked.bg, ctermfg = marked.ctermfg, ctermbg = marked.ctermbg, bold = true }) - -- -- XXX - -- -- Would be nice to customize the highlighting of warnings and the like to make - -- -- them less glaring. But alas - -- -- https://github.com/nvim-lua/lsp_extensions.nvim/issues/21 - -- -- call Base16hi("CocHintSign", g:base16_gui03, "", g:base16_cterm03, "", "", "") - -- end - -- }, -- nice bar at the bottom { "wincent/base16-nvim", @@ -288,13 +271,15 @@ require("lazy").setup({ config = function() vim.cmd([[colorscheme gruvbox-dark-hard]]) vim.o.background = 'dark' - -- XXX: hi Normal ctermbg=NONE + vim.cmd([[hi Normal ctermbg=NONE]]) + vim.api.nvim_set_hl(0, "WinSeparator", { fg = 1250067 }) -- Make comments more prominent -- they are important. local bools = vim.api.nvim_get_hl(0, { name = 'Boolean' }) vim.api.nvim_set_hl(0, 'Comment', bools) -- Make it clearly visible which argument we're at. local marked = vim.api.nvim_get_hl(0, { name = 'PMenu' }) - vim.api.nvim_set_hl(0, 'LspSignatureActiveParameter', { fg = marked.fg, bg = marked.bg, ctermfg = marked.ctermfg, ctermbg = marked.ctermbg, bold = true }) + vim.api.nvim_set_hl(0, 'LspSignatureActiveParameter', + { fg = marked.fg, bg = marked.bg, ctermfg = marked.ctermfg, ctermbg = marked.ctermbg, bold = true }) -- XXX -- Would be nice to customize the highlighting of warnings and the like to make -- them less glaring. But alas @@ -312,7 +297,7 @@ require("lazy").setup({ vim.g.lightline = { active = { left = { - { 'mode', 'paste' }, + { 'mode', 'paste' }, { 'readonly', 'filename', 'modified' } }, right = { @@ -332,6 +317,7 @@ require("lazy").setup({ return vim.fn.getreg('%') end end + -- https://github.com/itchyny/lightline.vim/issues/657 vim.api.nvim_exec( [[ @@ -345,10 +331,10 @@ require("lazy").setup({ }, -- quick navigation { - 'ggandor/leap.nvim', + "https://codeberg.org/andyg/leap.nvim", config = function() - vim.keymap.set({'n', 'x', 'o'}, 's', '(leap)') - vim.keymap.set('n', 'S', '(leap-from-window)') + vim.keymap.set({ 'n', 'x', 'o' }, 's', '(leap)') + vim.keymap.set('n', 'S', '(leap-from-window)') end }, -- better % @@ -369,60 +355,92 @@ require("lazy").setup({ -- }, -- hopefully fix random crashes? { - 'hrsh7th/vim-vsnip' + 'hrsh7th/vim-vsnip' }, - -- fzf support for ^p + { - 'junegunn/fzf.vim', - -- dependencies = { - -- { 'junegunn/fzf', dir = '~/.fzf', build = './install --all' }, - -- }, + 'ibhagwan/fzf-lua', config = function() - -- stop putting a giant window over my editor - vim.g.fzf_layout = { down = '~20%' } - -- when using :Files, pass the file list through + require 'fzf-lua'.setup { + winopts = { + -- stop putting a giant window over my editor + split = "belowright 10new", + preview = { + hidden = true, + } + }, + files = { + -- file icons are distracting + file_icons = false, + -- git icons are nice + git_icons = true, + -- don't touch anchored search + _fzf_nth_devicons = true + }, + buffers = { + file_icons = false, + git_icons = true + }, + fzf_opts = { + -- no reverse view + ["--layout"] = "default" + } + } + -- when using C-p for quick file open, pass the file list through -- -- https://github.com/jonhoo/proximity-sort -- -- to prefer files closer to the current file. - function list_cmd() + vim.keymap.set('', '', function() + opts = {} + opts.cmd = 'fd --color=never --hidden --type f --type l --exclude .git' local base = vim.fn.fnamemodify(vim.fn.expand('%'), ':h:.:S') - if base == '.' then + if base ~= '.' then -- if there is no current file, -- proximity-sort can't do its thing - return 'fd --type file --follow' - else - return vim.fn.printf('fd --type file --follow | proximity-sort %s', vim.fn.shellescape(vim.fn.expand('%'))) + opts.cmd = opts.cmd .. (" | proximity-sort %s"):format(vim.fn.shellescape(vim.fn.expand('%'))) end - end - vim.api.nvim_create_user_command('Files', function(arg) - vim.fn['fzf#vim#files'](arg.qargs, { source = list_cmd(), options = '--tiebreak=index' }, arg.bang) - end, { bang = true, nargs = '?', complete = "dir" }) + opts.fzf_opts = { + ['--scheme'] = 'path', + ['--tiebreak'] = 'index', + ["--layout"] = "default", + } + require 'fzf-lua'.files(opts) + end) + -- use fzf to search buffers as well + vim.keymap.set('n', ';', function() + require 'fzf-lua'.buffers({ + -- just include the paths in the fzf bits, and nothing else + -- https://github.com/ibhagwan/fzf-lua/issues/2230#issuecomment-3164258823 + fzf_opts = { + ["--with-nth"] = "{-3..-2}", + ["--nth"] = "-1", + ["--delimiter"] = "[:\u{2002}]", + ["--header-lines"] = "false", + }, + header = false, + }) + end) end }, - { - 'junegunn/fzf' - }, -- LSP { 'neovim/nvim-lspconfig', config = function() -- Setup language servers. - local lspconfig = require('lspconfig') - -- Server-specific settings. See `:help lspconfig-setup` + -- Server-specific settings. See `:help lspconfig-setup` + vim.lsp.config('rust_analyzer', { settings = { - ["rust-analyzer"] = { + ["rust_analyzer"] = { cargo = { features = "all" }, checkOnSave = { - enable = true, - features = "all", - command = "clippy" + enable = true, }, check = { - command = "clippy" + command = "clippy" }, imports = { group = { @@ -431,25 +449,37 @@ require("lazy").setup({ }, completion = { postfix = { - -- Commened out to see if I like it more (arc) - 2024-10-03 - -- enable = false, + -- Commened out to see if I like it more (arc) - 2024-10-03 + -- enable = false, }, }, }, }, + }) -- Rust vim.lsp.enable('rust_analyzer') - + -- C/C++ if vim.fn.executable('clangd') == 1 then - vim.lsp.enable('clangd') + vim.lsp.enable('clangd') end - + + -- Dafny + vim.lsp.enable('dafny') + -- Javascript - vim.lsp.enable("ts_ls") + if vim.fn.executable('ts_ls') then + vim.lsp.enable("ts_ls") + end + + -- Python + if vim.fn.executable('ruff') == 1 then + vim.lsp.enable('ruff') + end -- Svelte vim.lsp.enable("svelte") + -- Lua vim.lsp.enable('lua_ls') @@ -491,15 +521,25 @@ require("lazy").setup({ local client = vim.lsp.get_client_by_id(ev.data.client_id) - -- When https://neovim.io/doc/user/lsp.html#lsp-inlay_hint stabilizes - -- *and* there's some way to make it only apply to the current line. - -- if client.server_capabilities.inlayHintProvider then - -- vim.lsp.inlay_hint(ev.buf, true) - -- end + -- TODO: find some way to make it only apply to the current line. + if client.server_capabilities.inlayHintProvider then + vim.lsp.inlay_hint.enable(false, { bufnr = bufnr }) + end -- None of this semantics tokens business. -- https://www.reddit.com/r/neovim/comments/143efmd/is_it_possible_to_disable_treesitter_completely/ client.server_capabilities.semanticTokensProvider = nil + + -- format on save for Rust + if client.server_capabilities.documentFormattingProvider then + vim.api.nvim_create_autocmd("BufWritePre", { + group = vim.api.nvim_create_augroup("RustFormat", { clear = true }), + buffer = bufnr, + callback = function() + vim.lsp.buf.format({ bufnr = bufnr }) + end + }) + end end, }) end @@ -518,12 +558,12 @@ require("lazy").setup({ "hrsh7th/cmp-path", }, config = function() - local cmp = require'cmp' + local cmp = require 'cmp' cmp.setup({ snippet = { -- REQUIRED by nvim-cmp. get rid of it once we can expand = function(args) - vim.fn["vsnip#anonymous"](args.body) + vim.snippet.expand(args.body) end, }, mapping = cmp.mapping.preset.insert({ @@ -569,6 +609,19 @@ require("lazy").setup({ end }, -- language support + -- treesitter + { + 'nvim-treesitter/nvim-treesitter', + lazy = false, + build = ':TSUpdate', + -- config = function() + -- require('nvim-treesitter.configs').setup({ + -- highlight = { + -- enable = true + -- } + -- }) + -- end + }, -- terraform { 'hashivim/vim-terraform', @@ -578,7 +631,7 @@ require("lazy").setup({ 'cespare/vim-toml', -- yaml { - "cuducos/yaml.nvim", + "https://tangled.org/cuducos.me/yaml.nvim", ft = { "yaml" }, dependencies = { "nvim-treesitter/nvim-treesitter", @@ -618,6 +671,25 @@ require("lazy").setup({ }, }) +-- Manually inject support for Dafny into tree-sitter +vim.api.nvim_create_autocmd('FileType', { + pattern = { 'dafny' }, + callback = function() vim.treesitter.start() end, +}) +vim.api.nvim_create_autocmd('User', { + pattern = 'TSUpdate', + callback = function() + require('nvim-treesitter.parsers').dafny = { + install_info = { + url = 'https://github.com/oscar-bender-stone/tree-sitter-dafny', + revision = "4a78fb62bbafcaac23fd2cb07ac8063e92c2af51", -- commit hash for revision to check out; HEAD if missing + -- optional entries: + queries = 'queries/neovim', -- also install queries from given directory + }, + } + end +}) + -- Hypothetically makes hover work on hover - arc, aug 6, 2025 -- Commented out because it prevents me from looking at errors, aug 7: -- vim.api.nvim_create_autocmd({"CursorHold", "CursorHoldI"}, { diff --git a/neovim/nvim/lazy-lock.json b/neovim/nvim/lazy-lock.json index 0d12ff1..1898182 100644 --- a/neovim/nvim/lazy-lock.json +++ b/neovim/nvim/lazy-lock.json @@ -1,24 +1,23 @@ { - "base16-nvim": { "branch": "main", "commit": "6e503dc07bf22317c7e755dc0569a2bad6cfd9ce" }, + "base16-nvim": { "branch": "main", "commit": "9339f82d6ff6e6ba423a2a0a6a1c42a2a696f5f5" }, "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, "cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" }, "cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" }, - "fzf": { "branch": "master", "commit": "535b610a6b0858364cfb12cee8b5ae7132883ea0" }, - "fzf.vim": { "branch": "master", "commit": "879db51d0965515cdaef9b7f6bdeb91c65d2829e" }, - "lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" }, - "leap.nvim": { "branch": "main", "commit": "614481baedb1c11df1d88338005b3e8c15349dcf" }, - "lightline.vim": { "branch": "master", "commit": "e358557e1a9f9fc860416c8eb2e34c0404078155" }, - "lsp_signature.nvim": { "branch": "master", "commit": "15bb33cdb47e85278e168cad11acb1b6fa9c6488" }, - "nvim-cmp": { "branch": "main", "commit": "106c4bcc053a5da783bf4a9d907b6f22485c2ea0" }, - "nvim-lspconfig": { "branch": "master", "commit": "b34fbdffdcb6295c7a25df6ba375452a2e73c32e" }, - "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "fzf-lua": { "branch": "main", "commit": "b9f947aa15f7f050b0032a8e03f210005aedb897" }, + "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, + "leap.nvim": { "branch": "main", "commit": "b960d5038c5c505c52e56a54490f9bbb1f0e6ef6" }, + "lightline.vim": { "branch": "master", "commit": "6c283f8df85aa7219fa4096a6ed4ff45d48aa9e1" }, + "lsp_signature.nvim": { "branch": "master", "commit": "a65b38f260cc3470a05b4afb84c8d868617d476d" }, + "nvim-cmp": { "branch": "main", "commit": "a1d504892f2bc56c2e79b65c6faded2fd21f3eca" }, + "nvim-lspconfig": { "branch": "master", "commit": "d10ce09e42bb0ca8600fd610c3bb58676e61208d" }, + "nvim-treesitter": { "branch": "main", "commit": "4916d6592ede8c07973490d9322f187e07dfefac" }, "rust.vim": { "branch": "master", "commit": "889b9a7515db477f4cb6808bef1769e53493c578" }, "tabular": { "branch": "master", "commit": "12437cd1b53488e24936ec4b091c9324cafee311" }, "vim-fish-syntax": { "branch": "master", "commit": "e229becbf4bbee21cc78cd2cf24f57112e33c02a" }, "vim-markdown": { "branch": "master", "commit": "1bc9d0cd8e1cc3e901b0a49c2b50a843f1c89397" }, - "vim-matchup": { "branch": "master", "commit": "1c276e12b49a83c1bdca74351187b8adea5da4b9" }, + "vim-matchup": { "branch": "master", "commit": "dccb2d12ef2a703d2f076b3cda36a3339449d1eb" }, "vim-terraform": { "branch": "master", "commit": "520498fab16a3a11f2ae1b8cb65e0a1684bc317a" }, - "vim-toml": { "branch": "main", "commit": "1b63257680eeb65677eb1ca5077809a982756d58" }, + "vim-toml": { "branch": "main", "commit": "da051b7c23bad3c52d18886203c594739780ec09" }, "vim-vsnip": { "branch": "master", "commit": "9bcfabea653abdcdac584283b5097c3f8760abaa" }, - "yaml.nvim": { "branch": "main", "commit": "e70ee49f7aefc79dce020d3ffc3c9447b0c52236" } + "yaml.nvim": { "branch": "main", "commit": "b6eaf919fb0a2a254ce20ae657787d67e6b9300e" } } diff --git a/neovim/nvim/queries/dafny/highlights.scm b/neovim/nvim/queries/dafny/highlights.scm new file mode 100644 index 0000000..0a7f76e --- /dev/null +++ b/neovim/nvim/queries/dafny/highlights.scm @@ -0,0 +1,53 @@ +; https://github.com/nvim-treesitter/nvim-treesitter/blob/main/CONTRIBUTING.md +; https://tree-sitter.github.io/tree-sitter/using-parsers/queries/1-syntax.html +(comment) @comment +(string) @string + +; Modules +(module_definition ["module"] @module) +(module_definition (identifier) @variable) + +; Methods/Functions +(method_definition ["method"] @function.method) +(function_definition ["function"] @function) +(verification_clause [ + "decreases" + "ensures" + "invariant" + "modifies" + "provides" + "reads" + "requires" + ] @attribute) +(returns_clause ["returns"] @keyword.return) + +; Variables +(var_decl ["var"] @variable) +(primitive_type) @type +(number) @number + + +(import_declaration) @keyword.import +(attributes) @attribute + +; Control flow +(if_statement ["if" "else"] @keyword.conditional) +(if_expression ["if" "then" "else"] @keyword.conditional) + +; Looping constructs +(while_statement ["while"] @keyword.repeat) +(while_statement ["invariant"] @attribute) +; Debug +(assert_statement ["assert"] @keyword.debug) +(expect_statement ["expect"] @keyword.debug) + +"(" @punctuation.bracket +")" @punctuation.bracket +"<" @punctuation.bracket +">" @punctuation.bracket +"[" @punctuation.bracket +"]" @punctuation.bracket +"{" @punctuation.bracket +"}" @punctuation.bracket +";" @punctuation.delimiter +