-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfish.fish
More file actions
33 lines (28 loc) · 1006 Bytes
/
Copy pathfish.fish
File metadata and controls
33 lines (28 loc) · 1006 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env fish
# proj shell integration for fish
# Source this file in your ~/.config/fish/config.fish
# Function to integrate proj with fish
function setup_proj_fish_integration
# Create proj function that handles directory changes
function proj
# Store the original directory
set original_dir (pwd)
# Run proj with all arguments
command proj $argv
# Check if a .proj_last_dir file exists (created by proj on directory change)
set proj_dir_file "$HOME/.config/proj/.proj_last_dir"
if read -l target_dir < "$proj_dir_file"
if test -d "$target_dir" -a "$target_dir" != "$original_dir"
echo "Changing to: $target_dir"
cd "$target_dir"
end
# Clean up the file
rm -f "$proj_dir_file"
end
end
echo "proj fish integration enabled"
end
# Auto-setup if sourced
if status --is-interactive
setup_proj_fish_integration
end