diff --git a/modules/fish.nix b/modules/fish.nix index f651254..3b546b8 100644 --- a/modules/fish.nix +++ b/modules/fish.nix @@ -111,44 +111,11 @@ in copy = { description = "Copy a file, or recursively copy a source directory into a destination"; - body = '' - set count (count $argv | tr -d \n) - if test "$count" = 2; and test -d "$argv[1]" - set from (echo $argv[1] | trim-right /) - set to (echo $argv[2]) - command cp -r $from $to - else - command cp $argv - end - ''; + body = builtins.readFile ./fish/copy.fish; }; }; - interactiveShellInit = '' - # vi-style modal editing on the command line. - set -g fish_key_bindings fish_vi_key_bindings - - set -gx EDITOR nvim - set -gx VISUAL nvim - - # Render man pages through bat. - set -x MANROFFOPT "-c" - set -x MANPAGER "sh -c 'col -bx | bat -l man -p'" - - # Tune the done plugin: only notify for commands past 10s, at low urgency. - set -g __done_min_cmd_duration 10000 - set -g __done_notification_urgency_level low - - # Prepend ~/.local/bin to PATH when it exists. - if test -d ~/.local/bin - fish_add_path ~/.local/bin - end - - # Apply fish-compatible profile overrides if present. - if test -f ~/.fish_profile - source ~/.fish_profile - end - ''; + interactiveShellInit = builtins.readFile ./fish/interactive-init.fish; }; }; }; diff --git a/modules/fish/copy.fish b/modules/fish/copy.fish new file mode 100644 index 0000000..15b17a4 --- /dev/null +++ b/modules/fish/copy.fish @@ -0,0 +1,8 @@ +set count (count $argv | tr -d \n) +if test "$count" = 2; and test -d "$argv[1]" + set from (echo $argv[1] | trim-right /) + set to (echo $argv[2]) + command cp -r $from $to +else + command cp $argv +end diff --git a/modules/fish/interactive-init.fish b/modules/fish/interactive-init.fish new file mode 100644 index 0000000..08d8b9e --- /dev/null +++ b/modules/fish/interactive-init.fish @@ -0,0 +1,23 @@ +# vi-style modal editing on the command line. +set -g fish_key_bindings fish_vi_key_bindings + +set -gx EDITOR nvim +set -gx VISUAL nvim + +# Render man pages through bat. +set -x MANROFFOPT "-c" +set -x MANPAGER "sh -c 'col -bx | bat -l man -p'" + +# Tune the done plugin: only notify for commands past 10s, at low urgency. +set -g __done_min_cmd_duration 10000 +set -g __done_notification_urgency_level low + +# Prepend ~/.local/bin to PATH when it exists. +if test -d ~/.local/bin + fish_add_path ~/.local/bin +end + +# Apply fish-compatible profile overrides if present. +if test -f ~/.fish_profile + source ~/.fish_profile +end