home / skills / trentshaines / dotfiles / fish

fish skill

/dot_claude/skills/fish

This skill helps you manage fish shell configuration, aliases, and functions to streamline workflow and shell customization.

npx playbooks add skill trentshaines/dotfiles --skill fish

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
4.2 KB
---
name: fish
description: Help with fish shell configuration, aliases, functions, and keybindings. Use when the user asks about shell config, aliases, or when modifying shell behavior. IMPORTANT - Trent uses fish as his primary shell, not zsh.
---

# Fish Shell Skill

## Overview

**Fish is Trent's primary shell.** Always add aliases and functions to fish config, not zsh.

## Configuration Locations

- **Main config**: `~/.config/fish/config.fish`
- **Functions**: `~/.config/fish/functions/*.fish` (one function per file)
- **Local overrides**: `~/.config/fish/conf.d/local.fish`
- **Secrets (not tracked)**: `~/.config/fish/secrets.fish`
- **Completions**: `~/.config/fish/completions/*.fish`

## Config Structure

The main `config.fish` is organized into sections:

1. **Core Shell Setup** - Homebrew, environment variables, PATH
2. **Essential Tools** - starship, zoxide, fzf, nvm
3. **Aliases** - All aliases in one place
4. **Vi Mode** - Fish vi mode with cursor shape changes
5. **Auto-start** - Creates "home" tmux session on startup

## Key Aliases

```fish
# Shell
alias ef='nvim ~/.config/fish/config.fish'
alias elf='nvim ~/.config/fish/conf.d/local.fish'

# Claude
alias cc='claude'
alias ccr='claude --resume'
alias ccd='claude --dangerously-skip-permissions'

# Modern CLI tools
alias cat='bat'
alias ls='eza'
alias ll='eza -l'
alias la='eza -la'
alias tree='eza --tree'
alias v='nvim'

# Chezmoi
alias cadd='chezmoi re-add'
alias capply='chezmoi apply'

# Tmux
alias ta='tmux attach -t'
alias tn='tmux new -s'
alias tls='tmux ls'
alias tk='tmux kill-session -t'

# Git
alias gc='git commit -m'
alias gca='git add . && git commit -a -m'
alias gp='git push origin HEAD'
alias gpu='git pull origin'
alias gst='git status'
alias ghpr='gh pr create -f --draft && gh pr view --web'

# Python
alias python='python3'
alias pip='pip3'
alias cvenv='python3 -m venv .venv'
alias svenv='source .venv/bin/activate'
alias ur='uv run'

# SSH
alias mm='ssh -L 3000:localhost:3000 -L 8000:localhost:8000 [email protected]'
```

## Key Functions (in ~/.config/fish/functions/)

- `t.fish` - Smart tmux attach/create
- `ts.fish` - Tmux session selector with fzf
- `tns.fish` - Create new tmux session with git project
- `tnw.fish` - Create new tmux window with 3-pane layout
- `cf.fish` - Change directory with fzf
- `vf.fish` - Open file in nvim with fzf
- `rgf.fish` - Ripgrep with fzf
- `glog.fish` - Git log with fzf
- `gs.fish` - Git status
- `otp.fish` - OTP code generator

## Vi Mode

Fish is configured with vi mode:

```fish
fish_vi_key_bindings

# Cursor shapes
set -g fish_cursor_default block      # Normal mode
set -g fish_cursor_insert line        # Insert mode
set -g fish_cursor_replace_one underscore
set -g fish_cursor_visual block

# Key bindings
bind -M default v edit_command_buffer  # Edit in nvim
bind -M insert \ce edit_command_buffer
```

## Adding New Aliases

Add to the Aliases section in `~/.config/fish/config.fish`:

```fish
alias name='command'
```

## Adding New Functions

Create a new file `~/.config/fish/functions/funcname.fish`:

```fish
function funcname --description "Description here"
    # function body
end
```

## Plugin Manager

Uses **fisher** for plugins:

```fish
fisher install jorgebucaran/nvm.fish  # Example
fisher list                            # List installed
fisher update                          # Update all
```

Current plugins:
- `nvm.fish` - Node version manager
- `bass` - Run bash scripts in fish

## Integration with Other Tools

- **Starship** - Prompt (init in config.fish)
- **Zoxide** - Smart cd (init in config.fish)
- **fzf** - Fuzzy finder (init in config.fish)
- **Tmux** - Auto-creates "home" session on startup
- **Pyenv** - Python version manager (shims in PATH)

## Common Tasks

### Reload config
```fish
source ~/.config/fish/config.fish
# or just open new terminal
```

### Edit config
```fish
ef   # Opens config.fish in nvim
elf  # Opens local.fish in nvim
```

### Add to PATH
```fish
set -gx PATH "/new/path" $PATH
# or
fish_add_path /new/path
```

### Set environment variable
```fish
set -gx VAR_NAME "value"
```

## Notes

- Fish syntax differs from bash/zsh - no `export`, use `set -gx`
- Command substitution: `(command)` not `$(command)`
- No need to quote variables in most cases
- Functions auto-load from functions/ directory

Overview

This skill helps configure and extend the fish shell for daily use, focusing on aliases, functions, keybindings, and integrations. It assumes fish is the primary shell and directs changes to fish configuration files and function directories. The content emphasizes practical, repeatable steps for editing, reloading, and organizing fish configuration.

How this skill works

It inspects and edits the primary fish files: ~/.config/fish/config.fish for global settings and sections, ~/.config/fish/functions/*.fish for one-function-per-file organization, and ~/.config/fish/conf.d/local.fish for local overrides. It shows how to add aliases and functions, configure vi mode and cursor shapes, manage plugins with fisher, and wire integrations like starship, zoxide, fzf, tmux, and pyenv. It also explains common commands for reloading and environment management.

When to use it

  • When adding or changing aliases or functions for daily workflows.
  • When modifying shell behavior like keybindings, vi mode, or cursor shapes.
  • When installing or updating fish plugins via fisher.
  • When integrating starship, fzf, zoxide, tmux, or language shims into fish.
  • When moving configuration from bash/zsh to fish or organizing config files.

Best practices

  • Keep aliases in the Aliases section of ~/.config/fish/config.fish for a single source of truth.
  • Store each reusable function in its own file under ~/.config/fish/functions/ so fish auto-loads it.
  • Put machine-specific changes in ~/.config/fish/conf.d/local.fish to avoid committing secrets.
  • Use set -gx for environment variables and fish_add_path or set PATH for PATH changes.
  • Use fisher for plugin management and run fisher update periodically.

Example use cases

  • Add an alias: alias ll='eza -l' by editing the Aliases section in config.fish.
  • Create a project-aware tmux session function by adding ~/.config/fish/functions/tns.fish.
  • Enable vi keybindings and set cursor shapes with fish_vi_key_bindings and set -g fish_cursor_*.
  • Install nvm plugin: fisher install jorgebucaran/nvm.fish and initialize it in config.fish.
  • Quickly reload configuration after edits with: source ~/.config/fish/config.fish.

FAQ

Where should I add a new function?

Create a file named ~/.config/fish/functions/funcname.fish with function funcname ... end. Fish will auto-load it.

How do I persist environment variables and PATH?

Use set -gx VAR value for env vars and fish_add_path or set -gx PATH "/new/path" $PATH for PATH changes in config.fish.

How do I reload my fish config after changes?

Run source ~/.config/fish/config.fish or open a new terminal session.