Add mark_prompt_start function for fish
It is for something foot uses, see https://codeberg.org/dnkl/foot/wiki#user-content-jumping-between-prompts for more info
This commit is contained in:
parent
eec99400a3
commit
8ab255b66a
2 changed files with 17 additions and 11 deletions
|
@ -14,7 +14,7 @@ in
|
|||
config = mkIf cfg.enable {
|
||||
programs.fish = {
|
||||
enable = true;
|
||||
functions = import ./functions.nix { inherit (pkgs) git; };
|
||||
functions = import ./functions.nix { inherit (pkgs) git coreutils; };
|
||||
|
||||
plugins = [
|
||||
{
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
{ git }: {
|
||||
{ git, coreutils }: {
|
||||
mark_prompt_start = {
|
||||
onEvent = "fish_prompt";
|
||||
body = ''
|
||||
${coreutils}/bin/echo -en "\e]133;A\e\\"
|
||||
'';
|
||||
};
|
||||
reload = {
|
||||
body = ''
|
||||
history --save
|
||||
|
@ -22,19 +28,19 @@
|
|||
set files (${git}/bin/git diff --diff-filter=ACMR --name-only $argv[1])
|
||||
set repo_path (realpath --relative-to=$PWD (${git}/bin/git rev-parse --show-toplevel))
|
||||
set clangformat (${git}/bin/git config --get clangFormat.binary)
|
||||
echo "Formatting files in $repo_path with $clangformat"
|
||||
${coreutils}/bin/echo "Formatting files in $repo_path with $clangformat"
|
||||
|
||||
for f in $files
|
||||
set file (realpath $repo_path/$f)
|
||||
echo "Processing $file"
|
||||
${coreutils}/bin/echo "Processing $file"
|
||||
|
||||
set ext (string match -r ".*\.([^\.]+)\$" $file)[2]
|
||||
|
||||
if contains $ext $source_exts
|
||||
echo "Formatting $file"
|
||||
${coreutils}/bin/echo "Formatting $file"
|
||||
$clangformat -i -style=file $file
|
||||
else
|
||||
echo "Extension $ext not found in $source_exts"
|
||||
${coreutils}/bin/echo "Extension $ext not found in $source_exts"
|
||||
end
|
||||
end
|
||||
'';
|
||||
|
@ -49,17 +55,17 @@
|
|||
set libmajor $libname.$libcomponents[3]
|
||||
|
||||
if test -f $libname -o -L $libname
|
||||
echo "$libname already exists"
|
||||
${coreutils}/bin/echo "$libname already exists"
|
||||
return 1
|
||||
end
|
||||
|
||||
if test -f $libmajor -o -L $libmajor
|
||||
echo "$libmajor already exists"
|
||||
${coreutils}/bin/echo "$libmajor already exists"
|
||||
return 2
|
||||
end
|
||||
|
||||
ln -s $lib $libmajor
|
||||
ln -s $libmajor $libname
|
||||
${coreutils}/bin/ln -s $lib $libmajor
|
||||
${coreutils}/bin/ln -s $libmajor $libname
|
||||
end
|
||||
'';
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue