Read the non-trivial fish snippets from files
Move the interactiveShellInit block and the copy function body into modules/fish/*.fish and pull them in with builtins.readFile, so the non-trivial fish lives in real fish files (highlighting, fish_indent) instead of inline Nix strings. The Auto-loader only collects .nix, so the new .fish files are ignored by it. Rendered config is unchanged.
This commit is contained in:
@@ -111,44 +111,11 @@ in
|
|||||||
|
|
||||||
copy = {
|
copy = {
|
||||||
description = "Copy a file, or recursively copy a source directory into a destination";
|
description = "Copy a file, or recursively copy a source directory into a destination";
|
||||||
body = ''
|
body = builtins.readFile ./fish/copy.fish;
|
||||||
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
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
interactiveShellInit = ''
|
interactiveShellInit = builtins.readFile ./fish/interactive-init.fish;
|
||||||
# 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
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
8
modules/fish/copy.fish
Normal file
8
modules/fish/copy.fish
Normal file
@@ -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
|
||||||
23
modules/fish/interactive-init.fish
Normal file
23
modules/fish/interactive-init.fish
Normal file
@@ -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
|
||||||
Reference in New Issue
Block a user