mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
fish -> zsh (with a zed :3!)
This commit is contained in:
parent
2c916d10cc
commit
9b8c091120
6 changed files with 181 additions and 36 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./shell.nix
|
./zsh
|
||||||
./vim
|
./vim
|
||||||
./git.nix
|
./git.nix
|
||||||
./tmux.nix
|
./tmux.nix
|
||||||
|
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
{ config, lib, pkgs, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
config = lib.mkIf config.deploy.profile.kat {
|
|
||||||
programs.fish = {
|
|
||||||
enable = true;
|
|
||||||
interactiveShellInit = ''
|
|
||||||
fish_vi_key_bindings
|
|
||||||
set -g fish_greeting ""
|
|
||||||
'';
|
|
||||||
shellAliases = { nixdirfmt = "fd --color=never .nix | xargs nixfmt"; };
|
|
||||||
plugins = [{
|
|
||||||
name = "bass";
|
|
||||||
src = pkgs.fetchFromGitHub {
|
|
||||||
owner = "edc";
|
|
||||||
repo = "bass";
|
|
||||||
rev = "d63054b24c2f63aaa3a08fb9ec9d0da4c70ab922";
|
|
||||||
sha256 = "0pwci5xxm8308nrb52s5nyxijk0svar8nqrdfvkk2y34z1cg319b";
|
|
||||||
};
|
|
||||||
}];
|
|
||||||
};
|
|
||||||
programs.starship = {
|
|
||||||
enable = true;
|
|
||||||
enableFishIntegration = true;
|
|
||||||
};
|
|
||||||
programs.direnv = {
|
|
||||||
enable = true;
|
|
||||||
enableFishIntegration = true;
|
|
||||||
enableNixDirenvIntegration = true;
|
|
||||||
};
|
|
||||||
programs.bat.enable = true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
config = lib.mkIf config.deploy.profile.kat {
|
config = lib.mkIf config.deploy.profile.kat {
|
||||||
programs.fish.shellAliases = {
|
programs.zsh.shellAliases = {
|
||||||
tne = "tmux new -s";
|
tne = "tmux new -s";
|
||||||
tat = "tmux attach -t";
|
tat = "tmux attach -t";
|
||||||
tren = "tmux new -AD -s";
|
tren = "tmux new -AD -s";
|
||||||
|
|
|
||||||
36
config/profiles/kat/home/zsh/default.nix
Normal file
36
config/profiles/kat/home/zsh/default.nix
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
config = lib.mkIf config.deploy.profile.kat {
|
||||||
|
programs.zsh = {
|
||||||
|
enable = true;
|
||||||
|
shellAliases = { nixdirfmt = "fd --color=never .nix | xargs nixfmt"; };
|
||||||
|
initExtra = ''
|
||||||
|
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=3,bold"
|
||||||
|
source ${./zshrc-title}
|
||||||
|
'';
|
||||||
|
plugins = [{
|
||||||
|
name = "zsh-autosuggestions";
|
||||||
|
src = pkgs.fetchFromGitHub {
|
||||||
|
owner = "zsh-users";
|
||||||
|
repo = "zsh-autosuggestions";
|
||||||
|
rev = "v0.6.4";
|
||||||
|
sha256 = "0h52p2waggzfshvy1wvhj4hf06fmzd44bv6j18k3l9rcx6aixzn6";
|
||||||
|
};
|
||||||
|
}];
|
||||||
|
oh-my-zsh = {
|
||||||
|
enable = true;
|
||||||
|
plugins = [ "git" "sudo" "adb" "cargo" "emoji" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
programs.starship = {
|
||||||
|
enable = true;
|
||||||
|
enableZshIntegration = true;
|
||||||
|
};
|
||||||
|
programs.direnv = {
|
||||||
|
enable = true;
|
||||||
|
enableZshIntegration = true;
|
||||||
|
enableNixDirenvIntegration = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
142
config/profiles/kat/home/zsh/zshrc-title
Normal file
142
config/profiles/kat/home/zsh/zshrc-title
Normal file
|
|
@ -0,0 +1,142 @@
|
||||||
|
function term_title {
|
||||||
|
emulate -L zsh
|
||||||
|
unsetopt prompt_subst
|
||||||
|
|
||||||
|
[[ -t 1 ]] || return
|
||||||
|
|
||||||
|
local TITLE="$1"
|
||||||
|
local TAB="${2-$1}"
|
||||||
|
|
||||||
|
case "$TERM" in
|
||||||
|
cygwin|xterm*|putty*|rxvt*|ansi)
|
||||||
|
print -Pn "\e]2;$TITLE:q\a"
|
||||||
|
print -Pn "\e]1;$TAB:q\a"
|
||||||
|
;;
|
||||||
|
screen*)
|
||||||
|
print -Pn "\ek$TITLE:q\e\\"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
|
||||||
|
print -Pn "\e]2;$TITLE:q\a"
|
||||||
|
print -Pn "\e]1;$TAB:q\a"
|
||||||
|
else
|
||||||
|
if [[ -n "$terminfo[fsl]" ]] && [[ -n "$terminfo[tsl]" ]]; then
|
||||||
|
echoti tsl
|
||||||
|
print -Pn "$TITLE"
|
||||||
|
echoti fsl
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
function term_dir {
|
||||||
|
emulate -L zsh
|
||||||
|
|
||||||
|
[[ -t 1 ]] || return
|
||||||
|
|
||||||
|
local DIR="${1-$PWD}"
|
||||||
|
|
||||||
|
if [[ "${TERM_PROGRAM-}" == "Apple_Terminal" ]]; then
|
||||||
|
local URL_PATH="$(__omz_urlencode -P "$DIR")"
|
||||||
|
[[ $? != 0 ]] && return 1
|
||||||
|
|
||||||
|
printf '\e]7;%s\a' "file://$HOST$URL_PATH"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function __arc_update_precmd {
|
||||||
|
local TERM_TITLE="%~"
|
||||||
|
local TERM_TAB="%~"
|
||||||
|
|
||||||
|
if [[ "${TERM_PROGRAM-}" == "Apple_Terminal" ]]; then
|
||||||
|
TERM_TAB="$USER@%m"
|
||||||
|
TERM_TITLE="$TERM_TAB"
|
||||||
|
elif [[ "$USER" != "$DEFAULT_USER" || -n "${SSH_CLIENT-}" ]]; then
|
||||||
|
TERM_TAB="$USER@%m"
|
||||||
|
TERM_TITLE="$TERM_TAB - $TERM_TITLE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
term_title "$TERM_TITLE" "$TERM_TAB"
|
||||||
|
}
|
||||||
|
|
||||||
|
function __arc_update_preexec {
|
||||||
|
emulate -L zsh
|
||||||
|
setopt extended_glob
|
||||||
|
|
||||||
|
local TERM_TAB=${1[(wr)^(*=*|sudo|ssh|mosh|rake|-*)]:gs/%/%%}
|
||||||
|
local TERM_TITLE="${2:gs/%/%%}"
|
||||||
|
|
||||||
|
if [[ "$USER" != "$DEFAULT_USER" || -n "${SSH_CLIENT-}" ]]; then
|
||||||
|
TERM_TAB="$USER@%m - $TERM_TAB"
|
||||||
|
TERM_TITLE="$USER@%m - $TERM_TITLE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
term_title "$TERM_TITLE" "$TERM_TAB"
|
||||||
|
}
|
||||||
|
|
||||||
|
zmodload zsh/langinfo
|
||||||
|
|
||||||
|
function __omz_urlencode() {
|
||||||
|
emulate -L zsh
|
||||||
|
zparseopts -D -E -a opts r m P
|
||||||
|
|
||||||
|
local in_str=$1
|
||||||
|
local url_str=""
|
||||||
|
local spaces_as_plus
|
||||||
|
if [[ -z $opts[(r)-P] ]]; then spaces_as_plus=1; fi
|
||||||
|
local str="$in_str"
|
||||||
|
|
||||||
|
# URLs must use UTF-8 encoding; convert str to UTF-8 if required
|
||||||
|
local encoding=$langinfo[CODESET]
|
||||||
|
local safe_encodings
|
||||||
|
safe_encodings=(UTF-8 utf8 US-ASCII)
|
||||||
|
if [[ -z ${safe_encodings[(r)$encoding]} ]]; then
|
||||||
|
str=$(echo -E "$str" | iconv -f $encoding -t UTF-8)
|
||||||
|
if [[ $? != 0 ]]; then
|
||||||
|
echo "Error converting string from $encoding to UTF-8" >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Use LC_CTYPE=C to process text byte-by-byte
|
||||||
|
local i byte ord LC_ALL=C
|
||||||
|
export LC_ALL
|
||||||
|
local reserved=';/?:@&=+$,'
|
||||||
|
local mark='_.!~*''()-'
|
||||||
|
local dont_escape="[A-Za-z0-9"
|
||||||
|
if [[ -z $opts[(r)-r] ]]; then
|
||||||
|
dont_escape+=$reserved
|
||||||
|
fi
|
||||||
|
# $mark must be last because of the "-"
|
||||||
|
if [[ -z $opts[(r)-m] ]]; then
|
||||||
|
dont_escape+=$mark
|
||||||
|
fi
|
||||||
|
dont_escape+="]"
|
||||||
|
|
||||||
|
# Implemented to use a single printf call and avoid subshells in the loop,
|
||||||
|
# for performance (primarily on Windows).
|
||||||
|
local url_str=""
|
||||||
|
for (( i = 1; i <= ${#str}; ++i )); do
|
||||||
|
byte="$str[i]"
|
||||||
|
if [[ "$byte" =~ "$dont_escape" ]]; then
|
||||||
|
url_str+="$byte"
|
||||||
|
else
|
||||||
|
if [[ "$byte" == " " && -n $spaces_as_plus ]]; then
|
||||||
|
url_str+="+"
|
||||||
|
else
|
||||||
|
ord=$(( [##16] #byte ))
|
||||||
|
url_str+="%$ord"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo -E "$url_str"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ -z "${ARC_PROMPT_RUN-}" ]]; then
|
||||||
|
chpwd_functions+=(term_dir)
|
||||||
|
precmd_functions+=(__arc_update_precmd)
|
||||||
|
preexec_functions+=(__arc_update_preexec)
|
||||||
|
|
||||||
|
term_dir
|
||||||
|
fi
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
openssh.authorizedKeys.keys = [
|
openssh.authorizedKeys.keys = [
|
||||||
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCocjQqiDIvzq+Qu3jkf7FXw5piwtvZ1Mihw9cVjdVcsra3U2c9WYtYrA3rS50N3p00oUqQm9z1KUrvH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/M9BK9FS2iNnBF5x6shJ9SU5IK4ySxq8qvN7Us8emkN3pyO8yqgsSOzzJT1JmWUAx0tZWG/BwKcFBHfceAPQl6pwxx28TM3BTBRYdzPJLTkAy48y6iXW6UYdfAPlShy79IYjQtEThTuIiEzdzgYdros0x3PDniuAP0KOKMgbikr0gRa6zahPjf0qqBnHeLB6nHAfaVzI0aNbhOg2bdOueE1FX0x48sjKqjOpjlIfq4WeZp9REr2YHEsoLFOBfgId5P3BPtpBQ== cardno:000612078454"
|
||||||
];
|
];
|
||||||
shell = pkgs.fish;
|
shell = pkgs.zsh;
|
||||||
extraGroups = [ "wheel" "video" ];
|
extraGroups = [ "wheel" "video" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue