mirror of
https://github.com/ItsDrike/nixdots
synced 2024-12-25 16:54:35 +00:00
Add basic incomplete zsh configuration
This commit is contained in:
parent
9c55c10e57
commit
5b2d36fcbf
|
@ -1,3 +1,5 @@
|
|||
_: {
|
||||
imports = [ ];
|
||||
imports = [
|
||||
./shell
|
||||
];
|
||||
}
|
||||
|
|
5
home/programs/terminal/shell/default.nix
Normal file
5
home/programs/terminal/shell/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
_: {
|
||||
imports = [
|
||||
./zsh
|
||||
];
|
||||
}
|
38
home/programs/terminal/shell/zsh/aliases.nix
Normal file
38
home/programs/terminal/shell/zsh/aliases.nix
Normal 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 ";
|
||||
};
|
||||
};
|
||||
}
|
68
home/programs/terminal/shell/zsh/default.nix
Normal file
68
home/programs/terminal/shell/zsh/default.nix
Normal 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";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
41
home/programs/terminal/shell/zsh/plugins.nix
Normal file
41
home/programs/terminal/shell/zsh/plugins.nix
Normal 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=";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue