markdown · 2782 bytes Raw Blame History

Fish Functions – Quick Reference

Drop these files in ~/.config/fish/functions/ (one function per file with the same basename).
Most commands expose -h/--help or print usage on bad args (by convention).


Workflow & Navigation

  • cdf — Fuzzy-jump into a directory (fzf picker), then cd there.
    Usage: cdf or cdf <pattern>

  • f — Fuzzy-find a file and open it in $EDITOR (or print path if no editor set).
    Usage: f or f <pattern>

  • open_at_line — Open a file at a specific line in your editor (e.g., nvim +{line} {file}).
    Usage: open_at_line <file> <line>

  • viewnotes — Launch your notes TUI layout (three panes: selector | renderer | preview).
    Usage: viewnotes
    Notes: Designed to wire up tmux + previewers; expects your note tree configured.


Git Helpers

  • glog — Pretty, condensed git log (graph, decorate, relative dates).
    Usage: glog [<path>] [-n <N>]

  • gb — Fuzzy switch/checkout git branches (create if !exists when you type a new name).
    Usage: gb


Search & Clipboard

  • rga — Wrapper around ripgrep-all for searching text, PDFs, media metadata, etc.
    Usage: rga <pattern> [path]

  • clipf — Copy file contents (or stdin) to the clipboard (wl-copy/xclip fallback).
    Usage: clipf [file] (no args → read stdin)


Packages & System

  • packin — “Search → choose → install” helper for Arch (paru/pacman under the hood).
    Usage: packin <pkg|pattern>

  • sysrs — Restart a system service (via sudo systemctl restart).
    Usage: sysrs <service>

  • sysru — Restart a user service (systemctl --user restart).
    Usage: sysru <service>


Processes & Ports

  • fkill — Fuzzy-pick a process and kill it (smart SIGTERM→SIGKILL escalation).
    Usage: fkill or fkill <pattern>

  • fport — Show what’s bound to a port; optionally kill it.
    Usage: fport <port>


  • hardlink_all — Hard-link every regular file from a source dir into a dest dir (same filesystem only).
    Usage: hardlink_all <src_dir> <dst_dir>
    Notes: Requires source and destination on the same filesystem; skips non-regular files.

SSH

  • sshf — Fuzzy-select and SSH into a host from your ~/.ssh/config (or known_hosts).
    Usage: sshf

Internals & Keybinds

  • _fzf — Shared fzf defaults (preview, keybinds, colors).
    Usage: (internal; sourced by other functions)

  • fish_user_key_bindings — Centralized keybindings (sets up fzf bindings, extras).
    Usage: (auto-loaded by fish; not called directly)


View source
1 # Fish Functions – Quick Reference
2
3 Drop these files in `~/.config/fish/functions/` (one function per file with the same basename).
4 Most commands expose `-h/--help` or print usage on bad args (by convention).
5
6 ---
7
8 ## Workflow & Navigation
9
10 - **`cdf`** — Fuzzy-jump into a directory (fzf picker), then `cd` there.
11 **Usage:** `cdf` or `cdf <pattern>`
12
13 - **`f`** — Fuzzy-find a file and open it in `$EDITOR` (or print path if no editor set).
14 **Usage:** `f` or `f <pattern>`
15
16 - **`open_at_line`** — Open a file at a specific line in your editor (e.g., `nvim +{line} {file}`).
17 **Usage:** `open_at_line <file> <line>`
18
19 - **`viewnotes`** — Launch your notes TUI layout (three panes: selector | renderer | preview).
20 **Usage:** `viewnotes`
21 *Notes:* Designed to wire up tmux + previewers; expects your note tree configured.
22
23 ---
24
25 ## Git Helpers
26
27 - **`glog`** — Pretty, condensed `git log` (graph, decorate, relative dates).
28 **Usage:** `glog [<path>] [-n <N>]`
29
30 - **`gb`** — Fuzzy switch/checkout git branches (create if `!exists` when you type a new name).
31 **Usage:** `gb`
32
33 ---
34
35 ## Search & Clipboard
36
37 - **`rga`** — Wrapper around ripgrep-all for searching text, PDFs, media metadata, etc.
38 **Usage:** `rga <pattern> [path]`
39
40 - **`clipf`** — Copy file contents (or stdin) to the clipboard (`wl-copy`/`xclip` fallback).
41 **Usage:** `clipf [file]` (no args → read stdin)
42
43 ---
44
45 ## Packages & System
46
47 - **`packin`** — “Search → choose → install” helper for Arch (paru/pacman under the hood).
48 **Usage:** `packin <pkg|pattern>`
49
50 - **`sysrs`** — Restart a *system* service (via `sudo systemctl restart`).
51 **Usage:** `sysrs <service>`
52
53 - **`sysru`** — Restart a *user* service (`systemctl --user restart`).
54 **Usage:** `sysru <service>`
55
56 ---
57
58 ## Processes & Ports
59
60 - **`fkill`** — Fuzzy-pick a process and kill it (smart SIGTERM→SIGKILL escalation).
61 **Usage:** `fkill` or `fkill <pattern>`
62
63 - **`fport`** — Show what’s bound to a port; optionally kill it.
64 **Usage:** `fport <port>`
65
66 ---
67
68 ## Files & Links
69
70 - **`hardlink_all`** — Hard-link every regular file from a source dir into a dest dir (same filesystem only).
71 **Usage:** `hardlink_all <src_dir> <dst_dir>`
72 *Notes:* Requires source and destination on the same filesystem; skips non-regular files.
73
74 ---
75
76 ## SSH
77
78 - **`sshf`** — Fuzzy-select and SSH into a host from your `~/.ssh/config` (or known_hosts).
79 **Usage:** `sshf`
80
81 ---
82
83 ## Internals & Keybinds
84
85 - **`_fzf`** — Shared fzf defaults (preview, keybinds, colors).
86 **Usage:** *(internal; sourced by other functions)*
87
88 - **`fish_user_key_bindings`** — Centralized keybindings (sets up fzf bindings, extras).
89 **Usage:** *(auto-loaded by fish; not called directly)*
90
91 ---