summary refs log tree commit diff stats
path: root/user/settings/fish
diff options
context:
space:
mode:
Diffstat (limited to 'user/settings/fish')
-rw-r--r--user/settings/fish/functions/dired.fish8
-rw-r--r--user/settings/fish/functions/magit.fish8
-rw-r--r--user/settings/fish/functions/newest.fish14
-rw-r--r--user/settings/fish/functions/oldest.fish14
4 files changed, 44 insertions, 0 deletions
diff --git a/user/settings/fish/functions/dired.fish b/user/settings/fish/functions/dired.fish
new file mode 100644
index 00000000..a59ffac2
--- /dev/null
+++ b/user/settings/fish/functions/dired.fish
@@ -0,0 +1,8 @@
+function dired
+    if set --query argv[1]
+        set --function repo $argv[1]
+    else
+        set --function repo $pwd
+    end
+    emacsclient --suppress-output --eval "(dired \"$argv[1]\")"
+end
diff --git a/user/settings/fish/functions/magit.fish b/user/settings/fish/functions/magit.fish
new file mode 100644
index 00000000..96c90096
--- /dev/null
+++ b/user/settings/fish/functions/magit.fish
@@ -0,0 +1,8 @@
+function magit
+    if set --query argv[1]
+        set --function repo $argv[1]
+    else
+        set --function repo $pwd
+    end
+    emacsclient --suppress-output --eval "(magit-status \"$argv[1]\")"
+end
diff --git a/user/settings/fish/functions/newest.fish b/user/settings/fish/functions/newest.fish
new file mode 100644
index 00000000..3f2fa66f
--- /dev/null
+++ b/user/settings/fish/functions/newest.fish
@@ -0,0 +1,14 @@
+function newest
+    if test (count $argv) -eq 0
+        echo "Need at least one path"
+        return 1
+    end
+    for arg in $argv
+        if test -d $arg
+            fd --hidden --print0 --max-depth 1 . $arg |
+                bfs -files0-from - \( -name .git -prune \) -o \( -printf '%TY%Tm%Td%TH%TM %TF %h/%f\n' \) |
+                sort --key 1nr,1 | head --lines 1 |
+                cut -d ' ' -f 2,3
+        end
+    end
+end
diff --git a/user/settings/fish/functions/oldest.fish b/user/settings/fish/functions/oldest.fish
new file mode 100644
index 00000000..140d74cc
--- /dev/null
+++ b/user/settings/fish/functions/oldest.fish
@@ -0,0 +1,14 @@
+function oldest
+    if test (count $argv) -eq 0
+        echo "Need at least one path"
+        return 1
+    end
+    for arg in $argv
+        if test -d $arg
+            fd --hidden --print0 --max-depth 1 . $arg |
+                bfs -files0-from - \( -name .git -prune \) -o \( -printf '%TY%Tm%Td%TH%TM %TF %h/%f\n' \) |
+                sort --key 1n,1 | head --lines 1 |
+                cut -d ' ' -f 2,3
+        end
+    end
+end