feat(zsh): use atuin, better xdg, lint zsh
This commit is contained in:
parent
817e3f8e09
commit
7f4ec84c49
6 changed files with 70 additions and 55 deletions
|
@ -36,8 +36,8 @@
|
|||
# konf
|
||||
source <(konf-go shellwrapper zsh)
|
||||
source <(konf-go completion zsh)
|
||||
# open last konf on new shell session, only if konf store has been initialized
|
||||
[[ -d ~/.kube/konfs/store ]] && export KUBECONFIG=$(konf-go --silent set -)
|
||||
# ignore if konf store hasn't been initialized
|
||||
export KUBECONFIG=$(konf-go --silent set - || true)
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
}: {
|
||||
programs.wezterm = {
|
||||
enable = true;
|
||||
package = pkgs.nur.repos.nekowinston.wezterm-nightly;
|
||||
# package = pkgs.nur.repos.nekowinston.wezterm-nightly;
|
||||
extraConfig = ''
|
||||
package.path = "${flakePath}/home/apps/wezterm/?.lua;" .. package.path;
|
||||
return require("config")
|
||||
|
|
|
@ -9,8 +9,21 @@
|
|||
source = config.lib.file.mkOutOfStoreSymlink "${flakePath}/${fileName}";
|
||||
recursive = recursive;
|
||||
};
|
||||
zshPlugins = plugins: (map (plugin: rec {
|
||||
name = src.name;
|
||||
inherit (plugin) file src;
|
||||
})
|
||||
plugins);
|
||||
in {
|
||||
programs = {
|
||||
atuin = {
|
||||
enable = true;
|
||||
flags = ["--disable-up-arrow"];
|
||||
settings = {
|
||||
inline_height = 30;
|
||||
style = "compact";
|
||||
};
|
||||
};
|
||||
bat.enable = true;
|
||||
btop = {
|
||||
enable = true;
|
||||
|
@ -38,7 +51,6 @@ in {
|
|||
enableAliases = true;
|
||||
};
|
||||
|
||||
mcfly.enable = true;
|
||||
nix-index.enable = true;
|
||||
|
||||
starship = {
|
||||
|
@ -71,16 +83,15 @@ in {
|
|||
initExtra = let
|
||||
functionsDir = "${config.home.homeDirectory}/${config.programs.zsh.dotDir}/functions";
|
||||
in ''
|
||||
for conf in "${functionsDir}"/**/*.zsh; do
|
||||
source "$conf"
|
||||
for script in "${functionsDir}"/**/*; do
|
||||
source "$script"
|
||||
done
|
||||
'';
|
||||
|
||||
sessionVariables = {
|
||||
ZVM_INIT_MODE = "sourcing";
|
||||
ZVM_CURSOR_BLINKING_BEAM = "1";
|
||||
LESSHISTFILE = "-";
|
||||
};
|
||||
envExtra = ''
|
||||
export LESSHISTFILE="-"
|
||||
export ZVM_INIT_MODE="sourcing"
|
||||
export ZVM_CURSOR_BLINKING_BEAM="1"
|
||||
'';
|
||||
|
||||
dotDir = ".config/zsh";
|
||||
oh-my-zsh = {
|
||||
|
@ -94,35 +105,30 @@ in {
|
|||
"kubectl"
|
||||
];
|
||||
};
|
||||
plugins = [
|
||||
plugins = with pkgs; (zshPlugins [
|
||||
{
|
||||
name = "zsh-fast-syntax-highlighting";
|
||||
src = pkgs.zsh-fast-syntax-highlighting;
|
||||
file = "share/zsh/site-functions/fast-syntax-highlighting.plugin.zsh";
|
||||
src = zsh-vi-mode;
|
||||
file = "share/zsh-vi-mode/zsh-vi-mode.plugin.zsh";
|
||||
}
|
||||
{
|
||||
name = "zsh-nix-shell";
|
||||
src = pkgs.zsh-nix-shell;
|
||||
src = zsh-nix-shell;
|
||||
file = "share/zsh-nix-shell/nix-shell.plugin.zsh";
|
||||
}
|
||||
{
|
||||
name = "zsh-vi-mode";
|
||||
src = pkgs.zsh-vi-mode;
|
||||
file = "share/zsh-vi-mode/zsh-vi-mode.plugin.zsh";
|
||||
src = zsh-fast-syntax-highlighting;
|
||||
file = "share/zsh/site-functions/fast-syntax-highlighting.plugin.zsh";
|
||||
}
|
||||
];
|
||||
]);
|
||||
shellAliases = {
|
||||
cat =
|
||||
if isDarwin
|
||||
then "bat --theme=\$(defaults read -globalDomain AppleInterfaceStyle &> /dev/null && echo Catppuccin-mocha || echo Catppuccin-latte)"
|
||||
else "bat";
|
||||
# switch between yubikeys for the same GPG key
|
||||
switch_yubikeys = "gpg-connect-agent \"scd serialno\" \"learn --force\" /bye";
|
||||
switch_yubikeys = ''gpg-connect-agent "scd serialno" "learn --force" "/bye"'';
|
||||
tree = "lsd --tree";
|
||||
};
|
||||
history = {
|
||||
path = "${config.xdg.configHome}/zsh/history";
|
||||
};
|
||||
history.path = "${config.xdg.configHome}/zsh/history";
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# vim:ft=zsh
|
||||
local MAPPINGS='
|
||||
video/3gpp,3gp
|
||||
video/3gpp2,3g2
|
||||
|
@ -35,8 +36,8 @@ function icat() {
|
|||
}
|
||||
|
||||
if [ ! -t 0 ]; then
|
||||
input="$(cat - | base64)"
|
||||
headers="$(echo "$input" | base64 -d | file - --mime-type | cut -d " " -f2-)"
|
||||
local input="$(cat - | base64)"
|
||||
local headers="$(echo "$input" | base64 -d | file - --mime-type | cut -d " " -f2-)"
|
||||
|
||||
case $headers in
|
||||
*svg*) echo "$input" | base64 -d | displaySVG ;;
|
12
home/apps/zsh/functions/incognito
Normal file
12
home/apps/zsh/functions/incognito
Normal file
|
@ -0,0 +1,12 @@
|
|||
# vim:ft=zsh
|
||||
function incognito() {
|
||||
if [[ -n $ZSH_INCOGNITO ]]; then
|
||||
add-zsh-hook precmd _atuin_precmd
|
||||
add-zsh-hook preexec _atuin_preexec
|
||||
unset ZSH_INCOGNITO
|
||||
else
|
||||
add-zsh-hook -d precmd _atuin_precmd
|
||||
add-zsh-hook -d preexec _atuin_preexec
|
||||
export ZSH_INCOGNITO=1
|
||||
fi
|
||||
}
|
50
home/xdg.nix
50
home/xdg.nix
|
@ -6,50 +6,46 @@
|
|||
...
|
||||
}: let
|
||||
inherit (pkgs.stdenv.hostPlatform) isDarwin isLinux;
|
||||
inherit (config.xdg) cacheHome configHome dataHome;
|
||||
inherit (config.home) homeDirectory;
|
||||
in {
|
||||
home = {
|
||||
home = rec {
|
||||
sessionVariables = {
|
||||
AZURE_CONFIG_DIR = "${config.xdg.configHome}/azure";
|
||||
CARGO_HOME = "${config.xdg.dataHome}/cargo";
|
||||
AZURE_CONFIG_DIR = "${configHome}/azure";
|
||||
CARGO_HOME = "${dataHome}/cargo";
|
||||
CARGO_REGISTRIES_CRATES_IO_PROTOCOL = "sparse";
|
||||
CARGO_UNSTABLE_SPARSE_REGISTRY = "true";
|
||||
CUDA_CACHE_PATH = "${config.xdg.dataHome}/nv";
|
||||
DOCKER_CONFIG = "${config.xdg.configHome}/docker";
|
||||
GEM_HOME = "${config.xdg.dataHome}/gem";
|
||||
GEM_SPEC_CACHE = "${config.xdg.cacheHome}/gem";
|
||||
GOPATH = "${config.xdg.dataHome}/go";
|
||||
NPM_CONFIG_USERCONFIG = "${config.xdg.configHome}/npm/npmrc";
|
||||
RUSTUP_HOME = "${config.xdg.dataHome}/rustup";
|
||||
XCOMPOSECACHE = "${config.xdg.cacheHome}/X11/xcompose";
|
||||
CUDA_CACHE_PATH = "${dataHome}/nv";
|
||||
DOCKER_CONFIG = "${configHome}/docker";
|
||||
GEM_HOME = "${dataHome}/gem";
|
||||
GEM_SPEC_CACHE = "${cacheHome}/gem";
|
||||
GOPATH = "${dataHome}/go";
|
||||
NPM_CONFIG_USERCONFIG = "${configHome}/npm/npmrc";
|
||||
NODE_REPL_HISTORY = "${dataHome}/node_repl_history";
|
||||
RUSTUP_HOME = "${dataHome}/rustup";
|
||||
WINEPREFIX = "${dataHome}/wine";
|
||||
XCOMPOSECACHE = "${cacheHome}/X11/xcompose";
|
||||
};
|
||||
sessionPath = [
|
||||
"$HOME/.local/bin"
|
||||
"${config.xdg.dataHome}/krew/bin"
|
||||
"${config.home.sessionVariables.GOPATH}/bin"
|
||||
"${config.home.sessionVariables.CARGO_HOME}/bin"
|
||||
"${dataHome}/krew/bin"
|
||||
"${sessionVariables.GOPATH}/bin"
|
||||
"${sessionVariables.CARGO_HOME}/bin"
|
||||
];
|
||||
};
|
||||
|
||||
home.activation.npmrc_xdg = ''
|
||||
export NPM_CONFIG_USERCONFIG="${config.home.sessionVariables.NPM_CONFIG_USERCONFIG}"
|
||||
${pkgs.nodejs + "/bin/npm"} config set \
|
||||
prefix="${config.xdg.dataHome}/npm" \
|
||||
cache="${config.xdg.cacheHome}/npm" \
|
||||
init-module="${config.xdg.configHome}/npm/config/npm-init.js"
|
||||
'';
|
||||
|
||||
# NOTE: workaround for gpgme on Darwin, since GUI apps aren't aware of $GNUPGHOME
|
||||
programs.gpg.homedir =
|
||||
if isDarwin
|
||||
then "${config.home.homeDirectory}/.gnupg"
|
||||
else "${config.xdg.configHome}/gnupg";
|
||||
then "${homeDirectory}/.gnupg"
|
||||
else "${configHome}/gnupg";
|
||||
|
||||
xdg = {
|
||||
enable = true;
|
||||
userDirs.enable = isLinux;
|
||||
cacheHome = "${config.home.homeDirectory}/.cache";
|
||||
configHome = "${config.home.homeDirectory}/.config";
|
||||
dataHome = "${config.home.homeDirectory}/.local/share";
|
||||
cacheHome = "${homeDirectory}/.cache";
|
||||
configHome = "${homeDirectory}/.config";
|
||||
dataHome = "${homeDirectory}/.local/share";
|
||||
mimeApps = {
|
||||
enable = isLinux;
|
||||
defaultApplications = {
|
||||
|
|
Loading…
Reference in a new issue