mirror of
https://github.com/zoriya/flake.git
synced 2026-08-15 18:43:42 +00:00
Switch from p10k to starship
This commit is contained in:
+102
-30
@@ -1,7 +1,8 @@
|
||||
{pkgs, ...}: let
|
||||
configThemeNormal = ./p10k.zsh;
|
||||
configThemeTTY = ./p10k-tty.zsh;
|
||||
in {
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
home.packages = with pkgs; [
|
||||
eza
|
||||
viu
|
||||
@@ -51,11 +52,106 @@ in {
|
||||
|
||||
programs.less.enable = true;
|
||||
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
settings = {
|
||||
add_newline = false;
|
||||
|
||||
format = lib.concatStrings [
|
||||
"$fill"
|
||||
"$hostname"
|
||||
"$python"
|
||||
"$nix_shell"
|
||||
"$line_break"
|
||||
"$directory"
|
||||
"[(\\($git_branch$git_commit$git_status$git_state\\) )](green)"
|
||||
"$character"
|
||||
];
|
||||
|
||||
right_format = lib.concatStrings [
|
||||
"$cmd_duration"
|
||||
"$status"
|
||||
"$jobs"
|
||||
];
|
||||
|
||||
fill = {
|
||||
symbol = "·";
|
||||
style = "fg:#808080";
|
||||
};
|
||||
|
||||
directory = {
|
||||
truncate_to_repo = false;
|
||||
fish_style_pwd_dir_length = 1;
|
||||
style = "bold fg:#00AFFF";
|
||||
};
|
||||
|
||||
git_branch = {
|
||||
format = "([($branch(: $remote_branch))]($style))";
|
||||
style = "green";
|
||||
};
|
||||
|
||||
git_commit = {
|
||||
format = "[( $hash$tag)]($style)";
|
||||
style = "green";
|
||||
only_detached = true;
|
||||
tag_disabled = false;
|
||||
};
|
||||
|
||||
git_status = {
|
||||
format = "([$all_status$ahead_behind]($style))";
|
||||
style = "yellow";
|
||||
ahead = " ⇡$count";
|
||||
behind = " ⇣$count";
|
||||
diverged = "";
|
||||
conflicted = " =$count";
|
||||
untracked = " ?$count";
|
||||
stashed = " *$count";
|
||||
modified = " !$count";
|
||||
staged = " +$count";
|
||||
deleted = "";
|
||||
renamed = "";
|
||||
};
|
||||
|
||||
git_state = {
|
||||
format = ''[$state( $progress_current/$progress_total)]($style)'';
|
||||
style = "bright-black";
|
||||
};
|
||||
|
||||
status = {
|
||||
format = " [($symbol ($signal_name )$status)]($style)";
|
||||
pipestatus_format = "[$symbol $pipestatus]($style)";
|
||||
pipestatus_segment_format = "[($signal_name )$status]($style)";
|
||||
symbol = "x";
|
||||
pipestatus = true;
|
||||
disabled = false;
|
||||
};
|
||||
|
||||
cmd_duration = {
|
||||
format = " [$duration]($style)";
|
||||
};
|
||||
|
||||
jobs = {
|
||||
format = " [$symbol$number]($style)";
|
||||
};
|
||||
|
||||
python = {
|
||||
format = "[( \($virtualenv\))]($style)";
|
||||
};
|
||||
|
||||
nix_shell = {
|
||||
format = "[\( $name\) nix]($style)";
|
||||
style = "cyan";
|
||||
heuristic = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
autocd = true;
|
||||
autosuggestion.enable = true;
|
||||
enableCompletion = true;
|
||||
# already handled at system level
|
||||
enableCompletion = false;
|
||||
syntaxHighlighting.enable = true;
|
||||
dotDir = ".config/zsh";
|
||||
shellAliases = {
|
||||
@@ -89,11 +185,6 @@ in {
|
||||
};
|
||||
|
||||
plugins = [
|
||||
{
|
||||
name = "powerlevel10k";
|
||||
src = pkgs.zsh-powerlevel10k;
|
||||
file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme";
|
||||
}
|
||||
{
|
||||
name = "you-should-use";
|
||||
src = pkgs.zsh-you-should-use;
|
||||
@@ -110,26 +201,7 @@ in {
|
||||
file = "./custom.zsh";
|
||||
}
|
||||
];
|
||||
initExtra = ''
|
||||
# The powerlevel theme I'm using is distgusting in TTY, let's default
|
||||
# to something else
|
||||
# See https://github.com/romkatv/powerlevel10k/issues/325
|
||||
# Instead of sourcing this file you could also add another plugin as
|
||||
# this, and it will automatically load the file for us
|
||||
# (but this way it is not possible to conditionally load a file)
|
||||
# {
|
||||
# name = "powerlevel10k-config";
|
||||
# src = lib.cleanSource ./p10k-config;
|
||||
# file = "p10k.zsh";
|
||||
# }
|
||||
if zmodload zsh/terminfo && (( terminfo[colors] >= 256 )); then
|
||||
[[ ! -f ${configThemeNormal} ]] || source ${configThemeNormal}
|
||||
else
|
||||
[[ ! -f ${configThemeTTY} ]] || source ${configThemeTTY}
|
||||
fi
|
||||
|
||||
${builtins.readFile ./init.zsh}
|
||||
'';
|
||||
initExtra = builtins.readFile ./init.zsh;
|
||||
|
||||
oh-my-zsh = {
|
||||
enable = true;
|
||||
|
||||
@@ -3,10 +3,6 @@ if [[ -z "$TMUX" ]]; then
|
||||
exec tmux new-session -s "$(hexdump -n 4 -v -e '/1 "%02X"' /dev/urandom)"
|
||||
fi
|
||||
|
||||
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
|
||||
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
|
||||
fi
|
||||
|
||||
# This speeds up pasting w/ autosuggest
|
||||
# https://github.com/zsh-users/zsh-autosuggestions/issues/238
|
||||
pasteinit() {
|
||||
@@ -47,3 +43,6 @@ function zvm_after_init() {
|
||||
eval "$(nix-your-shell zsh)"
|
||||
|
||||
setopt rm_star_silent
|
||||
|
||||
# case insensitive completion
|
||||
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user