splits out configuration into central modules
This commit is contained in:
parent
58ffb417dd
commit
b44654b9a2
63 changed files with 20 additions and 20 deletions
78
modules/fish/default.nix
Normal file
78
modules/fish/default.nix
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
{
|
||||
programs.fish = {
|
||||
enable = true;
|
||||
|
||||
functions = {
|
||||
ff = ''
|
||||
set RG_PREFIX "rg --column --line-number --no-heading --color=always --smart-case "
|
||||
set INITIAL_QUERY "$argv"
|
||||
fzf --ansi --disabled --query "$INITIAL_QUERY" \
|
||||
--bind "start:reload:$RG_PREFIX {q}" \
|
||||
--bind "change:reload:sleep 0.1; $RG_PREFIX {q} || true" \
|
||||
--delimiter : \
|
||||
--preview 'bat --color=always {1} --highlight-line {2}' \
|
||||
--preview-window 'up,60%,border-bottom,+{2}+3/3,~3' \
|
||||
--bind 'enter:become(nvim {1} +{2})'
|
||||
'';
|
||||
envsource = ''
|
||||
for line in (cat $argv | grep -v '^#')
|
||||
set item (string split -m 1 '=' $line)
|
||||
set -gx $item[1] $item[2]
|
||||
end
|
||||
'';
|
||||
fish_greeting = "fortune -a";
|
||||
resize_images = ''
|
||||
# Resize all JPG images in the current directory and its subdirectories
|
||||
# Usage: resize_images [percentage]
|
||||
# Example: resize_images 20 - resizes all images to 20% of original size
|
||||
# If no percentage is provided, defaults to 40%
|
||||
|
||||
set -l percentage $argv[1]
|
||||
if test -z "$percentage"
|
||||
set percentage 40
|
||||
end
|
||||
|
||||
for img in (find . -type f -name "*.JPG")
|
||||
set original_size (stat -f %z "$img")
|
||||
magick convert "$img" -resize "$percentage%" "$img"
|
||||
set new_size (stat -f %z "$img")
|
||||
echo "Processed $img"
|
||||
echo "Original size: $original_size bytes"
|
||||
echo "New size: $new_size bytes"
|
||||
echo "---"
|
||||
end
|
||||
'';
|
||||
localip = "ifconfig | grep \"inet \" | grep -v 127.0.0.1 | awk '{print $2}' | head -n 1";
|
||||
publicip = "curl -4 ifconfig.me";
|
||||
};
|
||||
|
||||
interactiveShellInit = ''
|
||||
fish_config theme choose "Rosé Pine"
|
||||
|
||||
set hn (prompt_hostname)
|
||||
set fish_cursor_default block blink
|
||||
set fish_cursor_insert line blink
|
||||
set fish_cursor_replace_one underscore blink
|
||||
set fish_cursor_visual block
|
||||
set fish_vi_force_cursor 1
|
||||
fish_vi_key_bindings
|
||||
|
||||
fish_add_path /run/current-system/sw/bin
|
||||
fish_add_path /opt/homebrew/bin
|
||||
|
||||
envsource ~/.env
|
||||
|
||||
zoxide init fish | source
|
||||
fnm env --use-on-cd --shell fish | source
|
||||
'';
|
||||
|
||||
shellAbbrs = {
|
||||
lg = "lazygit";
|
||||
g = "git";
|
||||
frc = "source ~/.config/fish/**/*.fish";
|
||||
t = "todo.sh";
|
||||
};
|
||||
};
|
||||
|
||||
home.file.".config/fish/themes".source = ./themes;
|
||||
}
|
||||
41
modules/fish/themes/Rosé Pine Dawn.theme
Normal file
41
modules/fish/themes/Rosé Pine Dawn.theme
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
# syntax highlighting variables
|
||||
# https://fishshell.com/docs/current/interactive.html#syntax-highlighting-variables
|
||||
fish_color_normal 575279
|
||||
fish_color_command 907aa9
|
||||
fish_color_keyword 56949f
|
||||
fish_color_quote ea9d34
|
||||
fish_color_redirection 286983
|
||||
fish_color_end 797593
|
||||
fish_color_error b4637a
|
||||
fish_color_param d7827e
|
||||
fish_color_comment 797593
|
||||
# fish_color_match --background=brblue
|
||||
fish_color_selection --reverse
|
||||
# fish_color_history_current --bold
|
||||
fish_color_operator 575279
|
||||
fish_color_escape 286983
|
||||
fish_color_autosuggestion 797593
|
||||
fish_color_cwd d7827e
|
||||
# fish_color_cwd_root red
|
||||
fish_color_user ea9d34
|
||||
fish_color_host 56949f
|
||||
fish_color_host_remote 907aa9
|
||||
fish_color_cancel 575279
|
||||
fish_color_search_match --background=faf4ed
|
||||
fish_color_valid_path
|
||||
|
||||
# pager color variables
|
||||
# https://fishshell.com/docs/current/interactive.html#pager-color-variables
|
||||
fish_pager_color_progress d7827e
|
||||
fish_pager_color_background --background=fffaf3
|
||||
fish_pager_color_prefix 56949f
|
||||
fish_pager_color_completion 797593
|
||||
fish_pager_color_description 797593
|
||||
fish_pager_color_secondary_background
|
||||
fish_pager_color_secondary_prefix
|
||||
fish_pager_color_secondary_completion
|
||||
fish_pager_color_secondary_description
|
||||
fish_pager_color_selected_background --background=f2e9e1
|
||||
fish_pager_color_selected_prefix 56949f
|
||||
fish_pager_color_selected_completion 575279
|
||||
fish_pager_color_selected_description 575279
|
||||
41
modules/fish/themes/Rosé Pine Moon.theme
Normal file
41
modules/fish/themes/Rosé Pine Moon.theme
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
# syntax highlighting variables
|
||||
# https://fishshell.com/docs/current/interactive.html#syntax-highlighting-variables
|
||||
fish_color_normal e0def4
|
||||
fish_color_command c4a7e7
|
||||
fish_color_keyword 9ccfd8
|
||||
fish_color_quote f6c177
|
||||
fish_color_redirection 3e8fb0
|
||||
fish_color_end 908caa
|
||||
fish_color_error eb6f92
|
||||
fish_color_param ea9a97
|
||||
fish_color_comment 908caa
|
||||
# fish_color_match --background=brblue
|
||||
fish_color_selection --reverse
|
||||
# fish_color_history_current --bold
|
||||
fish_color_operator e0def4
|
||||
fish_color_escape 3e8fb0
|
||||
fish_color_autosuggestion 908caa
|
||||
fish_color_cwd ea9a97
|
||||
# fish_color_cwd_root red
|
||||
fish_color_user f6c177
|
||||
fish_color_host 9ccfd8
|
||||
fish_color_host_remote c4a7e7
|
||||
fish_color_cancel e0def4
|
||||
fish_color_search_match --background=232136
|
||||
fish_color_valid_path
|
||||
|
||||
# pager color variables
|
||||
# https://fishshell.com/docs/current/interactive.html#pager-color-variables
|
||||
fish_pager_color_progress ea9a97
|
||||
fish_pager_color_background --background=2a273f
|
||||
fish_pager_color_prefix 9ccfd8
|
||||
fish_pager_color_completion 908caa
|
||||
fish_pager_color_description 908caa
|
||||
fish_pager_color_secondary_background
|
||||
fish_pager_color_secondary_prefix
|
||||
fish_pager_color_secondary_completion
|
||||
fish_pager_color_secondary_description
|
||||
fish_pager_color_selected_background --background=393552
|
||||
fish_pager_color_selected_prefix 9ccfd8
|
||||
fish_pager_color_selected_completion e0def4
|
||||
fish_pager_color_selected_description e0def4
|
||||
41
modules/fish/themes/Rosé Pine.theme
Normal file
41
modules/fish/themes/Rosé Pine.theme
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
# syntax highlighting variables
|
||||
# https://fishshell.com/docs/current/interactive.html#syntax-highlighting-variables
|
||||
fish_color_normal e0def4
|
||||
fish_color_command c4a7e7
|
||||
fish_color_keyword 9ccfd8
|
||||
fish_color_quote f6c177
|
||||
fish_color_redirection 31748f
|
||||
fish_color_end 908caa
|
||||
fish_color_error eb6f92
|
||||
fish_color_param ebbcba
|
||||
fish_color_comment 908caa
|
||||
# fish_color_match --background=brblue
|
||||
fish_color_selection --reverse
|
||||
# fish_color_history_current --bold
|
||||
fish_color_operator e0def4
|
||||
fish_color_escape 31748f
|
||||
fish_color_autosuggestion 908caa
|
||||
fish_color_cwd ebbcba
|
||||
# fish_color_cwd_root red
|
||||
fish_color_user f6c177
|
||||
fish_color_host 9ccfd8
|
||||
fish_color_host_remote c4a7e7
|
||||
fish_color_cancel e0def4
|
||||
fish_color_search_match --background=191724
|
||||
fish_color_valid_path
|
||||
|
||||
# pager color variables
|
||||
# https://fishshell.com/docs/current/interactive.html#pager-color-variables
|
||||
fish_pager_color_progress ebbcba
|
||||
fish_pager_color_background --background=1f1d2e
|
||||
fish_pager_color_prefix 9ccfd8
|
||||
fish_pager_color_completion 908caa
|
||||
fish_pager_color_description 908caa
|
||||
fish_pager_color_secondary_background
|
||||
fish_pager_color_secondary_prefix
|
||||
fish_pager_color_secondary_completion
|
||||
fish_pager_color_secondary_description
|
||||
fish_pager_color_selected_background --background=26233a
|
||||
fish_pager_color_selected_prefix 9ccfd8
|
||||
fish_pager_color_selected_completion e0def4
|
||||
fish_pager_color_selected_description e0def4
|
||||
145
modules/fish/work.nix
Normal file
145
modules/fish/work.nix
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{ programs.fish = {
|
||||
enable = true;
|
||||
|
||||
functions = {
|
||||
cdr = ''
|
||||
set folder (begin
|
||||
fd . ~/dev/ride/apps/backend/edge-services -t d -d 1;
|
||||
fd . ~/dev/ride/apps/backend/backend-services -t d -d 1;
|
||||
fd . ~/dev/ride/apps/frontend/projects -t d -d 1;
|
||||
fd . ~/dev/ride/apps/native -t d -d 1;
|
||||
# fd . ~/dev/ride/packages -t d -d 1;
|
||||
echo "$HOME/dev/ride/apps/frontend";
|
||||
echo "$HOME/dev/ride/apps/lib";
|
||||
echo "$HOME/dev/ride";
|
||||
end | fzf);
|
||||
set service (basename $folder)
|
||||
|
||||
cd $folder
|
||||
'';
|
||||
rr = ''
|
||||
set folder (begin
|
||||
fd . ~/dev/ride/apps/backend/edge-services -t d -d 1;
|
||||
fd . ~/dev/ride/apps/backend/backend-services -t d -d 1;
|
||||
fd . ~/dev/ride/apps/frontend/projects -t d -d 1;
|
||||
fd . ~/dev/ride/apps/native -t d -d 1;
|
||||
echo "$HOME/dev/ride/apps/frontend";
|
||||
echo "$HOME/dev/ride/apps/lib";
|
||||
echo "$HOME/dev/ride";
|
||||
end | fzf);
|
||||
|
||||
if test -n "$folder"
|
||||
set service (basename $folder)
|
||||
cd $folder
|
||||
|
||||
# Check if package.json exists
|
||||
if test -f "package.json"
|
||||
# Extract and format npm scripts for fzf
|
||||
set script_cmd (jq -r '.scripts | to_entries | .[] | "\(.key): \(.value)"' package.json | fzf)
|
||||
|
||||
if test -n "$script_cmd"
|
||||
# Extract just the script name before the colon
|
||||
set script_name (string split ": " $script_cmd)[1]
|
||||
if test -n "$script_name"
|
||||
echo "Running: npm run $script_name"
|
||||
npm run $script_name
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
'';
|
||||
ff = ''
|
||||
set RG_PREFIX "rg --column --line-number --no-heading --color=always --smart-case "
|
||||
set INITIAL_QUERY "$argv"
|
||||
fzf --ansi --disabled --query "$INITIAL_QUERY" \
|
||||
--bind "start:reload:$RG_PREFIX {q}" \
|
||||
--bind "change:reload:sleep 0.1; $RG_PREFIX {q} || true" \
|
||||
--delimiter : \
|
||||
--preview 'bat --color=always {1} --highlight-line {2}' \
|
||||
--preview-window 'up,60%,border-bottom,+{2}+3/3,~3' \
|
||||
--bind 'enter:become(nvim {1} +{2})'
|
||||
'';
|
||||
envsource = ''
|
||||
for line in (cat $argv | grep -v '^#')
|
||||
set item (string split -m 1 '=' $line)
|
||||
set -gx $item[1] $item[2]
|
||||
end
|
||||
'';
|
||||
fish_greeting = "fortune -a";
|
||||
resize_images = ''
|
||||
# Resize all JPG images in the current directory and its subdirectories
|
||||
# Usage: resize_images [percentage]
|
||||
# Example: resize_images 20 - resizes all images to 20% of original size
|
||||
# If no percentage is provided, defaults to 40%
|
||||
|
||||
set -l percentage $argv[1]
|
||||
if test -z "$percentage"
|
||||
set percentage 40
|
||||
end
|
||||
|
||||
for img in (find . -type f -name "*.JPG")
|
||||
set original_size (stat -f %z "$img")
|
||||
magick convert "$img" -resize "$percentage%" "$img"
|
||||
set new_size (stat -f %z "$img")
|
||||
echo "Processed $img"
|
||||
echo "Original size: $original_size bytes"
|
||||
echo "New size: $new_size bytes"
|
||||
echo "---"
|
||||
end
|
||||
'';
|
||||
localip = "ifconfig | grep \"inet \" | grep -v 127.0.0.1 | awk '{print $2}' | head -n 1";
|
||||
publicip = "curl -4 ifconfig.me";
|
||||
fzf = ''
|
||||
set -Ux FZF_DEFAULT_OPTS "
|
||||
--color=fg:#908caa,bg:#191724,hl:#ebbcba
|
||||
--color=fg+:#e0def4,bg+:#26233a,hl+:#ebbcba
|
||||
--color=border:#403d52,header:#31748f,gutter:#191724
|
||||
--color=spinner:#f6c177,info:#9ccfd8
|
||||
--color=pointer:#c4a7e7,marker:#eb6f92,prompt:#908caa"
|
||||
|
||||
command fzf
|
||||
'';
|
||||
};
|
||||
|
||||
interactiveShellInit = ''
|
||||
fish_config theme choose "Rosé Pine"
|
||||
|
||||
set hn (prompt_hostname)
|
||||
set fish_cursor_default block blink
|
||||
set fish_cursor_insert line blink
|
||||
set fish_cursor_replace_one underscore blink
|
||||
set fish_cursor_visual block
|
||||
set fish_vi_force_cursor 1
|
||||
fish_vi_key_bindings
|
||||
|
||||
fish_add_path /run/current-system/sw/bin
|
||||
fish_add_path /opt/homebrew/bin
|
||||
fish_add_path $ANDROID_HOME/emulator
|
||||
fish_add_path $ANDROID_HOME/platform-tools
|
||||
fish_add_path $HOME/.config/fish/plugins
|
||||
|
||||
envsource ~/.env
|
||||
|
||||
zoxide init fish | source
|
||||
fnm env --use-on-cd --shell fish | source
|
||||
rbenv init - | source
|
||||
'';
|
||||
|
||||
shellAbbrs = {
|
||||
lg = "lazygit";
|
||||
g = "git";
|
||||
gco = "git checkout";
|
||||
frc = "source ~/.config/fish/**/*.fish";
|
||||
t = "todo.sh";
|
||||
p = "pnpm";
|
||||
pa = "pnpm add";
|
||||
pad = "pnpm add -D";
|
||||
pi = "pnpm install";
|
||||
px = "pnpm dlx";
|
||||
};
|
||||
};
|
||||
|
||||
home.file.".config/fish/themes".source = ./themes;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue