diff --git a/terminal/.config/nushell/config.nu b/terminal/.config/nushell/config.nu index def3a4a..36173e5 100644 --- a/terminal/.config/nushell/config.nu +++ b/terminal/.config/nushell/config.nu @@ -9,13 +9,17 @@ # # This file is loaded after env.nu and before login.nu # -$env.config.show_banner = false # TODO: FOR TESTING PURPOSES +$env.config.show_banner = false $env.config.edit_mode = "vi" -$env.config.buffer_editor = "nvim" +# Enable same behavior as fzf-tab-complete for zsh +$env.config.completions.algorithm = "fuzzy" $env.PROMPT_INDICATOR = "" -$env.PROMPT_MULTILINE_INDICATOR = "::: " +$env.PROMPT_MULTILINE_INDICATOR = "::: " # overwritten by starship +# enable transient prompt with starship +$env.TRANSIENT_PROMPT_COMMAND = ^starship module character +$env.TRANSIENT_PROMPT_COMMAND_RIGHT = {|| ^starship module cmd_duration } # FIXME: Disabled for now to use starship prompts instead # but still very buggy. See: @@ -28,7 +32,7 @@ $env.PROMPT_INDICATOR_VI_NORMAL = "" # Temporary workaround $env.config.cursor_shape.vi_insert = "line" $env.config.cursor_shape.vi_normal = "block" -# TODO: Currently recommended starship install. Change when it changes. +# load starship prompt mkdir ($nu.data-dir | path join "vendor/autoload") starship init nu | save -f ($nu.data-dir | path join "vendor/autoload/starship.nu") # load atuin history @@ -51,6 +55,7 @@ $env.config.keybindings = [ {send: Enter} ] } + # reedline edits { name: insert_last_token modifier: alt @@ -76,10 +81,23 @@ $env.config.keybindings = [ keycode: char_s mode: [emacs vi_insert vi_normal] event: { - send: executehostcommand - cmd: "let cmd = (commandline); commandline edit (if $cmd starts-with sudo { $cmd | str replace -r '^sudo ' '' } else { 'sudo ' ++ $cmd });" + send: ExecuteHostCommand + cmd: " let cmd = (commandline); commandline edit (if $cmd starts-with sudo { $cmd | str replace -r '^sudo ' '' } else { 'sudo ' ++ $cmd });" } } + { + name: partial_history_complete + modifier: None + keycode: char_e + mode: [vi_normal] + event: { + until: [ + { send: HistoryHintWordComplete } + { edit: MoveWordRight } + ] + } + } + # file menus { name: run_zoxide modifier: alt @@ -87,7 +105,7 @@ $env.config.keybindings = [ mode: ["emacs", "vi_normal", "vi_insert"] event: { send: executehostcommand - cmd: "zoxide query --interactive" + cmd: " zoxide query --interactive" } } { @@ -97,7 +115,7 @@ $env.config.keybindings = [ mode: [ "vi_normal"] event: { send: executehostcommand - cmd: "zoxide query --interactive" + cmd: " zoxide query --interactive" } } { @@ -107,7 +125,8 @@ $env.config.keybindings = [ mode: ["emacs", "vi_normal", "vi_insert"] event: { send: executehostcommand - cmd: " + # intentional eol space to prevent adding cmd to history + cmd: " let fzf_ctrl_t_command = \$\"fd --type file --hidden | fzf --preview 'bat --color=always --style=full --line-range=:500 {}' \"; let result = nu -l -i -c $fzf_ctrl_t_command; commandline edit --append $result; @@ -115,6 +134,17 @@ $env.config.keybindings = [ " } } + # job control + { + name: unfreeze_job + modifier: control + keycode: char_z + mode: ["emacs", "vi_normal", "vi_insert"] + event: { + send: executehostcommand + cmd: "job unfreeze" + } + } ] alias l = ls @@ -127,3 +157,6 @@ def --env mcd [path: path] { } alias v = nvim + +# requires minimum nushell: 0.103 for job control +alias fg = job unfreeze diff --git a/terminal/.config/starship.toml b/terminal/.config/starship.toml index de7e41d..db23219 100644 --- a/terminal/.config/starship.toml +++ b/terminal/.config/starship.toml @@ -26,6 +26,8 @@ $typst\ $package """ +continuation_prompt = "[:::](bright-black) " + [directory] style = "blue" fish_style_pwd_dir_length = 1