Skip to content

Instantly share code, notes, and snippets.

@dmikushin
Created September 30, 2025 14:21
Show Gist options
  • Save dmikushin/973136b2cc5f4cffc1f332242ede7205 to your computer and use it in GitHub Desktop.
Save dmikushin/973136b2cc5f4cffc1f332242ede7205 to your computer and use it in GitHub Desktop.
Fish shell configuration to disable git prompt on SSHFS and other network filesystems for better performance
# Disable git prompt for SSHFS and other network filesystems in Fish shell
# This overrides both standard __fish_git_prompt and Tide's _tide_item_git
# to check filesystem type first and skip git operations on slow filesystems
#
# Installation:
# Place this file in ~/.config/fish/conf.d/sshfs_git_disable.fish
#
# How it works:
# 1. Detects filesystem type using df -T
# 2. Skips git operations for SSHFS, NFS, CIFS, SMB, and rclone mounts
# 3. Works with both vanilla Fish and Tide prompt
# 4. Optionally can exclude specific paths
#
# Author: Dmitry Mikushin (@dmikushin)
if status is-interactive
# Save the original git prompt function if it exists
if functions -q __fish_git_prompt
functions -c __fish_git_prompt __original_fish_git_prompt
end
# Override the git prompt function
function __fish_git_prompt --description 'Conditional git prompt that skips SSHFS'
# Check filesystem type
set -l mount_type (df -T . 2>/dev/null | tail -1 | awk '{print $2}')
# Skip git operations on network filesystems
if contains -- $mount_type fuse.sshfs sshfs nfs cifs smb fuse.rclone
# Return empty string for network filesystems
return
end
# Also check for specific slow paths (optional - customize as needed)
set -l slow_paths \
/mnt/sshfs \
/mnt/nfs
for path in $slow_paths
if string match -q "$path*" $PWD
# Return empty string for slow paths
return
end
end
# Call the original git prompt for local filesystems
if functions -q __original_fish_git_prompt
__original_fish_git_prompt $argv
end
end
# For Tide prompt users - disable git module in certain directories
if functions -q _tide_item_git
functions -c _tide_item_git __original_tide_item_git
function _tide_item_git
# Check filesystem type
set -l mount_type (df -T . 2>/dev/null | tail -1 | awk '{print $2}')
# Skip git for network filesystems
if contains -- $mount_type fuse.sshfs sshfs nfs cifs smb fuse.rclone
return
end
# Check for slow paths (optional - customize as needed)
set -l slow_paths \
/mnt/sshfs \
/mnt/nfs
for path in $slow_paths
if string match -q "$path*" $PWD
return
end
end
# Call original tide git function
__original_tide_item_git $argv
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment