flake: clean up modules
This commit is contained in:
parent
28f18c9a99
commit
8cd8b3a3f9
64 changed files with 258 additions and 273 deletions
|
@ -1,118 +1,113 @@
|
|||
{ config, lib, pkgs, main, ... }: {
|
||||
imports = [ ./common.nix ];
|
||||
{ config, main, pkgs, ... }:
|
||||
{
|
||||
programs.zsh = rec {
|
||||
enable = true;
|
||||
|
||||
programs = {
|
||||
zsh = rec {
|
||||
enable = true;
|
||||
enableCompletion = true;
|
||||
enableVteIntegration = true;
|
||||
autosuggestion.enable = true;
|
||||
syntaxHighlighting.enable = true;
|
||||
|
||||
enableCompletion = true;
|
||||
enableVteIntegration = true;
|
||||
autosuggestion.enable = true;
|
||||
syntaxHighlighting.enable = true;
|
||||
# defaultKeymap = "emacs";
|
||||
|
||||
# defaultKeymap = "emacs";
|
||||
initExtraFirst = ''
|
||||
[[ $TERM == "tramp" ]] && unsetopt zle && PS1='$ ' && return
|
||||
'';
|
||||
|
||||
initExtraFirst = ''
|
||||
[[ $TERM == "tramp" ]] && unsetopt zle && PS1='$ ' && return
|
||||
'';
|
||||
initExtra = ''
|
||||
${pkgs.kitty}/bin/kitty + complete setup zsh | source /dev/stdin
|
||||
${pkgs.any-nix-shell}/bin/any-nix-shell zsh --info-right | source /dev/stdin
|
||||
|
||||
initExtra = ''
|
||||
${pkgs.kitty}/bin/kitty + complete setup zsh | source /dev/stdin
|
||||
${pkgs.any-nix-shell}/bin/any-nix-shell zsh --info-right | source /dev/stdin
|
||||
functions -c precmd precmd_any_nix_shell
|
||||
|
||||
functions -c precmd precmd_any_nix_shell
|
||||
precmd() {
|
||||
precmd_any_nix_shell
|
||||
|
||||
precmd() {
|
||||
precmd_any_nix_shell
|
||||
|
||||
if [[ -s ~/TODO.txt && ! -v __TODO_PRINTED ]] then
|
||||
export __TODO_PRINTED=1
|
||||
if [[ "$(cat ~/TODO.txt)" != "" ]] then
|
||||
echo TODO:
|
||||
\cat ~/TODO.txt
|
||||
fi
|
||||
if [[ -s ~/TODO.txt && ! -v __TODO_PRINTED ]] then
|
||||
export __TODO_PRINTED=1
|
||||
if [[ "$(cat ~/TODO.txt)" != "" ]] then
|
||||
echo TODO:
|
||||
\cat ~/TODO.txt
|
||||
fi
|
||||
}
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ "$(basename "$(readlink "/proc/$PPID/exe")")" == ".kitty-wrapped" ]]; then
|
||||
PATH=$(echo "$PATH" | sed 's/\/nix\/store\/[a-zA-Z._0-9+-]\+\/bin:\?//g' | sed 's/:$//')
|
||||
if [[ "$(basename "$(readlink "/proc/$PPID/exe")")" == ".kitty-wrapped" ]]; then
|
||||
PATH=$(echo "$PATH" | sed 's/\/nix\/store\/[a-zA-Z._0-9+-]\+\/bin:\?//g' | sed 's/:$//')
|
||||
fi
|
||||
|
||||
j() {
|
||||
if [[ $# -eq 0 ]] then
|
||||
\builtin cd -- "$(fd -H -t d | fzf --filepath-word)"
|
||||
else
|
||||
\builtin cd -- "$(fd -H -t d | fzf --filepath-word -1 -q "$*")"
|
||||
fi
|
||||
}
|
||||
|
||||
alias "jh"="cd ~ && j"
|
||||
alias "gj"="gcd && j"
|
||||
|
||||
mktmpunzip() {
|
||||
dir=$(mktemp -t -d unzip.XXX)
|
||||
if ! file=$(realpath -e "$1"); then
|
||||
echo "error: file does not exist"
|
||||
return 1
|
||||
fi
|
||||
shift 1
|
||||
unzip "$file" "$@" -d "$dir"
|
||||
\builtin cd $dir
|
||||
mv $file .
|
||||
}
|
||||
|
||||
mktmpclone() {
|
||||
location="$1"
|
||||
if [ "$2" != "" ]; then
|
||||
dirspec="$2.XXX"
|
||||
shift 2
|
||||
else
|
||||
dirspec="clone.XXX"
|
||||
shift 1
|
||||
fi
|
||||
if ! dir=$(mktemp -t -d "$dirspec"); then
|
||||
echo "error: couldn't create temp directory"
|
||||
return 1
|
||||
fi
|
||||
|
||||
j() {
|
||||
if [[ $# -eq 0 ]] then
|
||||
\builtin cd -- "$(fd -H -t d | fzf --filepath-word)"
|
||||
else
|
||||
\builtin cd -- "$(fd -H -t d | fzf --filepath-word -1 -q "$*")"
|
||||
fi
|
||||
}
|
||||
git clone "$location" "$dir" "$@"
|
||||
\builtin cd "$dir"
|
||||
}
|
||||
'';
|
||||
|
||||
alias "jh"="cd ~ && j"
|
||||
alias "gj"="gcd && j"
|
||||
dotDir = ".config/zsh";
|
||||
|
||||
mktmpunzip() {
|
||||
dir=$(mktemp -t -d unzip.XXX)
|
||||
if ! file=$(realpath -e "$1"); then
|
||||
echo "error: file does not exist"
|
||||
return 1
|
||||
fi
|
||||
shift 1
|
||||
unzip "$file" "$@" -d "$dir"
|
||||
\builtin cd $dir
|
||||
mv $file .
|
||||
}
|
||||
history.path = "$HOME/${dotDir}/.zsh_history";
|
||||
|
||||
mktmpclone() {
|
||||
location="$1"
|
||||
if [ "$2" != "" ]; then
|
||||
dirspec="$2.XXX"
|
||||
shift 2
|
||||
else
|
||||
dirspec="clone.XXX"
|
||||
shift 1
|
||||
fi
|
||||
if ! dir=$(mktemp -t -d "$dirspec"); then
|
||||
echo "error: couldn't create temp directory"
|
||||
return 1
|
||||
fi
|
||||
|
||||
git clone "$location" "$dir" "$@"
|
||||
\builtin cd "$dir"
|
||||
}
|
||||
'';
|
||||
|
||||
dotDir = ".config/zsh";
|
||||
|
||||
history.path = "$HOME/${dotDir}/.zsh_history";
|
||||
|
||||
shellAliases = main.environment.shellAliases // config.home.shellAliases // {
|
||||
lsdiskw = "while true; do clear; lsdisk; sleep 1; done";
|
||||
};
|
||||
|
||||
oh-my-zsh = {
|
||||
enable = true;
|
||||
plugins = [
|
||||
# Display
|
||||
"colorize"
|
||||
"colored-man-pages"
|
||||
|
||||
# zsh modifications
|
||||
"zsh-interactive-cd"
|
||||
"sudo"
|
||||
|
||||
# Aliases
|
||||
"alias-finder"
|
||||
|
||||
# Applications
|
||||
## Python
|
||||
"pip"
|
||||
## Git
|
||||
"gitignore"
|
||||
## Vim
|
||||
"fancy-ctrl-z"
|
||||
];
|
||||
};
|
||||
shellAliases = main.environment.shellAliases // config.home.shellAliases // {
|
||||
lsdiskw = "while true; do clear; lsdisk; sleep 1; done";
|
||||
};
|
||||
|
||||
starship.enableZshIntegration = lib.mkIf config.programs.starship.enable true;
|
||||
oh-my-zsh = {
|
||||
enable = true;
|
||||
plugins = [
|
||||
# Display
|
||||
"colorize"
|
||||
"colored-man-pages"
|
||||
|
||||
# zsh modifications
|
||||
"zsh-interactive-cd"
|
||||
"sudo"
|
||||
|
||||
# Aliases
|
||||
"alias-finder"
|
||||
|
||||
# Applications
|
||||
## Python
|
||||
"pip"
|
||||
## Git
|
||||
"gitignore"
|
||||
## Vim
|
||||
"fancy-ctrl-z"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue