working zsh-in-nix
This commit is contained in:
parent
bdd8b623f2
commit
ff6161b1d9
9 changed files with 94 additions and 126 deletions
|
@ -89,13 +89,14 @@ in {
|
|||
programs.direnv = {
|
||||
enable = true;
|
||||
nix-direnv.enable = true;
|
||||
enableZshIntegration = true;
|
||||
};
|
||||
|
||||
programs.eza = {
|
||||
enable = true;
|
||||
git = true;
|
||||
icons = true;
|
||||
enableAliases = false;
|
||||
enableAliases = true;
|
||||
};
|
||||
|
||||
programs.gh = {
|
||||
|
@ -110,11 +111,6 @@ in {
|
|||
enable = true;
|
||||
};
|
||||
|
||||
programs.mcfly = {
|
||||
enable = false;
|
||||
keyScheme = "vim";
|
||||
};
|
||||
|
||||
programs.nix-index-database = {
|
||||
comma.enable = true;
|
||||
};
|
||||
|
@ -148,7 +144,7 @@ in {
|
|||
|
||||
programs.wezterm = {
|
||||
enable = true;
|
||||
enableZshIntegration = false;
|
||||
enableZshIntegration = true;
|
||||
extraConfig = builtins.readFile ../../wezterm/wezterm.lua;
|
||||
};
|
||||
|
||||
|
@ -156,19 +152,6 @@ in {
|
|||
enable = true;
|
||||
};
|
||||
|
||||
programs.zsh = {
|
||||
enable = false;
|
||||
};
|
||||
|
||||
# programs.doom-emacs = {
|
||||
# enable = true;
|
||||
# doomPrivateDir = ../../emacs/emacs.doom;
|
||||
# emacsPackage =
|
||||
# if isDarwin
|
||||
# then pkgs.emacs
|
||||
# else pkgs.emacs;
|
||||
# };
|
||||
|
||||
imports = [
|
||||
./modules/packages
|
||||
./modules/files.nix
|
||||
|
|
|
@ -6,15 +6,13 @@
|
|||
}: let
|
||||
repo_root = "../../..";
|
||||
in {
|
||||
home.file.".ideavimrc".source = ./${repo_root}/ideavim/ideavimrc;
|
||||
xdg.configFile."erdtree/.erdtreerc".source = ./${repo_root}/erdtree/erdtreerc;
|
||||
xdg.configFile."ov/config.yaml".source = ./${repo_root}/ov/ov-less.yaml;
|
||||
home.file."bin/git-sync".source = ./${repo_root}/git-sync;
|
||||
xdg.configFile."kitty/kitty.conf".source = ./${repo_root}/kitty/kitty.conf;
|
||||
xdg.configFile."lsd/config.yaml".source = ./${repo_root}/lsd/config.yaml;
|
||||
home.file.".cargo/config.toml".source = pkgs.substituteAll {
|
||||
src = ./${repo_root}/cargo/config.toml.nixtemplate;
|
||||
profileDir = config.home.profileDirectory;
|
||||
home.file = {
|
||||
"bin/git-sync".source = ./${repo_root}/git-sync;
|
||||
".cargo/config.toml".source = pkgs.substituteAll {
|
||||
src = ./${repo_root}/cargo/config.toml.nixtemplate;
|
||||
profileDir = config.home.profileDirectory;
|
||||
};
|
||||
".ideavimrc".source = ./${repo_root}/ideavim/ideavimrc;
|
||||
};
|
||||
xdg.configFile = {
|
||||
"doom/init.el" = {
|
||||
|
@ -29,5 +27,9 @@ in {
|
|||
source = ./${repo_root}/emacs/emacs.doom/packages.el;
|
||||
onChange = "~/.emacs.d/bin/doom sync";
|
||||
};
|
||||
"erdtree/.erdtreerc".source = ./${repo_root}/erdtree/erdtreerc;
|
||||
"kitty/kitty.conf".source = ./${repo_root}/kitty/kitty.conf;
|
||||
"lsd/config.yaml".source = ./${repo_root}/lsd/config.yaml;
|
||||
"ov/config.yaml".source = ./${repo_root}/ov/ov-less.yaml;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -13,10 +13,12 @@
|
|||
in {
|
||||
imports = [
|
||||
./git.nix
|
||||
./mise.nix
|
||||
./neovim.nix
|
||||
./ssh.nix
|
||||
./starship.nix
|
||||
./zellij.nix
|
||||
./ssh.nix
|
||||
./zsh.nix
|
||||
];
|
||||
home.packages = with pkgs;
|
||||
[
|
||||
|
|
25
nix/home-manager/modules/packages/mise.nix
Normal file
25
nix/home-manager/modules/packages/mise.nix
Normal file
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
programs.mise = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
globalConfig = {
|
||||
tools = {
|
||||
node = "lts";
|
||||
python = "latest";
|
||||
ruby = "latest";
|
||||
};
|
||||
settings = {
|
||||
status = {
|
||||
missing_tools = "always";
|
||||
};
|
||||
python_compile = true;
|
||||
python_default_packages_file = "$HOME/.dotfiles/defaults/default-packages";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -6,6 +6,7 @@
|
|||
}: {
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
settings = {
|
||||
aws = {
|
||||
symbol = " ";
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
}: {
|
||||
programs.zellij = {
|
||||
enable = true;
|
||||
# enableZshIntegration = true; # automatically sets up a session - I don't want this, I want manual control of my sessions
|
||||
};
|
||||
|
||||
home.file.".config/zellij/config.kdl".source = ../../../../zellij/config.kdl;
|
||||
|
|
48
nix/home-manager/modules/packages/zsh.nix
Normal file
48
nix/home-manager/modules/packages/zsh.nix
Normal file
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (pkgs.stdenv.hostPlatform) isDarwin isLinux;
|
||||
in {
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
initExtraFirst = ''
|
||||
autoload -Uz up-line-or-beginning-search down-line-or-beginning-search zmv colors add-zle-hook-widget
|
||||
zle -N up-line-or-beginning-search
|
||||
zle -N down-line-or-beginning-search
|
||||
'';
|
||||
initExtra = builtins.readFile ../../../../zsh/zshrc;
|
||||
# antidote = {
|
||||
# enable = true;
|
||||
# plugins = [
|
||||
# "zdharma-continuum/fast-syntax-highlighting"
|
||||
# "zsh-users/zsh-completions"
|
||||
# "b4b4r07/zsh-vimode-visual"
|
||||
# "ohmyzsh/oh-my-zsh"
|
||||
# ];
|
||||
# useFriendlyNames = true;
|
||||
# };
|
||||
dirHashes = {
|
||||
"-- -dotfiles" = "$HOME/.dotfiles";
|
||||
"-- -src" = "$HOME/src";
|
||||
"-- -doom" = "$HOME/.emacs.d";
|
||||
};
|
||||
sessionVariables = {
|
||||
COMPLETION_WAITING_DOTS = true;
|
||||
VISUAL = "nvim";
|
||||
EDITOR = "nvim";
|
||||
RPROMPT = "' '"; # Fixes a side-effect of the vi-mode oh-my-zsh plugin
|
||||
KEYTIMEOUT = 1;
|
||||
};
|
||||
shellAliases =
|
||||
if isLinux
|
||||
then {
|
||||
cp = "cp --reflink=auto";
|
||||
}
|
||||
else {
|
||||
exa = "eza -l --git";
|
||||
};
|
||||
};
|
||||
}
|
11
zsh/funcs/ls
11
zsh/funcs/ls
|
@ -1,11 +0,0 @@
|
|||
function ls {
|
||||
if [[ "${LS_PICKER}" == "lsd" ]]; then
|
||||
lsd $@
|
||||
elif [[ "${LS_PICKER}" == "exa" ]]; then
|
||||
exa $@
|
||||
elif [[ "${LS_PICKER}" == "eza" ]]; then
|
||||
eza $@
|
||||
else
|
||||
/bin/ls $@
|
||||
fi
|
||||
}
|
87
zsh/zshrc
87
zsh/zshrc
|
@ -14,12 +14,6 @@ bindkey -v
|
|||
# allow ctrl-a and ctrl-e to move to beginning/end of line
|
||||
bindkey '^a' beginning-of-line
|
||||
bindkey '^e' end-of-line
|
||||
export RPROMPT=' ' # Fixes a side-effect of the vi-mode oh-my-zsh plugin
|
||||
|
||||
export KEYTIMEOUT=1
|
||||
|
||||
typeset -U path
|
||||
typeset -U fpath
|
||||
|
||||
if [[ $(uname) == 'Darwin' ]]; then
|
||||
if [[ $(arch) == 'arm64' ]]; then
|
||||
|
@ -29,10 +23,6 @@ if [[ $(uname) == 'Darwin' ]]; then
|
|||
fi
|
||||
fi
|
||||
|
||||
hash -d -- -dotfiles=~/.dotfiles
|
||||
hash -d -- -src=~/src
|
||||
hash -d -- -doom=~/.doom-emacs
|
||||
|
||||
fpath=(~/bin ~/.zshcompletions $fpath)
|
||||
zstyle :compinstall filename '/home/anthonys/.zshrc'
|
||||
zstyle ":completion:*" complete _complete _ignored _approximate _expand
|
||||
|
@ -43,20 +33,9 @@ zstyle ':completion:*' rehash true
|
|||
zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'l:|=* r:|=*'
|
||||
zstyle ":completion:*" substitute 1
|
||||
|
||||
autoload -Uz up-line-or-beginning-search down-line-or-beginning-search zmv colors
|
||||
zle -N up-line-or-beginning-search
|
||||
zle -N down-line-or-beginning-search
|
||||
|
||||
[[ -n "$key[Up]" ]] && bindkey -- "$key[Up]" up-line-or-beginning-search
|
||||
[[ -n "$key[Down]" ]] && bindkey -- "$key[Down]" down-line-or-beginning-search
|
||||
|
||||
_command-exists() {
|
||||
[[ -x "$(command -v $1)" ]] && return 0 || return 1
|
||||
}
|
||||
|
||||
export COMPLETION_WAITING_DOTS="true"
|
||||
export VISUAL='nvim'
|
||||
export EDITOR='nvim'
|
||||
path=("$HOME/bin" "$HOME/go/bin" $path)
|
||||
|
||||
local ZSH_PLUGIN_DIR="$HOME/.zsh_plugins"
|
||||
|
@ -65,7 +44,6 @@ zstyle ':znap:*' auto-compile no
|
|||
zstyle ':znap:*:*' git-maintenance off
|
||||
autoload -Uz add-zle-hook-widget
|
||||
|
||||
local ZSH_PLUGIN_DIR="$HOME/.zsh_plugins"
|
||||
if [[ ! -d "${ZSH_PLUGIN_DIR}/zsh-snap" ]]; then
|
||||
mkdir -p ~/.zsh_plugins
|
||||
cd ~/.zsh_plugins
|
||||
|
@ -82,7 +60,7 @@ for line in "${(@f)"$(<~/.zsh_plugins.txt)"}"
|
|||
}
|
||||
|
||||
if [[ ! ${#paths[@]} -eq 0 ]]; then
|
||||
echo "Paths not empty: $paths"
|
||||
echo "Paths not empty: $paths"
|
||||
znap clone ${^paths}
|
||||
fi
|
||||
|
||||
|
@ -99,27 +77,8 @@ if [[ -d ~/.cargo/bin ]]; then
|
|||
path=($path $HOME/.cargo/bin)
|
||||
fi
|
||||
|
||||
if (_command-exists starship); then
|
||||
znap eval starship 'starship init zsh --print-full-init'
|
||||
znap prompt
|
||||
else
|
||||
if [[ ( $ZNAP_USED = 1 ) ]]; then
|
||||
autoload -Uz promptinit
|
||||
promptinit
|
||||
znap clone https://github.com/denysdovhan/spaceship-prompt
|
||||
znap prompt spaceship-prompt
|
||||
fi
|
||||
fi
|
||||
|
||||
autoload -Uz compinit
|
||||
compinit
|
||||
|
||||
znap source oh-my-zsh plugins/{gitignore,git,helm,mvn,gradle}
|
||||
|
||||
if [[ $(uname -s) =~ 'Linux' ]]; then
|
||||
alias cp="cp --reflink=auto"
|
||||
fi
|
||||
|
||||
function dt() {
|
||||
local session_name
|
||||
session_name=${1:-DefaultSession}
|
||||
|
@ -127,19 +86,10 @@ function dt() {
|
|||
if [[ "${SESSION_MANAGER}" == "tmux" ]]; then
|
||||
tmux -u -2 new-session -A -s $session_name
|
||||
else
|
||||
zellij attach -c $session_name
|
||||
zellij attach --session-serialization false -c $session_name
|
||||
fi
|
||||
}
|
||||
|
||||
function send-to-pane() {
|
||||
tmux pipe-pane -I -t $1 "$2 | head -n 1"
|
||||
}
|
||||
|
||||
function _send_to_pane {
|
||||
reply=($(tmux display-panes -b ''))
|
||||
}
|
||||
compctl -K _send_to_pane send-to-pane
|
||||
|
||||
function root() {
|
||||
if [[ -n $(git rev-parse --show-toplevel) ]]
|
||||
then
|
||||
|
@ -147,24 +97,6 @@ function root() {
|
|||
fi
|
||||
}
|
||||
|
||||
if [[ -d $HOME/.anyenv ]]; then
|
||||
path+=($HOME/.anyenv/bin)
|
||||
if [[ ( $ZNAP_USED = 1 ) ]]; then
|
||||
znap eval anyenv-init ${${:-=anyenv}:A}' init -'
|
||||
else
|
||||
eval "$(anyenv init -)"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if (_command-exists direnv); then
|
||||
eval "$(direnv hook zsh)"
|
||||
fi
|
||||
|
||||
##THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
|
||||
export SDKMAN_DIR="$HOME/.sdkman"
|
||||
[[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && znap eval sdkman-init "cat $HOME/.sdkman/bin/sdkman-init.sh # $SDKMAN_VERSION"
|
||||
|
||||
if [[ -a $HOME/.zshsrc ]]; then
|
||||
source $HOME/.zshsrc
|
||||
else
|
||||
|
@ -172,23 +104,8 @@ else
|
|||
touch $HOME/.zshsrc
|
||||
fi
|
||||
|
||||
LS_PICKER="eza"
|
||||
CTRL_R_PICKER="atuin"
|
||||
alias exa="eza -l --git"
|
||||
alias eza="eza -l --git"
|
||||
|
||||
for funcfile in $HOME/.zsh.d/* ; do
|
||||
source "${funcfile}"
|
||||
done
|
||||
|
||||
if [[ "${CTRL_R_PICKER}" == "mcfly" ]]; then
|
||||
znap eval mcfly 'mcfly init zsh'
|
||||
export MCFLY_KEY_SCHEME=vim
|
||||
export MCFLY_FUZZY=true
|
||||
export MCFLY_RESULTS=50
|
||||
export MCFLY_USED=1
|
||||
fi
|
||||
|
||||
if [[ "${CTRL_R_PICKER}" == "atuin" ]]; then
|
||||
znap eval atuin 'atuin init zsh'
|
||||
fi
|
||||
|
|
Loading…
Add table
Reference in a new issue