config dump
This commit is contained in:
parent
655dfe3d48
commit
cf8afe544a
6 changed files with 355 additions and 357 deletions
|
@ -1,4 +1,3 @@
|
|||
# =============================================================================
|
||||
$env.ATUIN_SESSION = (atuin uuid)
|
||||
hide-env -i ATUIN_HISTORY_ID
|
||||
|
||||
|
@ -17,20 +16,17 @@ let _atuin_pre_execution = {||
|
|||
$env.ATUIN_HISTORY_ID = (atuin history start -- $cmd)
|
||||
}
|
||||
}
|
||||
# =============================================================================
|
||||
|
||||
let _atuin_pre_prompt = {||
|
||||
let last_exit = $env.LAST_EXIT_CODE
|
||||
if 'ATUIN_HISTORY_ID' not-in $env {
|
||||
return
|
||||
}
|
||||
with-env { ATUIN_LOG: error } {
|
||||
with-env {ATUIN_LOG: error} {
|
||||
do { atuin history end $'--exit=($last_exit)' -- $env.ATUIN_HISTORY_ID } | complete
|
||||
|
||||
}
|
||||
hide-env ATUIN_HISTORY_ID
|
||||
}
|
||||
# =============================================================================
|
||||
|
||||
def _atuin_search_cmd [...flags: string] {
|
||||
let nu_version = do {
|
||||
|
@ -45,18 +41,19 @@ def _atuin_search_cmd [...flags: string] {
|
|||
}
|
||||
}
|
||||
[
|
||||
$ATUIN_KEYBINDING_TOKEN,
|
||||
([
|
||||
`with-env { ATUIN_LOG: error, ATUIN_QUERY: (commandline) } {`,
|
||||
(if $nu_version.0 <= 0 and $nu_version.1 <= 90 { 'commandline' } else { 'commandline edit' }),
|
||||
(if $nu_version.1 >= 92 { '(run-external atuin search' } else { '(run-external --redirect-stderr atuin search' }),
|
||||
($flags | append [--interactive] | each {|e| $'"($e)"'}),
|
||||
(if $nu_version.1 >= 92 { ' e>| str trim)' } else {' | complete | $in.stderr | str substring ..-1)'}),
|
||||
`}`,
|
||||
] | flatten | str join ' '),
|
||||
$ATUIN_KEYBINDING_TOKEN
|
||||
(
|
||||
[
|
||||
`with-env { ATUIN_LOG: error, ATUIN_QUERY: (commandline) } {`
|
||||
(if $nu_version.0 <= 0 and $nu_version.1 <= 90 { 'commandline' } else { 'commandline edit' })
|
||||
(if $nu_version.1 >= 92 { '(run-external atuin search' } else { '(run-external --redirect-stderr atuin search' })
|
||||
($flags | append [--interactive] | each {|e| $'"($e)"' })
|
||||
(if $nu_version.1 >= 92 { ' e>| str trim)' } else { ' | complete | $in.stderr | str substring ..-1)' })
|
||||
`}`
|
||||
] | flatten | str join ' '
|
||||
)
|
||||
] | str join "\n"
|
||||
}
|
||||
# =============================================================================
|
||||
|
||||
$env.config = ($env | default {} config).config
|
||||
$env.config = ($env.config | default {} hooks)
|
||||
|
@ -64,9 +61,11 @@ $env.config = (
|
|||
$env.config | upsert hooks (
|
||||
$env.config.hooks
|
||||
| upsert pre_execution (
|
||||
$env.config.hooks | get -i pre_execution | default [] | append $_atuin_pre_execution)
|
||||
$env.config.hooks | get -i pre_execution | default [] | append $_atuin_pre_execution
|
||||
)
|
||||
| upsert pre_prompt (
|
||||
$env.config.hooks | get -i pre_prompt | default [] | append $_atuin_pre_prompt)
|
||||
$env.config.hooks | get -i pre_prompt | default [] | append $_atuin_pre_prompt
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -79,8 +78,8 @@ $env.config = (
|
|||
name: atuin
|
||||
modifier: control
|
||||
keycode: char_r
|
||||
mode: [emacs, vi_normal, vi_insert]
|
||||
event: { send: executehostcommand cmd: (_atuin_search_cmd) }
|
||||
mode: [emacs vi_normal vi_insert]
|
||||
event: {send: executehostcommand cmd: (_atuin_search_cmd)}
|
||||
}
|
||||
)
|
||||
)
|
||||
|
@ -92,14 +91,13 @@ $env.config = (
|
|||
name: atuin
|
||||
modifier: none
|
||||
keycode: up
|
||||
mode: [emacs, vi_normal, vi_insert]
|
||||
mode: [emacs vi_normal vi_insert]
|
||||
event: {
|
||||
until: [
|
||||
{send: menuup}
|
||||
{send: executehostcommand cmd: (_atuin_search_cmd '--shell-up-key-binding') }
|
||||
{send: executehostcommand cmd: (_atuin_search_cmd '--shell-up-key-binding')}
|
||||
]
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
# =============================================================================
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
$env.config.completions = {
|
||||
algorithm: prefix
|
||||
sort: smart
|
||||
case_sensitive: false
|
||||
quick: true
|
||||
partial: true
|
||||
use_ls_colors: true
|
||||
external: {
|
||||
enable: true
|
||||
max_results: 10
|
||||
completer: {|spans: list<string>|
|
||||
$env.PATH = ($env.PATH | split row (char esep) | prepend "/home/cr/.config/carapace/bin")
|
||||
|
||||
def --env get-env [name] { $env | get $name }
|
||||
def --env set-env [name, value] { load-env { $name: $value } }
|
||||
def --env unset-env [name] { hide-env $name }
|
||||
|
||||
let carapace_completer = {|spans|
|
||||
# if the current command is an alias, get it's expansion
|
||||
let expanded_alias = (scope aliases | where name == $spans.0 | get -i 0 | get -i expansion)
|
||||
|
||||
|
@ -22,25 +18,13 @@ $env.config.completions = {
|
|||
|
||||
carapace $spans.0 nushell ...$spans
|
||||
| from json
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
$env.config.menus ++= [
|
||||
{
|
||||
marker: $"(ansi yellow)┣ "
|
||||
name: completion_menu
|
||||
only_buffer_difference: false
|
||||
style: {
|
||||
description_text: yellow
|
||||
selected_text: red_reverse
|
||||
text: yellow
|
||||
}
|
||||
type: {
|
||||
col_padding: 2
|
||||
col_width: 20
|
||||
columns: 1
|
||||
layout: columnar
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
mut current = (($env | default {} config).config | default {} completions)
|
||||
$current.completions = ($current.completions | default {} external)
|
||||
$current.completions.external = ($current.completions.external
|
||||
| default true enable
|
||||
| default { $carapace_completer } completer)
|
||||
|
||||
$env.config = $current
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ $env.config.table = {
|
|||
header_on_separator: false
|
||||
index_mode: always
|
||||
mode: light
|
||||
padding: { left: 1 right: 1 }
|
||||
padding: {left: 1 right: 1}
|
||||
show_empty: true
|
||||
trim: {
|
||||
methodology: wrapping
|
||||
|
@ -43,17 +43,17 @@ $env.config.table = {
|
|||
}
|
||||
|
||||
$env.config.explore = {
|
||||
command_bar_text: { fg: "#C4C9C6" }
|
||||
highlight: { fg: black bg: yellow }
|
||||
command_bar_text: {fg: "#C4C9C6"}
|
||||
highlight: {fg: black bg: yellow}
|
||||
status: {
|
||||
error: { fg: white bg: red }
|
||||
error: {fg: white bg: red}
|
||||
warn: {}
|
||||
info: {}
|
||||
}
|
||||
status_bar_background: { fg: "#1D1F21" bg: "#C4C9C6" }
|
||||
status_bar_background: {fg: "#1D1F21" bg: "#C4C9C6"}
|
||||
table: {
|
||||
split_line: { fg: "#404040" }
|
||||
selected_cell: { bg: light_blue }
|
||||
split_line: {fg: "#404040"}
|
||||
selected_cell: {bg: light_blue}
|
||||
selected_row: {}
|
||||
selected_column: {}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ $env.config.cursor_shape = {
|
|||
}
|
||||
|
||||
$env.config.hooks = {
|
||||
command_not_found: {||}
|
||||
command_not_found: {|| }
|
||||
|
||||
pre_execution: [
|
||||
{
|
||||
|
@ -86,7 +86,6 @@ $env.config.hooks = {
|
|||
}
|
||||
]
|
||||
|
||||
|
||||
pre_prompt: [
|
||||
{
|
||||
if (which direnv | is-empty) {
|
||||
|
@ -128,79 +127,66 @@ $env.config.keybindings = [
|
|||
name: copy_commandline
|
||||
modifier: alt
|
||||
keycode: char_c
|
||||
mode: [ vi_normal vi_insert ]
|
||||
mode: [vi_normal vi_insert]
|
||||
event: {
|
||||
send: executehostcommand
|
||||
cmd: 'commandline | nu-highlight | $"```ansi\n($in)\n```" | wl-copy $in'
|
||||
}
|
||||
}
|
||||
{
|
||||
name: completion_menu
|
||||
modifier: none
|
||||
keycode: tab
|
||||
mode: [ vi_normal vi_insert ]
|
||||
event: {
|
||||
until: [
|
||||
{ send: menu name: completion_menu }
|
||||
{ send: menunext }
|
||||
{ edit: complete }
|
||||
]
|
||||
}
|
||||
}
|
||||
{
|
||||
name: escape
|
||||
modifier: none
|
||||
keycode: escape
|
||||
mode: [ vi_normal vi_insert ]
|
||||
event: { send: esc }
|
||||
mode: [vi_normal vi_insert]
|
||||
event: {send: esc}
|
||||
}
|
||||
{
|
||||
name: cancel_command
|
||||
modifier: control
|
||||
keycode: char_c
|
||||
mode: [ vi_normal vi_insert ]
|
||||
event: { send: ctrlc }
|
||||
mode: [vi_normal vi_insert]
|
||||
event: {send: ctrlc}
|
||||
}
|
||||
{
|
||||
name: quit_shell
|
||||
modifier: control
|
||||
keycode: char_d
|
||||
mode: [ vi_normal vi_insert ]
|
||||
event: { send: ctrld }
|
||||
mode: [vi_normal vi_insert]
|
||||
event: {send: ctrld}
|
||||
}
|
||||
{
|
||||
name: clear_screen
|
||||
modifier: control
|
||||
keycode: char_l
|
||||
mode: [ vi_normal vi_insert ]
|
||||
event: { send: clearscreen }
|
||||
mode: [vi_normal vi_insert]
|
||||
event: {send: clearscreen}
|
||||
}
|
||||
{
|
||||
name: open_command_editor
|
||||
modifier: control
|
||||
keycode: char_o
|
||||
mode: [ vi_normal vi_insert ]
|
||||
event: { send: openeditor }
|
||||
mode: [vi_normal vi_insert]
|
||||
event: {send: openeditor}
|
||||
}
|
||||
{
|
||||
name: abbr
|
||||
modifier: control
|
||||
keycode: space
|
||||
mode: [ vi_normal vi_insert ]
|
||||
mode: [vi_normal vi_insert]
|
||||
event: [
|
||||
{ send: menu name: abbr_menu }
|
||||
{ edit: insertchar, value: " " }
|
||||
{send: menu name: abbr_menu}
|
||||
{edit: insertchar value: " "}
|
||||
]
|
||||
}
|
||||
{
|
||||
name: move_down
|
||||
modifier: none
|
||||
keycode: down
|
||||
mode: [ vi_normal vi_insert ]
|
||||
mode: [vi_normal vi_insert]
|
||||
event: {
|
||||
until: [
|
||||
{ send: menudown }
|
||||
{ send: down }
|
||||
{send: menudown}
|
||||
{send: down}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -208,11 +194,11 @@ $env.config.keybindings = [
|
|||
name: move_left
|
||||
modifier: none
|
||||
keycode: left
|
||||
mode: [ vi_normal vi_insert ]
|
||||
mode: [vi_normal vi_insert]
|
||||
event: {
|
||||
until: [
|
||||
{ send: menuleft }
|
||||
{ send: left }
|
||||
{send: menuleft}
|
||||
{send: left}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -220,12 +206,12 @@ $env.config.keybindings = [
|
|||
name: move_right_or_take_history_hint
|
||||
modifier: none
|
||||
keycode: right
|
||||
mode: [ vi_normal vi_insert ]
|
||||
mode: [vi_normal vi_insert]
|
||||
event: {
|
||||
until: [
|
||||
{ send: historyhintcomplete }
|
||||
{ send: menuright }
|
||||
{ send: right }
|
||||
{send: historyhintcomplete}
|
||||
{send: menuright}
|
||||
{send: right}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -233,18 +219,18 @@ $env.config.keybindings = [
|
|||
name: move_one_word_left
|
||||
modifier: control
|
||||
keycode: left
|
||||
mode: [ vi_normal vi_insert ]
|
||||
event: { edit: movewordleft }
|
||||
mode: [vi_normal vi_insert]
|
||||
event: {edit: movewordleft}
|
||||
}
|
||||
{
|
||||
name: move_one_word_right_or_take_history_hint
|
||||
modifier: control
|
||||
keycode: right
|
||||
mode: [ vi_normal vi_insert ]
|
||||
mode: [vi_normal vi_insert]
|
||||
event: {
|
||||
until: [
|
||||
{ send: historyhintwordcomplete }
|
||||
{ edit: movewordright }
|
||||
{send: historyhintwordcomplete}
|
||||
{edit: movewordright}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -252,18 +238,18 @@ $env.config.keybindings = [
|
|||
name: move_to_line_start
|
||||
modifier: control
|
||||
keycode: char_a
|
||||
mode: [ vi_normal vi_insert ]
|
||||
event: { edit: movetolinestart }
|
||||
mode: [vi_normal vi_insert]
|
||||
event: {edit: movetolinestart}
|
||||
}
|
||||
{
|
||||
name: move_to_line_end_or_take_history_hint
|
||||
modifier: control
|
||||
keycode: char_e
|
||||
mode: [ vi_normal vi_insert ]
|
||||
mode: [vi_normal vi_insert]
|
||||
event: {
|
||||
until: [
|
||||
{ send: historyhintcomplete }
|
||||
{ edit: movetolineend }
|
||||
{send: historyhintcomplete}
|
||||
{edit: movetolineend}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -272,46 +258,56 @@ $env.config.keybindings = [
|
|||
modifier: none
|
||||
keycode: backspace
|
||||
mode: vi_insert
|
||||
event: { edit: backspace }
|
||||
event: {edit: backspace}
|
||||
}
|
||||
{
|
||||
name: delete_one_word_backward
|
||||
modifier: control
|
||||
keycode: backspace
|
||||
mode: vi_insert
|
||||
event: { edit: backspaceword }
|
||||
event: {edit: backspaceword}
|
||||
}
|
||||
{
|
||||
name: newline_or_run_command
|
||||
modifier: none
|
||||
keycode: enter
|
||||
mode: vi_insert
|
||||
event: { send: enter }
|
||||
event: {send: enter}
|
||||
}
|
||||
{
|
||||
name: take_history_hint
|
||||
modifier: control
|
||||
keycode: char_f
|
||||
mode: [ vi_normal vi_insert ]
|
||||
mode: [vi_normal vi_insert]
|
||||
event: {
|
||||
until: [
|
||||
{ send: historyhintcomplete }
|
||||
{send: historyhintcomplete}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
source ./atuin.nu
|
||||
source ./zoxide.nu
|
||||
let autoload_dir = $nu.user-autoload-dirs.0
|
||||
mkdir $autoload_dir
|
||||
|
||||
zoxide init nushell --cmd cd | save -f ($autoload_dir | path join zoxide.nu)
|
||||
atuin init nu | save -f ($autoload_dir | path join atuin.nu)
|
||||
carapace _carapace nushell | save -f ($autoload_dir | path join carapace.nu)
|
||||
|
||||
source ./source_profile.nu
|
||||
source ./completions.nu
|
||||
source ./prompt.nu
|
||||
|
||||
# fix sudo by prepending /run/wrappers/bin to the PATH.
|
||||
$env.PATH = ($env.PATH | split row (char esep) | prepend '/run/wrappers/bin')
|
||||
$env.LS_COLORS = (vivid generate lava)
|
||||
$env.EDITOR = "hx"
|
||||
$env.CARAPACE_BRIDGES = 'zsh,fish,bash,inshellisense'
|
||||
|
||||
$env.CARAPACE_BRIDGES = 'carapace,clap,inshellisense,fish'
|
||||
$env.CARAPACE_MATCH = 1
|
||||
|
||||
|
||||
# Set environment variables according to the path of the clone
|
||||
$env.TOPIARY_CONFIG_FILE = ($env.HOME | path join .config | path join topiary languages.ncl)
|
||||
$env.TOPIARY_LANGUAGE_DIR = ($env.HOME | path join .config | path join topiary languages)
|
||||
# The prompt indicators are environmental variables that represent
|
||||
# the state of the prompt.
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
use std null_device
|
||||
|
||||
export-env { load-env {
|
||||
export-env {
|
||||
load-env {
|
||||
PROMPT_COMMAND: {||
|
||||
let exit_code = $env.LAST_EXIT_CODE
|
||||
let jj_root = try { ^jj root err> $null_device } catch { "" }
|
||||
$env.LAST_EXIT_CODE = 0
|
||||
let vcs_root = if not ($jj_root | is-empty ) { $jj_root } else {""}
|
||||
let vcs_root = if not ($jj_root | is-empty) { $jj_root } else { "" }
|
||||
|
||||
mut path_segment = ""
|
||||
if not (($vcs_root | is-empty) or ($env.PWD == $vcs_root)) {
|
||||
# vcs_root is not empty, we're not in the vcs_root of the project
|
||||
$path_segment = [($vcs_root | path basename), ($env.PWD | path basename)] | str join " @ "
|
||||
$path_segment = [($vcs_root | path basename) ($env.PWD | path basename)] | str join " @ "
|
||||
} else {
|
||||
$path_segment = $env.PWD | path basename
|
||||
}
|
||||
|
@ -21,8 +22,7 @@ export-env { load-env {
|
|||
$"(ansi yellow)━┫(ansi red)($exit_code)(ansi yellow)┣━"
|
||||
}
|
||||
|
||||
[$"(ansi yellow)┏",$exit_code_segment,"━ ", $path_segment, "\n"] | str join
|
||||
|
||||
[$"(ansi yellow)┏" $exit_code_segment "━ " $path_segment "\n"] | str join
|
||||
}
|
||||
TRANSIENT_PROMPT_COMMAND: {||
|
||||
let path_segment = $env.PWD | path basename
|
||||
|
@ -33,21 +33,23 @@ export-env { load-env {
|
|||
$"(ansi yellow)━┫(ansi red)($env.LAST_EXIT_CODE)(ansi yellow)┣━"
|
||||
}
|
||||
|
||||
[$"(ansi yellow)━",$exit_code_segment,"━ ", $path_segment] | str join
|
||||
[$"(ansi yellow)━" $exit_code_segment "━ " $path_segment] | str join
|
||||
}
|
||||
PROMPT_INDICATOR_VI_INSERT: $"(ansi yellow)┃ "
|
||||
PROMPT_INDICATOR_VI_NORMAL: $"(ansi yellow)┋ "
|
||||
# PROMPT_MULTILINE_INDICATOR: "::: "
|
||||
PROMPT_MULTILINE_INDICATOR: $"(ansi yellow)┃ "
|
||||
TRANSIENT_PROMPT_INDICATOR_VI_INSERT: " "
|
||||
TRANSIENT_PROMPT_INDICATOR_VI_NORMAL: " "
|
||||
TRANSIENT_PROMPT_MULTILINE_INDICATOR: $"(ansi yellow)┃ "
|
||||
PROMPT_INDICATOR_VI_INSERT: $"(ansi yellow)┃ "
|
||||
PROMPT_INDICATOR_VI_NORMAL: $"(ansi yellow)┋ "
|
||||
# PROMPT_MULTILINE_INDICATOR: "::: "
|
||||
PROMPT_MULTILINE_INDICATOR: $"(ansi yellow)┃ "
|
||||
TRANSIENT_PROMPT_INDICATOR_VI_INSERT: " "
|
||||
TRANSIENT_PROMPT_INDICATOR_VI_NORMAL: " "
|
||||
TRANSIENT_PROMPT_MULTILINE_INDICATOR: $"(ansi yellow)┃ "
|
||||
|
||||
config: ($env.config? | default {} | merge {
|
||||
config: (
|
||||
$env.config? | default {} | merge {
|
||||
render_right_prompt_on_last_line: true
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
PROMPT_COMMAND_RIGHT: {||
|
||||
PROMPT_COMMAND_RIGHT: {||
|
||||
let jj_status = try {
|
||||
jj --quiet --color always --ignore-working-copy log --no-graph --revisions @ --template '
|
||||
separate(
|
||||
|
@ -77,4 +79,6 @@ PROMPT_COMMAND_RIGHT: {||
|
|||
""
|
||||
}
|
||||
$jj_status
|
||||
}}}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
2
nushell/source_profile.nu
Executable file → Normal file
2
nushell/source_profile.nu
Executable file → Normal file
|
@ -13,7 +13,7 @@ if not ($env_vars_file | path exists) {
|
|||
| lines
|
||||
| parse 'export {name}="{value}"'
|
||||
| transpose --header-row --as-record
|
||||
| tee {load-env $in}
|
||||
| tee { load-env $in }
|
||||
| to nuon
|
||||
| save --force $env_vars_file
|
||||
} else {
|
||||
|
|
|
@ -11,50 +11,66 @@ export-env {
|
|||
$env.config.hooks.env_change.PWD | any { try { get __zoxide_hook } catch { false } }
|
||||
)
|
||||
if not $__zoxide_hooked {
|
||||
$env.config.hooks.env_change.PWD = ($env.config.hooks.env_change.PWD | append {
|
||||
__zoxide_hook: true,
|
||||
code: {|_, dir| zoxide add -- $dir}
|
||||
})
|
||||
$env.config.hooks.env_change.PWD = (
|
||||
$env.config.hooks.env_change.PWD | append {
|
||||
__zoxide_hook: true
|
||||
code: {|_ dir| zoxide add -- $dir }
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
def "nu-complete zoxide path" [context: string] {
|
||||
let parts = $context | split row -r "[ /]" | skip 1
|
||||
{
|
||||
options: {
|
||||
sort: false,
|
||||
completion_algorithm: substring,
|
||||
case_sensitive: false,
|
||||
},
|
||||
completions: (
|
||||
module zoxide-commands {
|
||||
def "nu-complete zoxide path" [context: string] {
|
||||
let parts = $context | str trim --left | split row " " | skip 1 | each { str downcase }
|
||||
let completions = (
|
||||
^zoxide query --list --exclude $env.PWD -- ...$parts
|
||||
| lines
|
||||
| first 10
|
||||
| each {|p| $p | path relative-to $env.PWD | $"($in)/"}
|
||||
|
||||
# | each {|p| echo p | path basename}
|
||||
)
|
||||
# | each {|p| echo p | path basename | $"($in)/"}),
|
||||
| each {|dir|
|
||||
if ($parts | length) <= 1 {
|
||||
$dir
|
||||
} else {
|
||||
let dir_lower = $dir | str downcase
|
||||
let rem_start = $parts | drop 1 | reduce --fold 0 {|part rem_start|
|
||||
($dir_lower | str index-of --range $rem_start.. $part) + ($part | str length)
|
||||
}
|
||||
{
|
||||
value: ($dir | str substring $rem_start..)
|
||||
description: $dir
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
{
|
||||
options: {
|
||||
sort: false
|
||||
completion_algorithm: prefix
|
||||
positional: false
|
||||
case_sensitive: false
|
||||
}
|
||||
completions: $completions
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Jump to a directory using only keywords.
|
||||
def --env --wrapped __zoxide_z [...rest: string@"nu-complete zoxide path"] {
|
||||
# Jump to a directory using only keywords.
|
||||
export def --env --wrapped __zoxide_z [...rest: string@"nu-complete zoxide path"] {
|
||||
let path = match $rest {
|
||||
[] => {'~'},
|
||||
[ '-' ] => {'-'},
|
||||
[ $arg ] if ($arg | path expand | path type) == 'dir' => {$arg}
|
||||
[] => { '~' }
|
||||
['-'] => { '-' }
|
||||
[$arg] if ($arg | path expand | path type) == 'dir' => { $arg }
|
||||
_ => {
|
||||
zoxide query --exclude $env.PWD -- ...$rest | str trim -r -c "\n"
|
||||
^zoxide query --exclude $env.PWD -- ...$rest | str trim -r -c "\n"
|
||||
}
|
||||
}
|
||||
cd $path
|
||||
}
|
||||
|
||||
# Jump to a directory using interactive search.
|
||||
export def --env --wrapped __zoxide_zi [...rest: string@"nu-complete zoxide path"] {
|
||||
cd $'(^zoxide query --interactive -- ...$rest | str trim -r -c "\n")'
|
||||
}
|
||||
alias cd = __zoxide_z
|
||||
alias ci = __zoxide_zi
|
||||
}
|
||||
|
||||
# Jump to a directory using interactive search.
|
||||
def --env --wrapped __zoxide_zi [...rest:string@"nu-complete zoxide path"] {
|
||||
cd $'(zoxide query --interactive -- ...$rest | str trim -r -c "\n")'
|
||||
}
|
||||
|
||||
alias cd = __zoxide_z
|
||||
alias ci = __zoxide_zi
|
||||
use zoxide-commands *
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue