mirror of
https://github.com/anotherhadi/nixy.git
synced 2026-08-21 18:55:47 +02:00
Waybar here i come (#58)
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
# Import all shell configurations
|
||||
{
|
||||
imports = [
|
||||
./fzf.nix
|
||||
./zsh.nix
|
||||
./starship.nix
|
||||
./zoxide.nix
|
||||
./eza.nix
|
||||
./direnv.nix
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
nix-direnv = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
# Eza is a ls replacement
|
||||
{
|
||||
programs.zsh.initContent = ''
|
||||
compdef eza=ls
|
||||
'';
|
||||
programs.eza = {
|
||||
enable = true;
|
||||
icons = "auto";
|
||||
|
||||
extraOptions = [
|
||||
"--group-directories-first"
|
||||
"--no-quotes"
|
||||
"--icons=always"
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
# Fzf is a general-purpose command-line fuzzy finder.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
accent = "#" + config.lib.stylix.colors.base0D;
|
||||
foreground = "#" + config.lib.stylix.colors.base05;
|
||||
muted = "#" + config.lib.stylix.colors.base03;
|
||||
previewCmd = "bat --color=always --style=plain,numbers --line-range=:500 {}";
|
||||
in {
|
||||
programs.fzf = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
|
||||
defaultCommand = "fd --type f --hidden --strip-cwd-prefix";
|
||||
fileWidgetCommand = "fd --type f --hidden --strip-cwd-prefix";
|
||||
fileWidgetOptions = ["--preview '${previewCmd}'"];
|
||||
|
||||
colors = lib.mkForce {
|
||||
"fg+" = accent;
|
||||
"bg+" = "-1";
|
||||
"fg" = foreground;
|
||||
"bg" = "-1";
|
||||
"prompt" = muted;
|
||||
"pointer" = accent;
|
||||
};
|
||||
|
||||
defaultOptions = [
|
||||
"--height=60%"
|
||||
"--layout=reverse"
|
||||
"--border=none"
|
||||
"--prompt='/ '"
|
||||
"--preview-window=right:65%:wrap:border-left"
|
||||
"-i"
|
||||
"--no-bold"
|
||||
];
|
||||
};
|
||||
|
||||
programs.zsh.initContent = lib.mkAfter ''
|
||||
_fzf_file_no_hidden() {
|
||||
local cmd result
|
||||
cmd="''${FZF_DEFAULT_COMMAND/--hidden /}"
|
||||
result=$(eval "''${cmd:-find . -type f}" | fzf --preview "${previewCmd}") \
|
||||
&& LBUFFER+="$result"
|
||||
zle reset-prompt
|
||||
}
|
||||
zle -N _fzf_file_no_hidden
|
||||
'';
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
# starship is a minimal, fast, and extremely customizable prompt for any shell!
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
accent = "#${config.lib.stylix.colors.base0D}";
|
||||
background-alt = "#${config.lib.stylix.colors.base01}";
|
||||
in {
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
settings = {
|
||||
add_newline = true;
|
||||
format = lib.concatStrings [
|
||||
"$nix_shell"
|
||||
"$hostname"
|
||||
"$directory"
|
||||
"$git_branch"
|
||||
"$git_state"
|
||||
"$git_status"
|
||||
"$character"
|
||||
];
|
||||
directory = {
|
||||
style = accent;
|
||||
};
|
||||
|
||||
character = {
|
||||
success_symbol = "[❯](${accent})";
|
||||
error_symbol = "[❯](red)";
|
||||
vimcmd_symbol = "[❮](cyan)";
|
||||
};
|
||||
|
||||
nix_shell = {
|
||||
format = "[$symbol]($style) ";
|
||||
symbol = "🐚";
|
||||
style = "";
|
||||
};
|
||||
|
||||
git_branch = {
|
||||
symbol = "[](${background-alt}) ";
|
||||
style = "fg:${accent} bg:${background-alt}";
|
||||
format = "on [$symbol$branch]($style)[](${background-alt}) ";
|
||||
};
|
||||
|
||||
git_status = {
|
||||
format = "[[(*$conflicted$untracked$modified$staged$renamed$deleted)](218)($ahead_behind$stashed)]($style)";
|
||||
style = "cyan";
|
||||
conflicted = "";
|
||||
renamed = "";
|
||||
deleted = "";
|
||||
stashed = "≡";
|
||||
};
|
||||
|
||||
git_state = {
|
||||
format = "([$state( $progress_current/$progress_total)]($style)) ";
|
||||
style = "bright-black";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
# Zoxide is a cd replacement
|
||||
{
|
||||
programs.zoxide = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
# My shell configuration
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: {
|
||||
home.packages = with pkgs; [
|
||||
bat
|
||||
ripgrep
|
||||
];
|
||||
|
||||
home = {
|
||||
sessionPath = ["$HOME/go/bin"];
|
||||
sessionVariables = {
|
||||
COLORTERM = "truecolor";
|
||||
MANPAGER = "bat -l man -p";
|
||||
};
|
||||
};
|
||||
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
autocd = true;
|
||||
enableCompletion = true;
|
||||
autosuggestion.enable = true;
|
||||
syntaxHighlighting.enable = true;
|
||||
historySubstringSearch.enable = true;
|
||||
|
||||
plugins = [
|
||||
{
|
||||
name = "zsh-vi-mode";
|
||||
src = pkgs.zsh-vi-mode;
|
||||
file = "share/zsh-vi-mode/zsh-vi-mode.plugin.zsh";
|
||||
}
|
||||
];
|
||||
|
||||
history = {
|
||||
ignoreDups = true;
|
||||
findNoDups = true;
|
||||
expireDuplicatesFirst = true;
|
||||
ignoreSpace = true;
|
||||
append = true;
|
||||
save = 10000;
|
||||
size = 10000;
|
||||
};
|
||||
|
||||
setOptions = [
|
||||
"NOBEEP"
|
||||
"AUTOCD"
|
||||
"NUMERIC_GLOB_SORT"
|
||||
];
|
||||
|
||||
profileExtra = lib.optionalString (config.home.sessionPath != []) ''
|
||||
export PATH="$PATH''${PATH:+:}${lib.concatStringsSep ":" config.home.sessionPath}"
|
||||
'';
|
||||
|
||||
shellAliases = {
|
||||
# Change default
|
||||
vim = "nvim";
|
||||
vi = "nvim";
|
||||
cd = "z";
|
||||
ls = "eza --icons=always --no-quotes";
|
||||
tree = "eza --icons=always --tree --no-quotes";
|
||||
cat = "bat --theme=base16 --color=always --paging=never --tabs=2 --wrap=never --plain";
|
||||
mkdir = "mkdir -p";
|
||||
nix-shell = "nix-shell --command zsh";
|
||||
grep = "rg --color=auto";
|
||||
diff = "diff --color=auto";
|
||||
df = "df -h";
|
||||
|
||||
# Shortcuts
|
||||
spt = "spotatui";
|
||||
open = "${pkgs.xdg-utils}/bin/xdg-open";
|
||||
|
||||
notes = "nvim ~/notes/index.md --cmd 'cd ~/notes' -c ':lua Snacks.picker.smart()'";
|
||||
|
||||
# git
|
||||
g = "lazygit";
|
||||
ga = "git add";
|
||||
gc = "git commit";
|
||||
gp = "git push";
|
||||
gpl = "git pull";
|
||||
gs = "git status";
|
||||
gd = "git diff";
|
||||
gco = "git checkout";
|
||||
gcb = "git checkout -b";
|
||||
gbr = "git branch";
|
||||
grs = "git reset HEAD~1";
|
||||
grh = "git reset --hard HEAD~1";
|
||||
gaa = "git add .";
|
||||
gcm = "git commit -m";
|
||||
|
||||
# Original binaries
|
||||
ocat = "/run/current-system/sw/bin/cat";
|
||||
ols = "/run/current-system/sw/bin/ls";
|
||||
ocd = "builtin cd";
|
||||
|
||||
# Typo
|
||||
clera = "clear";
|
||||
celar = "clear";
|
||||
claer = "clear";
|
||||
sl = "ls";
|
||||
};
|
||||
|
||||
initContent = lib.mkMerge [
|
||||
(lib.mkOrder 550 ''
|
||||
function zvm_config() {
|
||||
ZVM_INSERT_MODE_CURSOR=$ZVM_CURSOR_BEAM
|
||||
ZVM_NORMAL_MODE_CURSOR=$ZVM_CURSOR_BLOCK
|
||||
ZVM_VISUAL_MODE_CURSOR=$ZVM_CURSOR_BLOCK
|
||||
|
||||
ZVM_VI_HIGHLIGHT_BACKGROUND=none
|
||||
ZVM_VI_HIGHLIGHT_FOREGROUND=none
|
||||
ZVM_VI_HIGHLIGHT_EXTRASTYLE=none
|
||||
}
|
||||
'')
|
||||
# bash
|
||||
''
|
||||
# Suffix Aliases
|
||||
alias -s {nix,md,txt,yml,yaml,go}=nvim
|
||||
alias -s {json,jsonl}=jless
|
||||
alias -s {csv,tsv,parquet,pqt,arrow,db,sqlite,xls,xlsx,xlsm,xlsb,fwf}=tw
|
||||
alias -s {png,jpg,jpeg,gif,pdf}=xdg-open
|
||||
|
||||
# Global Aliases
|
||||
alias -g G="| rg"
|
||||
alias -g L="| less"
|
||||
alias -g V="| nvim"
|
||||
alias -g H="| head"
|
||||
alias -g T="| tail"
|
||||
alias -g JQ="| jq"
|
||||
alias -g C="| wl-copy"
|
||||
alias -g NE="2>/dev/null"
|
||||
alias -g ND=">/dev/null"
|
||||
alias -g NUL=">/dev/null 2>&1"
|
||||
|
||||
autoload zmv # Mv for multiple files
|
||||
|
||||
zstyle ':completion:*' menu select
|
||||
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
|
||||
|
||||
zvm_after_init() {
|
||||
bindkey '^[[1;5C' forward-word
|
||||
bindkey '^[[1;5D' backward-word
|
||||
bindkey '^F' _fzf_file_no_hidden
|
||||
bindkey '^[[A' history-substring-search-up
|
||||
bindkey '^[[B' history-substring-search-down
|
||||
}
|
||||
''
|
||||
];
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user