Add basic incomplete zsh configuration

This commit is contained in:
ItsDrike 2024-03-24 00:44:57 +01:00
parent 9c55c10e57
commit 5b2d36fcbf
Signed by: ItsDrike
GPG key ID: FA2745890B7048C0
5 changed files with 155 additions and 1 deletions

View file

@ -1,3 +1,5 @@
_: { _: {
imports = [ ]; imports = [
./shell
];
} }

View file

@ -0,0 +1,5 @@
_: {
imports = [
./zsh
];
}

View file

@ -0,0 +1,38 @@
{ config, ... }:
let
username = config.myOptions.system.username;
in
{
home-manager.users.${username} = {
programs.zsh.shellAliases = {
# I'm not the greatest typist
sl = "ls";
mdkir = "mkdir";
soruce = "source";
suod = "sudo";
sduo = "sudo";
# Directory changing
".." = "cd ..";
"..." = "cd ../../";
"...." = "cd ../../../";
"....." = "cd ../../../../";
".2" = "cd ../../";
".3" = "cd ../../../";
".4" = "cd ../../../../";
".5" = "cd ../../../../../";
# Files/Directories utilities
mkdir = "mkdir -p";
md = "mkdir";
fhere = "find . -name";
rr = "rm -r";
rf = "rm -f";
rrf = "rm -rf";
vimdiff = "nvim -d";
# Expand aliases from sudo
sudo = "sudo ";
};
};
}

View file

@ -0,0 +1,68 @@
{ config, pkgs, ... }:
let
username = config.myOptions.system.username;
hmCfg = config.home-manager.users.${username};
in
{
imports = [
./plugins.nix
./aliases.nix
];
programs.zsh.enable = true;
users.users.${username}.shell = pkgs.zsh;
home-manager.users.${username} = {
programs.zsh = {
enable = true;
dotDir = ".config/zsh";
enableCompletion = true;
enableAutosuggestions = true;
autocd = true;
history = {
# share history across different running zsh session
share = true;
# don't clutter $HOME
path = "${hmCfg.xdg.dataHome}/zsh/zsh_history";
# save timestamps to histfile
extended = true;
save = 120000;
size = 100000;
# If the internal history needs to be trimmed to add the current command line,
# this will cause the oldest history event that has a duplicate to be lost before
# losing a unique event from the list. You should set the value of history size
# to a larger number than the save size in order to give some room for the duplicated
# events, otherwise this option will behave just like ignoreDups once history fills
# up with unique events.
expireDuplicatesFirst = true;
# If a new command line being added to the history list duplicates an older one,
# the older command is removed from the list (even if it is not the previous event).
ignoreAllDups = true;
# Don't track command lines in the history list when the first character on the line
# is a space, or when one of the expanded aliases contains a leading space. Note that
# the command lingers in the internal session history until the next command is entered
# before it vanishes, allowing you to briefly reuse or edit the line.
ignoreSpace = true;
};
# dirhashes are easy aliases to commonly used directories
# allowing use like `cd ~dl`, going to $HOME/Downloads
dirHashes = {
dl = "$HOME/Downloads";
media = "$HOME/Media";
pics = "$HOME/Media/Pictures";
vids = "$HOME/Media/Videos";
mems = "$HOME/Media/Memes";
screenshots = "$HOME/Media/Pictures/Screenshots";
dots = "$HOME/dots";
};
};
};
}

View file

@ -0,0 +1,41 @@
{ config, pkgs, ... }:
let
username = config.myOptions.system.username;
inherit (pkgs) fetchFromGitHub;
in
{
home-manager.users.${username} = {
programs.zsh.plugins = [
{
name = "zsh-nix-shell";
src = pkgs.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";
}
{
name = "fast-syntax-highlighting";
src = "${pkgs.zsh-fast-syntax-highlighting}/share/zsh/site-functions";
}
{
name = "zsh-autosuggestions";
src = pkgs.zsh-autosuggestions;
file = "share/zsh-autosuggestions/zsh-autosuggestions.zsh";
}
{
name = "zsh-autopair";
file = "zsh-autopair.plugin.zsh";
src = fetchFromGitHub {
owner = "hlissner";
repo = "zsh-autopair";
rev = "2ec3fd3c9b950c01dbffbb2a4d191e1d34b8c58a";
hash = "sha256-Y7fkpvCOC/lC2CHYui+6vOdNO8dNHGrVYTGGNf9qgdg=";
};
}
];
};
}