fixed issue with zellij misbehaving with kitty-protocoll.

This commit is contained in:
Gabe Venberg 2024-03-06 12:40:38 -06:00
parent 67aec4db68
commit 8178a6402f
2 changed files with 28 additions and 29 deletions

View file

@ -1,6 +1,6 @@
# Nushell Config File # Nushell Config File
# #
# version = "0.90.1" # version = "0.91.0"
# For more information on defining custom themes, see # For more information on defining custom themes, see
# https://www.nushell.sh/book/coloring_and_theming.html # https://www.nushell.sh/book/coloring_and_theming.html
@ -248,8 +248,9 @@ $env.config = {
edit_mode: vi # emacs, vi edit_mode: vi # emacs, vi
shell_integration: true # enables terminal shell integration. Off by default, as some terminals have issues with this. shell_integration: true # enables terminal shell integration. Off by default, as some terminals have issues with this.
render_right_prompt_on_last_line: false # true or false to enable or disable right prompt to be rendered on last line of the prompt. render_right_prompt_on_last_line: false # true or false to enable or disable right prompt to be rendered on last line of the prompt.
# enables keyboard enhancement protocol implemented by kitty console, only if your terminal support this. # enables keyboard enhancement protocol implemented by kitty console, only if your terminal support this.
use_kitty_protocol: ($env.TERM == 'xterm-kitty') # Zellij does not modify the term var, so we have to special-case it.
use_kitty_protocol: ($env.TERM == 'xterm-kitty' and $env.ZELLIJ? == null)
highlight_resolved_externals: true # true enables highlighting of external commands in the repl resolved by which. highlight_resolved_externals: true # true enables highlighting of external commands in the repl resolved by which.
plugins: {} # Per-plugin configuration. See https://www.nushell.sh/contributor-book/plugins.html#configuration. plugins: {} # Per-plugin configuration. See https://www.nushell.sh/contributor-book/plugins.html#configuration.

View file

@ -1,25 +1,13 @@
# Nushell Environment Config File # Nushell Environment Config File
# #
# version = "0.90.1" # version = "0.91.0"
def create_left_prompt [] { def create_left_prompt [] {
let home = $nu.home-path let dir = match (do --ignore-shell-errors { $env.PWD | path relative-to $nu.home-path }) {
null => $env.PWD
# Perform tilde substitution on dir '' => '~'
# To determine if the prefix of the path matches the home dir, we split the current path into $relative_pwd => ([~ $relative_pwd] | path join)
# segments, and compare those with the segments of the home dir. In cases where the current dir }
# is a parent of the home dir (e.g. `/home`, homedir is `/home/user`), this comparison will
# also evaluate to true. Inside the condition, we attempt to str replace `$home` with `~`.
# Inside the condition, either:
# 1. The home prefix will be replaced
# 2. The current dir is a parent of the home dir, so it will be uneffected by the str replace
let dir = (
if ($env.PWD | path split | zip ($home | path split) | all { $in.0 == $in.1 }) {
($env.PWD | str replace $home "~")
} else {
$env.PWD
}
)
let path_color = (if (is-admin) { ansi red_bold } else { ansi green_bold }) let path_color = (if (is-admin) { ansi red_bold } else { ansi green_bold })
let separator_color = (if (is-admin) { ansi light_red_bold } else { ansi light_green_bold }) let separator_color = (if (is-admin) { ansi light_red_bold } else { ansi light_green_bold })
@ -33,7 +21,7 @@ def create_right_prompt [] {
let time_segment = ([ let time_segment = ([
(ansi reset) (ansi reset)
(ansi magenta) (ansi magenta)
(date now | format date '%x %X %p') # try to respect user's locale (date now | format date '%x %X') # try to respect user's locale
] | str join | str replace --regex --all "([/:])" $"(ansi green)${1}(ansi magenta)" | ] | str join | str replace --regex --all "([/:])" $"(ansi green)${1}(ansi magenta)" |
str replace --regex --all "([AP]M)" $"(ansi magenta_underline)${1}") str replace --regex --all "([AP]M)" $"(ansi magenta_underline)${1}")
@ -48,14 +36,15 @@ def create_right_prompt [] {
# Use nushell functions to define your right and left prompt # Use nushell functions to define your right and left prompt
$env.PROMPT_COMMAND = {|| create_left_prompt } $env.PROMPT_COMMAND = {|| create_left_prompt }
# FIXME: This default is not implemented in rust code as of 2023-09-08.
$env.PROMPT_COMMAND_RIGHT = {|| create_right_prompt } $env.PROMPT_COMMAND_RIGHT = {|| create_right_prompt }
# The prompt indicators are environmental variables that represent # The prompt indicators are environmental variables that represent
# the state of the prompt # the state of the prompt
$env.PROMPT_INDICATOR = {'> '} $env.PROMPT_INDICATOR = {|| "> " }
$env.PROMPT_INDICATOR_VI_INSERT = {'> '} $env.PROMPT_INDICATOR_VI_INSERT = {|| "> " }
$env.PROMPT_INDICATOR_VI_NORMAL = {': '} $env.PROMPT_INDICATOR_VI_NORMAL = {|| ": " }
$env.PROMPT_MULTILINE_INDICATOR = {'::: '} $env.PROMPT_MULTILINE_INDICATOR = {|| "::: " }
# If you want previously entered commands to have a different prompt from the usual one, # If you want previously entered commands to have a different prompt from the usual one,
# you can uncomment one or more of the following lines. # you can uncomment one or more of the following lines.
@ -102,9 +91,18 @@ def is-installed [ app: string ] {
# To add entries to PATH (on Windows you might use Path), you can use the following pattern: # To add entries to PATH (on Windows you might use Path), you can use the following pattern:
# $env.PATH = ($env.PATH | split row (char esep) | prepend '/some/path') # $env.PATH = ($env.PATH | split row (char esep) | prepend '/some/path')
$env.PATH = ($env.PATH | split row (char esep) | append ($nu.home-path | path join ".local/bin/")) # $env.PATH = ($env.PATH | split row (char esep) | append ($nu.home-path | path join ".local/bin/"))
$env.PATH = ($env.PATH | split row (char esep) | append ($nu.home-path | path join ".cargo/bin/")) # $env.PATH = ($env.PATH | split row (char esep) | append ($nu.home-path | path join ".cargo/bin/"))
$env.PATH = ($env.PATH | split row (char esep) | append ($nu.home-path | path join "opt")) # $env.PATH = ($env.PATH | split row (char esep) | append ($nu.home-path | path join "opt"))
# An alternate way to add entries to $env.PATH is to use the custom command `path add`
# which is built into the nushell stdlib:
use std "path add"
$env.PATH = ($env.PATH | split row (char esep))
path add ($env.HOME | path join ".cargo " "bin")
path add ($env.HOME | path join ".local" "bin")
path add ('/opt')
$env.PATH = ($env.PATH | uniq)
$env.PAGER = less $env.PAGER = less
$env.LESS = '-R' $env.LESS = '-R'
$env.LESSHISTFILE = '/dev/null' $env.LESSHISTFILE = '/dev/null'