xonsh: switch to using starship

This commit is contained in:
Kate 2025-05-22 19:57:52 +02:00
parent d8a2687701
commit 36121c5579
10 changed files with 400 additions and 6 deletions

View file

@ -83,8 +83,8 @@
extraPackages = [
deprekages.xontrib-whole-word-jumping
deprekages.xontrib-term-integrations
deprekages.xontrib-prompt-starship
deprekages.xontrib-prompt-bar
deprekages.xontrib-termcolors
deprekages.xontrib-sh
];
};

View file

@ -17,6 +17,12 @@
# xonsh
xdg.configFile.xonsh.source = ../../xonsh;
# zellij
xdg.configFile.zellij.source = ../../zellij;
# starship
xdg.configFile."starship.toml".source = ../../starship.toml;
# wezterm
xdg.configFile.wezterm.source = ../../wezterm;

View file

@ -22,6 +22,7 @@ with pkgs;
rsync
tree-sitter
tmux
starship
deprekages._7zz
# Backup things.

View file

@ -120,6 +120,7 @@ flake-utils.lib.eachDefaultSystem (
# xonsh and xontribs
xontrib-whole-word-jumping = callPackage ./xontrib-whole-word-jumping.nix {};
xontrib-term-integrations = callPackage ./xontrib-term-integrations.nix {};
xontrib-prompt-starship = callPackage ./xontrib-prompt-starship.nix {};
xontrib-prompt-bar = callPackage ./xontrib-prompt-bar.nix {};
xontrib-termcolors = callPackage ./xontrib-termcolors.nix {};
xontrib-sh = callPackage ./xontrib-sh.nix {};
@ -128,8 +129,8 @@ flake-utils.lib.eachDefaultSystem (
extraPackages = pythonPackages: [
xontrib-whole-word-jumping
xontrib-term-integrations
xontrib-prompt-starship
xontrib-prompt-bar
xontrib-termcolors
xontrib-sh
];
};

View file

@ -0,0 +1,32 @@
{
callPackage,
fetchPypi,
python3Packages,
xonsh
}:
let
# Create a version of xonsh as a python package,
# matching the version installed on the syste,
xonsh-python = callPackage ./xonsh-python-package.nix { inherit xonsh; };
in python3Packages.buildPythonPackage rec {
pname = "xontrib-prompt-starship";
version = "0.3.6";
format = "pyproject";
src = fetchPypi {
inherit pname version;
hash = "sha256-e0Qg9JbekjmTVTwdxQlEM4GW6YLUjWUhMulnKA8Bhnw=";
};
nativeBuildInputs = with python3Packages; [
setuptools
wheel
];
buildInputs = with python3Packages; [
xonsh-python
pdm-pep517
];
}

53
starship.toml Normal file
View file

@ -0,0 +1,53 @@
palette = "grey"
format = """$username$hostname$directory$fill[$all](solarized-dark)$time$line_break$character"""
[fill]
symbol = '─'
[cmd_duration]
min_time = 10000
[time]
disabled = false
time_format = "%F %T"
style = "#444444"
format = '[$time]($style)'
[palettes.grey]
grey = "#777777"
none = "#777777"
white = "#777777"
rosewater = "#777777"
flamingo = "#777777"
pink = "#777777"
mauve = "#777777"
maroon = "#777777"
peach = "#777777"
sky = "#777777"
sapphire = "#777777"
blue = "#777777"
lavender = "#777777"
text = "#777777"
subtext1 = "#777777"
subtext0 = "#777777"
overlay2 = "#777777"
overlay1 = "#777777"
overlay0 = "#777777"
surface2 = "#777777"
surface1 = "#777777"
surface0 = "#777777"
base = "#777777"
mantle = "#777777"
crust = "#777777"
background = "#777777"
current_line = "#777777"
foreground = "#777777"
comment = "#777777"
cyan = "#777777"
green = "#777777"
orange = "#777777"
purple = "#777777"
red = "#777777"
yellow = "#777777"

View file

@ -116,7 +116,8 @@ end)
-- Windows support.
-- Possibly replace with a per-platform equivalent?'
--if (hostname == "hinata") then
-- config['default_prog'] = {"C:\\Users\\deprekated\\scoop\\apps\\python\\current\\Scripts\\xonsh.exe"}
--end
if wezterm.target_triple == "x86_64-unknown-linux-gnu" then
config["default_prog"] = { "/run/current-system/sw/bin/zellij", "-l", "welcome" }
end
return config

View file

@ -5,13 +5,20 @@
def add_ssh_keys():
""" Adds any keys found to our ssh-agent. """
# Don't mess with SSH keys if we're using a remote agent.
# Don't mess with SSH keys if we're using a remote agent,
# or an agent that manages keys itself.
try:
if $SSH_AUTH_SOCK.startswith("/tmp"):
return
except KeyError:
return
try:
if $SSH_AUTH_SOCK.__contains__("1password"):
return
except KeyError:
return
# Automatically add each of our SSH keys.
for f in g`~/.ssh/id*`:
if not f.endswith('.pub'):

View file

@ -128,6 +128,9 @@ if XONSHRC_VERBOSE:
print("Final color scheme: " + $XONSH_COLOR_STYLE)
# Prompt config.
$STARSHIP_CONFIG = '~/.config/starship.toml'
# Load our Xonsh extensions.
xontrib load whole_word_jumping coreutils sh term_integration prompt_bar
xontrib load whole_word_jumping coreutils sh prompt_starship term_integration

290
zellij/config.kdl Normal file
View file

@ -0,0 +1,290 @@
//
// THIS FILE WAS AUTOGENERATED BY ZELLIJ, THE PREVIOUS FILE AT THIS LOCATION WAS COPIED TO: /home/deprekated/.config/zellij/config.kdl.bak.1
//
keybinds clear-defaults=true {
locked {
bind "`" { SwitchToMode "normal"; }
}
pane {
bind "left" { MoveFocus "left"; }
bind "down" { MoveFocus "down"; }
bind "up" { MoveFocus "up"; }
bind "right" { MoveFocus "right"; }
bind "c" { SwitchToMode "renamepane"; PaneNameInput 0; }
bind "d" { NewPane "down"; SwitchToMode "locked"; }
bind "e" { TogglePaneEmbedOrFloating; SwitchToMode "locked"; }
bind "f" { ToggleFocusFullscreen; SwitchToMode "locked"; }
bind "h" { MoveFocus "left"; }
bind "i" { TogglePanePinned; SwitchToMode "locked"; }
bind "j" { MoveFocus "down"; }
bind "k" { MoveFocus "up"; }
bind "l" { MoveFocus "right"; }
bind "n" { NewPane; SwitchToMode "locked"; }
bind "p" { SwitchToMode "normal"; }
bind "r" { NewPane "right"; SwitchToMode "locked"; }
bind "w" { ToggleFloatingPanes; SwitchToMode "locked"; }
bind "x" { CloseFocus; SwitchToMode "locked"; }
bind "z" { TogglePaneFrames; SwitchToMode "locked"; }
bind "tab" { SwitchFocus; }
}
tab {
bind "left" { GoToPreviousTab; }
bind "down" { GoToNextTab; }
bind "up" { GoToPreviousTab; }
bind "right" { GoToNextTab; }
bind "1" { GoToTab 1; SwitchToMode "locked"; }
bind "2" { GoToTab 2; SwitchToMode "locked"; }
bind "3" { GoToTab 3; SwitchToMode "locked"; }
bind "4" { GoToTab 4; SwitchToMode "locked"; }
bind "5" { GoToTab 5; SwitchToMode "locked"; }
bind "6" { GoToTab 6; SwitchToMode "locked"; }
bind "7" { GoToTab 7; SwitchToMode "locked"; }
bind "8" { GoToTab 8; SwitchToMode "locked"; }
bind "9" { GoToTab 9; SwitchToMode "locked"; }
bind "[" { BreakPaneLeft; SwitchToMode "locked"; }
bind "]" { BreakPaneRight; SwitchToMode "locked"; }
bind "b" { BreakPane; SwitchToMode "locked"; }
bind "h" { GoToPreviousTab; }
bind "j" { GoToNextTab; }
bind "k" { GoToPreviousTab; }
bind "l" { GoToNextTab; }
bind "n" { NewTab; SwitchToMode "locked"; }
bind "r" { SwitchToMode "renametab"; TabNameInput 0; }
bind "s" { ToggleActiveSyncTab; SwitchToMode "locked"; }
bind "t" { SwitchToMode "normal"; }
bind "x" { CloseTab; SwitchToMode "locked"; }
bind "tab" { ToggleTab; }
}
resize {
bind "left" { Resize "Increase left"; }
bind "down" { Resize "Increase down"; }
bind "up" { Resize "Increase up"; }
bind "right" { Resize "Increase right"; }
bind "+" { Resize "Increase"; }
bind "-" { Resize "Decrease"; }
bind "=" { Resize "Increase"; }
bind "H" { Resize "Decrease left"; }
bind "J" { Resize "Decrease down"; }
bind "K" { Resize "Decrease up"; }
bind "L" { Resize "Decrease right"; }
bind "h" { Resize "Increase left"; }
bind "j" { Resize "Increase down"; }
bind "k" { Resize "Increase up"; }
bind "l" { Resize "Increase right"; }
bind "r" { SwitchToMode "normal"; }
}
move {
bind "left" { MovePane "left"; }
bind "down" { MovePane "down"; }
bind "up" { MovePane "up"; }
bind "right" { MovePane "right"; }
bind "h" { MovePane "left"; }
bind "j" { MovePane "down"; }
bind "k" { MovePane "up"; }
bind "l" { MovePane "right"; }
bind "m" { SwitchToMode "normal"; }
bind "n" { MovePane; }
bind "p" { MovePaneBackwards; }
bind "tab" { MovePane; }
}
scroll {
bind "Alt left" { MoveFocusOrTab "left"; SwitchToMode "locked"; }
bind "Alt down" { MoveFocus "down"; SwitchToMode "locked"; }
bind "Alt up" { MoveFocus "up"; SwitchToMode "locked"; }
bind "Alt right" { MoveFocusOrTab "right"; SwitchToMode "locked"; }
bind "e" { EditScrollback; SwitchToMode "locked"; }
bind "f" { SwitchToMode "entersearch"; SearchInput 0; }
bind "Alt h" { MoveFocusOrTab "left"; SwitchToMode "locked"; }
bind "Alt j" { MoveFocus "down"; SwitchToMode "locked"; }
bind "Alt k" { MoveFocus "up"; SwitchToMode "locked"; }
bind "Alt l" { MoveFocusOrTab "right"; SwitchToMode "locked"; }
bind "s" { SwitchToMode "normal"; }
}
search {
bind "c" { SearchToggleOption "CaseSensitivity"; }
bind "n" { Search "down"; }
bind "o" { SearchToggleOption "WholeWord"; }
bind "p" { Search "up"; }
bind "w" { SearchToggleOption "Wrap"; }
}
session {
bind "a" {
LaunchOrFocusPlugin "zellij:about" {
floating true
move_to_focused_tab true
}
SwitchToMode "locked"
}
bind "c" {
LaunchOrFocusPlugin "configuration" {
floating true
move_to_focused_tab true
}
SwitchToMode "locked"
}
bind "d" { Detach; }
bind "o" { SwitchToMode "normal"; }
bind "p" {
LaunchOrFocusPlugin "plugin-manager" {
floating true
move_to_focused_tab true
}
SwitchToMode "locked"
}
bind "w" {
LaunchOrFocusPlugin "session-manager" {
floating true
move_to_focused_tab true
}
SwitchToMode "locked"
}
}
shared_among "normal" "locked" {
bind "Alt left" { MoveFocusOrTab "left"; }
bind "Alt down" { MoveFocus "down"; }
bind "Alt up" { MoveFocus "up"; }
bind "Alt right" { MoveFocusOrTab "right"; }
bind "Alt +" { Resize "Increase"; }
bind "Alt -" { Resize "Decrease"; }
bind "Alt =" { Resize "Increase"; }
bind "Alt [" { PreviousSwapLayout; }
bind "Alt ]" { NextSwapLayout; }
bind "Alt f" { ToggleFloatingPanes; }
bind "Alt h" { MoveFocusOrTab "left"; }
bind "Alt i" { MoveTab "left"; }
bind "Alt j" { MoveFocus "down"; }
bind "Alt k" { MoveFocus "up"; }
bind "Alt l" { MoveFocusOrTab "right"; }
bind "Alt n" { NewPane; }
bind "Alt o" { MoveTab "right"; }
}
shared_except "locked" "renametab" "renamepane" {
bind "`" {
WriteChars "`";
SwitchToMode "locked";
}
bind "Ctrl q" { Quit; }
}
shared_except "locked" "entersearch" {
bind "enter" { SwitchToMode "locked"; }
}
shared_except "locked" "entersearch" "renametab" "renamepane" {
bind "esc" { SwitchToMode "locked"; }
}
shared_except "locked" "entersearch" "renametab" "renamepane" "move" {
bind "m" { SwitchToMode "move"; }
}
shared_except "locked" "entersearch" "search" "renametab" "renamepane" "session" {
bind "o" { SwitchToMode "session"; }
}
shared_except "locked" "tab" "entersearch" "renametab" "renamepane" {
bind "t" { SwitchToMode "tab"; }
}
shared_except "locked" "tab" "scroll" "entersearch" "renametab" "renamepane" {
bind "s" { SwitchToMode "scroll"; }
}
shared_among "normal" "resize" "tab" "scroll" "prompt" "tmux" {
bind "p" { SwitchToMode "pane"; }
}
shared_except "locked" "resize" "pane" "tab" "entersearch" "renametab" "renamepane" {
bind "r" { SwitchToMode "resize"; }
}
shared_among "scroll" "search" {
bind "PageDown" { PageScrollDown; }
bind "PageUp" { PageScrollUp; }
bind "left" { PageScrollUp; }
bind "down" { ScrollDown; }
bind "up" { ScrollUp; }
bind "right" { PageScrollDown; }
bind "Ctrl b" { PageScrollUp; }
bind "Ctrl c" { ScrollToBottom; SwitchToMode "locked"; }
bind "d" { HalfPageScrollDown; }
bind "Ctrl f" { PageScrollDown; }
bind "h" { PageScrollUp; }
bind "j" { ScrollDown; }
bind "k" { ScrollUp; }
bind "l" { PageScrollDown; }
bind "u" { HalfPageScrollUp; }
}
entersearch {
bind "Ctrl c" { SwitchToMode "scroll"; }
bind "esc" { SwitchToMode "scroll"; }
bind "enter" { SwitchToMode "search"; }
}
renametab {
bind "esc" { UndoRenameTab; SwitchToMode "tab"; }
}
shared_among "renametab" "renamepane" {
bind "Ctrl c" { SwitchToMode "locked"; }
}
renamepane {
bind "esc" { UndoRenamePane; SwitchToMode "pane"; }
}
}
// Plugin aliases - can be used to change the implementation of Zellij
// changing these requires a restart to take effect
plugins {
about location="zellij:about"
compact-bar location="zellij:compact-bar"
configuration location="zellij:configuration"
filepicker location="zellij:strider" {
cwd "/"
}
plugin-manager location="zellij:plugin-manager"
session-manager location="zellij:session-manager"
status-bar location="zellij:status-bar"
strider location="zellij:strider"
tab-bar location="zellij:tab-bar"
welcome-screen location="zellij:session-manager" {
welcome_screen true
}
}
// Plugins to load in the background when a new session starts
load_plugins {}
// Choose the theme that is specified in the themes section.
// Default: default
//
theme "solarized-dark"
// Require a leader key before we run any commands.
default_mode "locked"
// Uncomment this when we're used enough to the keybinds. :)
// default_layout "compact"
// The folder in which Zellij will look for layouts
// (Requires restart)
//
// layout_dir "/tmp"
// The folder in which Zellij will look for themes
// (Requires restart)
//
// theme_dir "/tmp"
// Much scrollback.
scroll_buffer_size 100000
// Keep pane contents if we resurrect a terminal.
serialize_pane_viewport true
// Use the above limit for serializtaion.
scrollback_lines_to_serialize 0
// How often in seconds sessions are serialized
//
// serialization_interval 10000
// Whether to show tips on startup
// Default: true
//
show_startup_tips true
// Whether to show release notes on first version run
// Default: true
//
// show_release_notes false