summary refs log tree commit diff stats
path: root/user/settings/fish/functions
diff options
context:
space:
mode:
authorAlan Pearce2023-08-20 06:52:48 +0200
committerAlan Pearce2023-08-20 06:52:48 +0200
commita1e7e0bc3e2cf040d24580ecfe3f73899b358aa1 (patch)
tree5bd05f75c23c3d1e069849c2e8f858acfbb90883 /user/settings/fish/functions
parenta0c89188898a79599f83a83297946631fb78bf9b (diff)
downloadnixfiles-a1e7e0bc3e2cf040d24580ecfe3f73899b358aa1.tar.lz
nixfiles-a1e7e0bc3e2cf040d24580ecfe3f73899b358aa1.tar.zst
nixfiles-a1e7e0bc3e2cf040d24580ecfe3f73899b358aa1.zip
fish: port functions and more aliases
Diffstat (limited to 'user/settings/fish/functions')
-rw-r--r--user/settings/fish/functions/delink.fish10
-rw-r--r--user/settings/fish/functions/ecpenv.fish3
-rwxr-xr-xuser/settings/fish/functions/esetenv.fish3
-rw-r--r--user/settings/fish/functions/field.fish3
-rw-r--r--user/settings/fish/functions/help.fish3
-rw-r--r--user/settings/fish/functions/tere.fish6
6 files changed, 28 insertions, 0 deletions
diff --git a/user/settings/fish/functions/delink.fish b/user/settings/fish/functions/delink.fish
new file mode 100644
index 00000000..ff7ff64b
--- /dev/null
+++ b/user/settings/fish/functions/delink.fish
@@ -0,0 +1,10 @@
+function delink
+    if test ! -L $argv[1]
+        echo "$argv[1] is not a symlink"
+        return 1
+    end
+    set -l src (readlink $argv[1])
+    rm $argv[1]
+    cp $src $argv[1]
+    chmod u+w $argv[1]
+end
diff --git a/user/settings/fish/functions/ecpenv.fish b/user/settings/fish/functions/ecpenv.fish
new file mode 100644
index 00000000..68d6051b
--- /dev/null
+++ b/user/settings/fish/functions/ecpenv.fish
@@ -0,0 +1,3 @@
+function ecpenv
+  esetenv $argv[1] $$argv[1]
+end
diff --git a/user/settings/fish/functions/esetenv.fish b/user/settings/fish/functions/esetenv.fish
new file mode 100755
index 00000000..17357925
--- /dev/null
+++ b/user/settings/fish/functions/esetenv.fish
@@ -0,0 +1,3 @@
+function esetenv
+  emacsclient -e "(setenv \"$argv[1]\" \"$argv[2]\")"
+end
diff --git a/user/settings/fish/functions/field.fish b/user/settings/fish/functions/field.fish
new file mode 100644
index 00000000..96e17bd2
--- /dev/null
+++ b/user/settings/fish/functions/field.fish
@@ -0,0 +1,3 @@
+function field
+    awk "{ print \$$argv[1]}"
+end
diff --git a/user/settings/fish/functions/help.fish b/user/settings/fish/functions/help.fish
new file mode 100644
index 00000000..e649f43e
--- /dev/null
+++ b/user/settings/fish/functions/help.fish
@@ -0,0 +1,3 @@
+function help
+    $argv --help 2>&1 | bat --plan --language=help
+end
diff --git a/user/settings/fish/functions/tere.fish b/user/settings/fish/functions/tere.fish
new file mode 100644
index 00000000..ba5816f9
--- /dev/null
+++ b/user/settings/fish/functions/tere.fish
@@ -0,0 +1,6 @@
+function tere
+    set -f result $(command tere $argv)
+    if test -n $result
+        cd $result
+    end
+end