diff --git a/zsh/completions/_rust b/zsh/completions/_rust deleted file mode 100644 index 404f622..0000000 --- a/zsh/completions/_rust +++ /dev/null @@ -1,215 +0,0 @@ -#compdef rustc - -local -a _rustc_opts_switches _rustc_opts_lint _rustc_opts_debug - -typeset -A opt_args - -_rustc_debuginfo_levels=( - "0[no debug info]" - "1[line-tables only (for stacktraces and breakpoints)]" - "2[full debug info with variable and type information (same as -g)]" -) - -_rustc_crate_types=( - 'bin' - 'lib' - 'rlib' - 'dylib' - 'staticlib' -) - -_rustc_emit_types=( - 'asm' - 'llvm-bc' - 'llvm-ir' - 'obj' - 'link' - 'dep-info' -) -_rustc_pretty_types=( - 'normal[un-annotated source]' - 'expanded[crates expanded]' - 'typed[crates expanded, with type annotations]' - 'identified[fully parenthesized, AST nodes and blocks with IDs]' - 'flowgraph[graphviz formatted flowgraph for node]:NODEID:' -) -_rustc_color_types=( - 'auto[colorize, if output goes to a tty (default)]' - 'always[always colorize output]' - 'never[never colorize output]' -) -_rustc_info_types=( - 'crate-name[Output the crate name and exit]' - 'file-names[Output the file(s) that would be written if compilation continued and exited]' - 'sysroot[Output the sysroot and exit]' -) - -_rustc_opts_vals=( - --crate-name='[Specify the name of the crate being built]' - --crate-type='[Comma separated list of types of crates for the compiler to emit]:TYPES:_values -s "," "Crate types" "$_rustc_crate_types[@]"' - --emit='[Comma separated list of types of output for the compiler to emit]:TYPES:_values -s "," "Emit Targets" "$_rustc_emit_types[@]"' - --cfg='[Configure the compilation environment]:SPEC:' - --out-dir='[Write output to compiler-chosen filename in . Ignored if -o is specified. (default the current directory)]:DIR:_files -/' - -o'[Write output to . Ignored if more than one --emit is specified.]:FILENAME:_files' - --pretty='[Pretty-print the input instead of compiling]::TYPE:_values "TYPES" "$_rustc_pretty_types[@]"' - -L'[Add a directory to the library search path]:DIR:_files -/' - --target='[Target triple cpu-manufacturer-kernel\[-os\] to compile]:TRIPLE:' - --color='[Configure coloring of output]:CONF:_values "COLORS" "$_rustc_color_types[@]"' - {-v,--version}'[Print version info and exit]::VERBOSE:(verbose)' - --explain='[Provide a detailed explanation of an error message]:OPT:' - --extern'[Specify where an external rust library is located]:ARG:' - --print='[Comma separated list of compiler information to print on stdout]:TYPES:_values -s "," "Compiler Information" "$_rustc_info_types[@]"' -) - -_rustc_opts_switches=( - -g'[Equivalent to -C debuginfo=2]' - {-h,--help}'[Display the help message]' - {-V,--verbose}'[use verbose output]' - -O'[Equivalent to -C opt-level=2]' - --test'[Build a test harness]' -) - - -_rustc_opts_link=( - 'static[Path to the library to link statically]:PATH:_files -/' - 'dylib[Path to the library to link dynamically]:PATH:_files -/' - 'framework[Path to the library to link as a framework]:PATH:_files -/' -) - -_rustc_opts_codegen=( - 'ar[Path to the archive utility to use when assembling archives.]:BIN:_path_files' - 'linker[Path to the linker utility to use when linking libraries, executables, and objects.]:BIN:_path_files' - 'link-args[A space-separated list of extra arguments to pass to the linker when the linker is invoked.]:ARGS:' - 'lto[Perform LLVM link-time optimizations]' - 'target-cpu[Selects a target processor. If the value is "help", then a list of available CPUs is printed.]:CPU:' - 'target-feature[A space-separated list of features to enable or disable for the target. A preceding "+" enables a feature while a preceding "-" disables it. Available features can be discovered through target-cpu=help.]:FEATURE:' - 'passes[A space-separated list of extra LLVM passes to run. A value of "list" will cause rustc to print all known passes and exit. The passes specified are appended at the end of the normal pass manager.]:LIST:' - 'llvm-args[A space-separated list of arguments to pass through to LLVM.]:ARGS:' - 'save-temps[If specified, the compiler will save more files (.bc, .o, .no-opt.bc) generated throughout compilation in the output directory.]' - 'rpath[If specified, then the rpath value for dynamic libraries will be set in either dynamic library or executable outputs.]' - 'no-prepopulate-passes[Suppresses pre-population of the LLVM pass manager that is run over the module.]' - 'no-vectorize-loops[Suppresses running the loop vectorization LLVM pass, regardless of optimization level.]' - 'no-vectorize-slp[Suppresses running the LLVM SLP vectorization pass, regardless of optimization level.]' - 'soft-float[Generates software floating point library calls instead of hardware instructions.]' - 'prefer-dynamic[Prefers dynamic linking to static linking.]' - "no-integrated-as[Force usage of an external assembler rather than LLVM's integrated one.]" - 'no-redzone[disable the use of the redzone]' - 'relocation-model[The relocation model to use. (default: pic)]:MODEL:(pic static dynamic-no-pic)' - 'code-model[choose the code model to use (llc -code-model for details)]:MODEL:' - 'metadata[metadata to mangle symbol names with]:VAL:' - 'extra-filenames[extra data to put in each output filename]:VAL:' - 'codegen-units[divide crate into N units to optimize in parallel]:N:' - 'remark[print remarks for these optimization passes (space separated, or "all")]:TYPE:' - 'debuginfo[debug info emission level, 0 = no debug info, 1 = line tables only, 2 = full debug info with variable and type information]:LEVEL:_values "Debug Levels" "$_rustc_debuginfo_levels[@]"' - 'opt-level[Optimize with possible levels 0-3]:LEVEL:(0 1 2 3)' - 'help[Show all codegen options]' -) - -_rustc_opts_lint=( - 'help[Show a list of all lints]' - 'box-pointers[(default: allow) use of owned (Box type) heap memory]' - 'experimental[(default: allow) detects use of #\[experimental\] items]' - 'fat-ptr-transmutes[(default: allow) detects transmutes of fat pointers]' - 'missing-docs[(default: allow) detects missing documentation for public members]' - 'unsafe-blocks[(default: allow) usage of an "unsafe" block]' - 'unstable[(default: allow) detects use of #\[unstable\] items (incl. items with no stability attribute)]' - 'unused-extern-crates[(default: allow) extern crates that are never used]' - 'unused-import-braces[(default: allow) unnecessary braces around an imported item]' - 'unused-qualifications[(default: allow) detects unnecessarily qualified names]' - 'unused-results[(default: allow) unused result of an expression in a statement]' - 'unused-typecasts[(default: allow) detects unnecessary type casts that can be removed]' - 'variant-size-differences[(default: allow) detects enums with widely varying variant sizes]' - 'dead-code[(default: warn) detect unused, unexported items]' - 'deprecated[(default: warn) detects use of #\[deprecated\] items]' - 'improper-ctypes[(default: warn) proper use of libc types in foreign modules]' - 'missing-copy-implementations[(default: warn) detects potentially-forgotten implementations of "Copy"]' - 'non-camel-case-types[(default: warn) types, variants, traits and type parameters should have camel case names]' - 'non-shorthand-field-patterns[(default: warn) using "Struct { x: x }" instead of "Struct { x }"]' - 'non-snake-case[(default: warn) methods, functions, lifetime parameters and modules should have snake case names]' - 'non-upper-case-globals[(default: warn) static constants should have uppercase identifiers]' - 'overflowing-literals[(default: warn) literal out of range for its type]' - 'path-statements[(default: warn) path statements with no effect]' - 'raw-pointer-deriving[(default: warn) uses of #\[derive\] with raw pointers are rarely correct]' - 'unknown-lints[(default: warn) unrecognized lint attribute]' - 'unreachable-code[(default: warn) detects unreachable code paths]' - 'unsigned-negation[(default: warn) using an unary minus operator on unsigned type]' - 'unused-allocation[(default: warn) detects unnecessary allocations that can be eliminated]' - 'unused-assignments[(default: warn) detect assignments that will never be read]' - 'unused-attributes[(default: warn) detects attributes that were not used by the compiler]' - 'unused-comparisons[(default: warn) comparisons made useless by limits of the types involved]' - 'unused-imports[(default: warn) imports that are never used]' - 'unused-must-use[(default: warn) unused result of a type flagged as must_use]' - "unused-mut[(default: warn) detect mut variables which don't need to be mutable]" - 'unused-parens[(default: warn) "if", "match", "while" and "return" do not need parentheses]' - 'unused-unsafe[(default: warn) unnecessary use of an "unsafe" block]' - 'unused-variables[(default: warn) detect variables which are not used in any way]' - 'warnings[(default: warn) mass-change the level for lints which produce warnings]' - 'while-true[(default: warn) suggest using "loop { }" instead of "while true { }"]' - "exceeding-bitshifts[(default: deny) shift exceeds the type's number of bits]" - 'unknown-crate-types[(default: deny) unknown crate type found in #\[crate_type\] directive]' - 'unknown-features[(default: deny) unknown features found in crate-level #\[feature\] directives]' - 'bad-style[non-camel-case-types, non-snake-case, non-upper-case-globals]' - 'unused[unused-imports, unused-variables, unused-assignments, dead-code, unused-mut, unreachable-code, unused-must-use, unused-unsafe, path-statements]' -) - -_rustc_opts_debug=( - 'verbose[in general, enable more debug printouts]' - 'time-passes[measure time of each rustc pass]' - 'count-llvm-insns[count where LLVM instrs originate]' - 'time-llvm-passes[measure time of each LLVM pass]' - 'trans-stats[gather trans statistics]' - 'asm-comments[generate comments into the assembly (may change behavior)]' - 'no-verify[skip LLVM verification]' - 'borrowck-stats[gather borrowck statistics]' - 'no-landing-pads[omit landing pads for unwinding]' - 'debug-llvm[enable debug output from LLVM]' - 'show-span[show spans for compiler debugging]' - 'count-type-sizes[count the sizes of aggregate types]' - 'meta-stats[gather metadata statistics]' - 'print-link-args[Print the arguments passed to the linker]' - 'gc[Garbage collect shared data (experimental)]' - 'print-llvm-passes[Prints the llvm optimization passes being run]' - 'ast-json[Print the AST as JSON and halt]' - 'ast-json-noexpand[Print the pre-expansion AST as JSON and halt]' - 'ls[List the symbols defined by a library crate]' - 'save-analysis[Write syntax and type analysis information in addition to normal output]' - 'flowgraph-print-loans[Include loan analysis data in --pretty flowgraph output]' - 'flowgraph-print-moves[Include move analysis data in --pretty flowgraph output]' - 'flowgraph-print-assigns[Include assignment analysis data in --pretty flowgraph output]' - 'flowgraph-print-all[Include all dataflow analysis data in --pretty flowgraph output]' - 'print-regiion-graph[Prints region inference graph. Use with RUST_REGION_GRAPH=help for more info]' - 'parse-only[Parse only; do not compile, assemble, or link]' - 'no-trans[Run all passes except translation; no output]' - 'no-analysis[Parse and expand the source, but run no analysis]' - 'unstable-options[Adds unstable command line options to rustc interface]' - 'print-enum-sizes[Print the size of enums and their variants]' -) - -_rustc_opts_fun_lint(){ - _values -s , 'options' \ - "$_rustc_opts_lint[@]" -} - -_rustc_opts_fun_debug(){ - _values 'options' "$_rustc_opts_debug[@]" -} - -_rustc_opts_fun_codegen(){ - _values 'options' "$_rustc_opts_codegen[@]" -} - -_rustc_opts_fun_link(){ - _values 'options' "$_rustc_opts_link[@]" -} - -_arguments -s : \ - '(-W --warn)'{-W,--warn=}'[Set lint warnings]:lint options:_rustc_opts_fun_lint' \ - '(-A --allow)'{-A,--allow=}'[Set lint allowed]:lint options:_rustc_opts_fun_lint' \ - '(-D --deny)'{-D,--deny=}'[Set lint denied]:lint options:_rustc_opts_fun_lint' \ - '(-F --forbid)'{-F,--forbid=}'[Set lint forbidden]:lint options:_rustc_opts_fun_lint' \ - '*-Z[Set internal debugging options]:debug options:_rustc_opts_fun_debug' \ - '(-C --codegen)'{-C,--codegen}'[Set internal Codegen options]:codegen options:_rustc_opts_fun_codegen' \ - '*-l[Link the generated crates to the specified native library NAME. the optional KIND can be one of, static, dylib, or framework. If omitted, dylib is assumed.]:ARG:_rustc_opts_fun_link' \ - "$_rustc_opts_switches[@]" \ - "$_rustc_opts_vals[@]" \ - '::files:_files -g "*.rs"' diff --git a/zsh/completions/_rustup b/zsh/completions/_rustup deleted file mode 100644 index 4a84ba9..0000000 --- a/zsh/completions/_rustup +++ /dev/null @@ -1,1070 +0,0 @@ -#compdef rustup - -autoload -U is-at-least - -_rustup() { - typeset -A opt_args - typeset -a _arguments_options - local ret=1 - - if is-at-least 5.2; then - _arguments_options=(-s -S -C) - else - _arguments_options=(-s -C) - fi - - local context curcontext="$curcontext" state line - _arguments "${_arguments_options[@]}" \ -'-v[Enable verbose output]' \ -'--verbose[Enable verbose output]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -":: :_rustup_commands" \ -"*::: :->rustup" \ -&& ret=0 - case $state in - (rustup) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:rustup-command-$line[1]:" - case $line[1] in - (show) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -":: :_rustup__show_commands" \ -"*::: :->show" \ -&& ret=0 -case $state in - (show) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:rustup-show-command-$line[1]:" - case $line[1] in - (active-toolchain) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; - esac - ;; -esac -;; -(install) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ -&& ret=0 -;; -(uninstall) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ -&& ret=0 -;; -(update) -_arguments "${_arguments_options[@]}" \ -'--no-self-update[Don'\''t perform self update when running the `rustup` command]' \ -'--force[Force an update, even if some components are missing]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -'::toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ -&& ret=0 -;; -(default) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ -&& ret=0 -;; -(toolchain) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -":: :_rustup__toolchain_commands" \ -"*::: :->toolchain" \ -&& ret=0 -case $state in - (toolchain) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:rustup-toolchain-command-$line[1]:" - case $line[1] in - (list) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(update) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ -&& ret=0 -;; -(add) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ -&& ret=0 -;; -(install) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ -&& ret=0 -;; -(remove) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ -&& ret=0 -;; -(uninstall) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ -&& ret=0 -;; -(link) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ -':path:_files' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; - esac - ;; -esac -;; -(target) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -":: :_rustup__target_commands" \ -"*::: :->target" \ -&& ret=0 -case $state in - (target) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:rustup-target-command-$line[1]:" - case $line[1] in - (list) -_arguments "${_arguments_options[@]}" \ -'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(install) -_arguments "${_arguments_options[@]}" \ -'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':target:_files' \ -&& ret=0 -;; -(add) -_arguments "${_arguments_options[@]}" \ -'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':target:_files' \ -&& ret=0 -;; -(uninstall) -_arguments "${_arguments_options[@]}" \ -'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':target:_files' \ -&& ret=0 -;; -(remove) -_arguments "${_arguments_options[@]}" \ -'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':target:_files' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; - esac - ;; -esac -;; -(component) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -":: :_rustup__component_commands" \ -"*::: :->component" \ -&& ret=0 -case $state in - (component) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:rustup-component-command-$line[1]:" - case $line[1] in - (list) -_arguments "${_arguments_options[@]}" \ -'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(add) -_arguments "${_arguments_options[@]}" \ -'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ -'--target=[]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':component:_files' \ -&& ret=0 -;; -(remove) -_arguments "${_arguments_options[@]}" \ -'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ -'--target=[]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':component:_files' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; - esac - ;; -esac -;; -(override) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -":: :_rustup__override_commands" \ -"*::: :->override" \ -&& ret=0 -case $state in - (override) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:rustup-override-command-$line[1]:" - case $line[1] in - (list) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(add) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ -&& ret=0 -;; -(set) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ -&& ret=0 -;; -(remove) -_arguments "${_arguments_options[@]}" \ -'--path=[Path to the directory]' \ -'--nonexistent[Remove override toolchain for all nonexistent directories]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(unset) -_arguments "${_arguments_options[@]}" \ -'--path=[Path to the directory]' \ -'--nonexistent[Remove override toolchain for all nonexistent directories]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; - esac - ;; -esac -;; -(run) -_arguments "${_arguments_options[@]}" \ -'--install[Install the requested toolchain if needed]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ -':command:_files' \ -&& ret=0 -;; -(which) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':command:_files' \ -&& ret=0 -;; -(docs) -_arguments "${_arguments_options[@]}" \ -'--path[Only print the path to the documentation]' \ -'--book[The Rust Programming Language book]' \ -'--std[Standard library API documentation]' \ -'--reference[The Rust Reference]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(doc) -_arguments "${_arguments_options[@]}" \ -'--path[Only print the path to the documentation]' \ -'--book[The Rust Programming Language book]' \ -'--std[Standard library API documentation]' \ -'--reference[The Rust Reference]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(man) -_arguments "${_arguments_options[@]}" \ -'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':command:_files' \ -&& ret=0 -;; -(self) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -":: :_rustup__self_commands" \ -"*::: :->self" \ -&& ret=0 -case $state in - (self) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:rustup-self-command-$line[1]:" - case $line[1] in - (update) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(uninstall) -_arguments "${_arguments_options[@]}" \ -'-y[]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(upgrade-data) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; - esac - ;; -esac -;; -(telemetry) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -":: :_rustup__telemetry_commands" \ -"*::: :->telemetry" \ -&& ret=0 -case $state in - (telemetry) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:rustup-telemetry-command-$line[1]:" - case $line[1] in - (enable) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(disable) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(analyze) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; - esac - ;; -esac -;; -(set) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -":: :_rustup__set_commands" \ -"*::: :->set" \ -&& ret=0 -case $state in - (set) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:rustup-set-command-$line[1]:" - case $line[1] in - (default-host) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':host_triple:_files' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; - esac - ;; -esac -;; -(completions) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -'::shell:(zsh bash fish powershell elvish)' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; - esac - ;; -esac -} - -(( $+functions[_rustup_commands] )) || -_rustup_commands() { - local commands; commands=( - "show:Show the active and installed toolchains" \ -"install:Update Rust toolchains" \ -"uninstall:Uninstall Rust toolchains" \ -"update:Update Rust toolchains and rustup" \ -"default:Set the default toolchain" \ -"toolchain:Modify or query the installed toolchains" \ -"target:Modify a toolchain's supported targets" \ -"component:Modify a toolchain's installed components" \ -"override:Modify directory toolchain overrides" \ -"run:Run a command with an environment configured for a given toolchain" \ -"which:Display which binary will be run for a given command" \ -"doc:Open the documentation for the current toolchain" \ -"man:View the man page for a given command" \ -"self:Modify the rustup installation" \ -"telemetry:rustup telemetry commands" \ -"set:Alter rustup settings" \ -"completions:Generate completion scripts for your shell" \ -"help:Prints this message or the help of the given subcommand(s)" \ - ) - _describe -t commands 'rustup commands' commands "$@" -} -(( $+functions[_rustup__show__active-toolchain_commands] )) || -_rustup__show__active-toolchain_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup show active-toolchain commands' commands "$@" -} -(( $+functions[_rustup__add_commands] )) || -_rustup__add_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup add commands' commands "$@" -} -(( $+functions[_rustup__component__add_commands] )) || -_rustup__component__add_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup component add commands' commands "$@" -} -(( $+functions[_rustup__override__add_commands] )) || -_rustup__override__add_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup override add commands' commands "$@" -} -(( $+functions[_rustup__target__add_commands] )) || -_rustup__target__add_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup target add commands' commands "$@" -} -(( $+functions[_rustup__toolchain__add_commands] )) || -_rustup__toolchain__add_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup toolchain add commands' commands "$@" -} -(( $+functions[_rustup__telemetry__analyze_commands] )) || -_rustup__telemetry__analyze_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup telemetry analyze commands' commands "$@" -} -(( $+functions[_rustup__completions_commands] )) || -_rustup__completions_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup completions commands' commands "$@" -} -(( $+functions[_rustup__component_commands] )) || -_rustup__component_commands() { - local commands; commands=( - "list:List installed and available components" \ -"add:Add a component to a Rust toolchain" \ -"remove:Remove a component from a Rust toolchain" \ -"help:Prints this message or the help of the given subcommand(s)" \ - ) - _describe -t commands 'rustup component commands' commands "$@" -} -(( $+functions[_rustup__default_commands] )) || -_rustup__default_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup default commands' commands "$@" -} -(( $+functions[_rustup__set__default-host_commands] )) || -_rustup__set__default-host_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup set default-host commands' commands "$@" -} -(( $+functions[_rustup__telemetry__disable_commands] )) || -_rustup__telemetry__disable_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup telemetry disable commands' commands "$@" -} -(( $+functions[_rustup__doc_commands] )) || -_rustup__doc_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup doc commands' commands "$@" -} -(( $+functions[_docs_commands] )) || -_docs_commands() { - local commands; commands=( - - ) - _describe -t commands 'docs commands' commands "$@" -} -(( $+functions[_rustup__docs_commands] )) || -_rustup__docs_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup docs commands' commands "$@" -} -(( $+functions[_rustup__telemetry__enable_commands] )) || -_rustup__telemetry__enable_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup telemetry enable commands' commands "$@" -} -(( $+functions[_rustup__component__help_commands] )) || -_rustup__component__help_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup component help commands' commands "$@" -} -(( $+functions[_rustup__help_commands] )) || -_rustup__help_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup help commands' commands "$@" -} -(( $+functions[_rustup__override__help_commands] )) || -_rustup__override__help_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup override help commands' commands "$@" -} -(( $+functions[_rustup__self__help_commands] )) || -_rustup__self__help_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup self help commands' commands "$@" -} -(( $+functions[_rustup__set__help_commands] )) || -_rustup__set__help_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup set help commands' commands "$@" -} -(( $+functions[_rustup__show__help_commands] )) || -_rustup__show__help_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup show help commands' commands "$@" -} -(( $+functions[_rustup__target__help_commands] )) || -_rustup__target__help_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup target help commands' commands "$@" -} -(( $+functions[_rustup__telemetry__help_commands] )) || -_rustup__telemetry__help_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup telemetry help commands' commands "$@" -} -(( $+functions[_rustup__toolchain__help_commands] )) || -_rustup__toolchain__help_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup toolchain help commands' commands "$@" -} -(( $+functions[_rustup__install_commands] )) || -_rustup__install_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup install commands' commands "$@" -} -(( $+functions[_rustup__target__install_commands] )) || -_rustup__target__install_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup target install commands' commands "$@" -} -(( $+functions[_rustup__toolchain__install_commands] )) || -_rustup__toolchain__install_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup toolchain install commands' commands "$@" -} -(( $+functions[_rustup__toolchain__link_commands] )) || -_rustup__toolchain__link_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup toolchain link commands' commands "$@" -} -(( $+functions[_rustup__component__list_commands] )) || -_rustup__component__list_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup component list commands' commands "$@" -} -(( $+functions[_rustup__override__list_commands] )) || -_rustup__override__list_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup override list commands' commands "$@" -} -(( $+functions[_rustup__target__list_commands] )) || -_rustup__target__list_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup target list commands' commands "$@" -} -(( $+functions[_rustup__toolchain__list_commands] )) || -_rustup__toolchain__list_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup toolchain list commands' commands "$@" -} -(( $+functions[_rustup__man_commands] )) || -_rustup__man_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup man commands' commands "$@" -} -(( $+functions[_rustup__override_commands] )) || -_rustup__override_commands() { - local commands; commands=( - "list:List directory toolchain overrides" \ -"set:Set the override toolchain for a directory" \ -"unset:Remove the override toolchain for a directory" \ -"help:Prints this message or the help of the given subcommand(s)" \ - ) - _describe -t commands 'rustup override commands' commands "$@" -} -(( $+functions[_rustup__component__remove_commands] )) || -_rustup__component__remove_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup component remove commands' commands "$@" -} -(( $+functions[_rustup__override__remove_commands] )) || -_rustup__override__remove_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup override remove commands' commands "$@" -} -(( $+functions[_rustup__remove_commands] )) || -_rustup__remove_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup remove commands' commands "$@" -} -(( $+functions[_rustup__target__remove_commands] )) || -_rustup__target__remove_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup target remove commands' commands "$@" -} -(( $+functions[_rustup__toolchain__remove_commands] )) || -_rustup__toolchain__remove_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup toolchain remove commands' commands "$@" -} -(( $+functions[_rustup__run_commands] )) || -_rustup__run_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup run commands' commands "$@" -} -(( $+functions[_rustup__self_commands] )) || -_rustup__self_commands() { - local commands; commands=( - "update:Download and install updates to rustup" \ -"uninstall:Uninstall rustup." \ -"upgrade-data:Upgrade the internal data format." \ -"help:Prints this message or the help of the given subcommand(s)" \ - ) - _describe -t commands 'rustup self commands' commands "$@" -} -(( $+functions[_rustup__override__set_commands] )) || -_rustup__override__set_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup override set commands' commands "$@" -} -(( $+functions[_rustup__set_commands] )) || -_rustup__set_commands() { - local commands; commands=( - "default-host:The triple used to identify toolchains when not specified" \ -"help:Prints this message or the help of the given subcommand(s)" \ - ) - _describe -t commands 'rustup set commands' commands "$@" -} -(( $+functions[_rustup__show_commands] )) || -_rustup__show_commands() { - local commands; commands=( - "active-toolchain:Show the active toolchain" \ -"help:Prints this message or the help of the given subcommand(s)" \ - ) - _describe -t commands 'rustup show commands' commands "$@" -} -(( $+functions[_rustup__target_commands] )) || -_rustup__target_commands() { - local commands; commands=( - "list:List installed and available targets" \ -"add:Add a target to a Rust toolchain" \ -"remove:Remove a target from a Rust toolchain" \ -"help:Prints this message or the help of the given subcommand(s)" \ - ) - _describe -t commands 'rustup target commands' commands "$@" -} -(( $+functions[_rustup__telemetry_commands] )) || -_rustup__telemetry_commands() { - local commands; commands=( - "enable:Enable rustup telemetry" \ -"disable:Disable rustup telemetry" \ -"analyze:Analyze stored telemetry" \ -"help:Prints this message or the help of the given subcommand(s)" \ - ) - _describe -t commands 'rustup telemetry commands' commands "$@" -} -(( $+functions[_rustup__toolchain_commands] )) || -_rustup__toolchain_commands() { - local commands; commands=( - "list:List installed toolchains" \ -"install:Install or update a given toolchain" \ -"uninstall:Uninstall a toolchain" \ -"link:Create a custom toolchain by symlinking to a directory" \ -"help:Prints this message or the help of the given subcommand(s)" \ - ) - _describe -t commands 'rustup toolchain commands' commands "$@" -} -(( $+functions[_rustup__self__uninstall_commands] )) || -_rustup__self__uninstall_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup self uninstall commands' commands "$@" -} -(( $+functions[_rustup__target__uninstall_commands] )) || -_rustup__target__uninstall_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup target uninstall commands' commands "$@" -} -(( $+functions[_rustup__toolchain__uninstall_commands] )) || -_rustup__toolchain__uninstall_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup toolchain uninstall commands' commands "$@" -} -(( $+functions[_rustup__uninstall_commands] )) || -_rustup__uninstall_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup uninstall commands' commands "$@" -} -(( $+functions[_rustup__override__unset_commands] )) || -_rustup__override__unset_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup override unset commands' commands "$@" -} -(( $+functions[_rustup__self__update_commands] )) || -_rustup__self__update_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup self update commands' commands "$@" -} -(( $+functions[_rustup__toolchain__update_commands] )) || -_rustup__toolchain__update_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup toolchain update commands' commands "$@" -} -(( $+functions[_rustup__update_commands] )) || -_rustup__update_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup update commands' commands "$@" -} -(( $+functions[_rustup__self__upgrade-data_commands] )) || -_rustup__self__upgrade-data_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup self upgrade-data commands' commands "$@" -} -(( $+functions[_rustup__which_commands] )) || -_rustup__which_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup which commands' commands "$@" -} - -_rustup "$@" \ No newline at end of file diff --git a/zsh/options.zsh b/zsh/options.zsh index f71f718..3679194 100644 --- a/zsh/options.zsh +++ b/zsh/options.zsh @@ -58,6 +58,3 @@ setopt hist_verify setopt inc_append_history # synchronize history between active sessions setopt share_history - -# Among other things, used for compatibility with OMZ plugins. -ZSH_CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/dotfiles" diff --git a/zsh/path.zsh b/zsh/path.zsh index be0077b..4358341 100644 --- a/zsh/path.zsh +++ b/zsh/path.zsh @@ -109,7 +109,8 @@ path_prepend path ~/.cargo/bin # add my binaries and completions path_prepend path "${ZSH_DOTFILES:h}/scripts" -path_prepend fpath "$ZSH_DOTFILES/completions" +path_prepend fpath "${ZSH_DOTFILES}/completions" +path_prepend fpath "${ZSH_CACHE_DIR}/site-functions" # add user binaries path_prepend path ~/.local/bin diff --git a/zsh/plugins.zsh b/zsh/plugins.zsh index 1e1a952..c557f6e 100644 --- a/zsh/plugins.zsh +++ b/zsh/plugins.zsh @@ -1,7 +1,5 @@ #!/usr/bin/env zsh -mkdir -pv "$ZSH_CACHE_DIR" - _plugin() { _perf_timer_start "plugin $1" plugin "$@" @@ -11,8 +9,22 @@ _plugin() { _checkout_latest_version='build=plugin-cfg-git-checkout-version "*"' _plugin completions 'zsh-users/zsh-completions' "$_checkout_latest_version" +_plugin completions-rustc 'https://raw.githubusercontent.com/rust-lang/zsh-config/master/_rust' from=url \ + after_load='plugin-cfg-path fpath prepend ""' +_plugin completions-cargo 'https://raw.githubusercontent.com/rust-lang/cargo/master/src/etc/_cargo' from=url \ + after_load='plugin-cfg-path fpath prepend ""' + +rustup_comp_path="${ZSH_CACHE_DIR}/site-functions/_rustup" +if [[ "${commands[rustup]}" -nt "$rustup_comp_path" || ! -s "$rustup_comp_path" ]]; then + _perf_timer_start "generate rustup completions" + rustup completions zsh >| "$rustup_comp_path" + _perf_timer_stop "generate rustup completions" +fi +unset rustup_comp_path # compinit {{{ + _perf_timer_start "compinit" + # note that completion system must be initialized after zsh-completions and # before Oh My Zsh autoload -U compinit @@ -39,6 +51,8 @@ _plugin completions 'zsh-users/zsh-completions' "$_checkout_latest_version" compinit -C -d "${ZSH_CACHE_DIR}/zcompdump" fi unset run_compdump + + _perf_timer_stop "compinit" # }}} # Oh My Zsh {{{ @@ -69,6 +83,7 @@ _plugin completions 'zsh-users/zsh-completions' "$_checkout_latest_version" if command_exists fasd; then export _FASD_DATA="${XDG_DATA_HOME:-$HOME/.local/share}/fasd_db.csv" + _perf_timer_start "fasd init" # Initialization taken from fasd_cache="${ZSH_CACHE_DIR}/fasd-init-cache" if [[ "${commands[fasd]}" -nt "$fasd_cache" || ! -s "$fasd_cache" ]]; then @@ -76,6 +91,7 @@ _plugin completions 'zsh-users/zsh-completions' "$_checkout_latest_version" fi source "$fasd_cache" unset fasd_cache + _perf_timer_stop "fasd init" alias v='f -e "$EDITOR"' alias o='a -e xdg-open' diff --git a/zsh/zplg.zsh b/zsh/zplg.zsh index f087602..c0c40d6 100644 --- a/zsh/zplg.zsh +++ b/zsh/zplg.zsh @@ -46,7 +46,7 @@ fi # Directory in which plugins are stored. It is separate from $ZPLG_HOME for # compatitability with future versions. -_ZPLG_PLUGINS_DIR="$ZPLG_HOME/plugins" +ZPLG_PLUGINS_DIR="$ZPLG_HOME/plugins" # basic logging {{{ @@ -302,7 +302,7 @@ plugin() { # download plugin {{{ - local plugin_dir="$_ZPLG_PLUGINS_DIR/$plugin_id" + local plugin_dir="$ZPLG_PLUGINS_DIR/$plugin_id" # simple check whether the plugin directory exists is enough for me if [[ ! -d "$plugin_dir" ]]; then _zplg_log "downloading $plugin_id" @@ -478,7 +478,7 @@ _zplg_is_plugin_loaded() { plugin_url="${ZPLG_LOADED_PLUGIN_URLS[$plugin_id]}" plugin_from="${ZPLG_LOADED_PLUGIN_SOURCES[$plugin_id]}" - plugin_dir="$_ZPLG_PLUGINS_DIR/$plugin_id" + plugin_dir="$ZPLG_PLUGINS_DIR/$plugin_id" _zplg_log "upgrading $plugin_id" _zplg_source_"$plugin_from"_upgrade "$plugin_url" "$plugin_dir" || return "$?" @@ -512,7 +512,7 @@ _zplg_is_plugin_loaded() { plugin_url="${ZPLG_LOADED_PLUGIN_URLS[$plugin_id]}" plugin_from="${ZPLG_LOADED_PLUGIN_SOURCES[$plugin_id]}" - plugin_dir="$_ZPLG_PLUGINS_DIR/$plugin_id" + plugin_dir="$ZPLG_PLUGINS_DIR/$plugin_id" _zplg_log "removing $plugin_id" rm -rf "$plugin_dir" @@ -543,7 +543,7 @@ _zplg_is_plugin_loaded() { return 1 fi - local plugin_dir="$_ZPLG_PLUGINS_DIR/$plugin_id" + local plugin_dir="$ZPLG_PLUGINS_DIR/$plugin_id" _zplg_log "removing $plugin_id" rm -rf "$plugin_dir" diff --git a/zsh/zshrc b/zsh/zshrc index 55fa9c1..8e02410 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -2,6 +2,10 @@ ZSH_DOTFILES="${0:h}" +# Among other things, used for compatibility with OMZ plugins. +ZSH_CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/dotfiles" +mkdir -pv -- "$ZSH_CACHE_DIR" "${ZSH_CACHE_DIR}/site-functions" + autoload -U colors && colors # Performance {{{