Skip to content

Instantly share code, notes, and snippets.

@edgarogh
Created June 5, 2025 14:36
Show Gist options
  • Select an option

  • Save edgarogh/ab94d995e74ea174771746ae0d228599 to your computer and use it in GitHub Desktop.

Select an option

Save edgarogh/ab94d995e74ea174771746ae0d228599 to your computer and use it in GitHub Desktop.
Custom default CD directory (I'm using this with IntelliJ to cd to the content root)
--- /usr/share/fish/functions/cd.fish 2024-01-01 10:15:17.000000000 -0500
+++ /home/edgar/.config/fish/functions/cd.fish 2025-06-05 10:32:20.670430570 -0400
@@ -4,6 +4,11 @@
function cd --description "Change directory"
set -l MAX_DIR_HIST 25
+ if test (count $argv) = 0 -a -n "$CD_HOME"
+ builtin cd $CD_HOME
+ return 0
+ end
+
if test (count $argv) -gt (test "$argv[1]" = "--" && echo 2 || echo 1)
printf "%s\n" (_ "Too many args for cd command") >&2
return 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment