Skip to content

feat!: remove oh-my-zsh git & clipboard plugins, add opinionated git aliases + custom clipboard integration#11

Merged
0xdilshan merged 12 commits into
mainfrom
dev
Feb 27, 2026
Merged

feat!: remove oh-my-zsh git & clipboard plugins, add opinionated git aliases + custom clipboard integration#11
0xdilshan merged 12 commits into
mainfrom
dev

Conversation

@0xdilshan

@0xdilshan 0xdilshan commented Feb 27, 2026

Copy link
Copy Markdown
Owner

Summary

This PR removes the git and clipboard plugins from oh-my-zsh (previously loaded via zinit) and replaces them with:

  • A small, opinionated set of built-in Git aliases for common workflows
  • A custom clipboard integration function implemented directly in .zshrc

The goal is to reduce plugin surface area, improve startup time and make behavior explicit and self-contained.


⚠️ Breaking Changes

Users who relied on aliases from the oh-my-zsh git plugin may notice missing functionality.

If you depended on specific plugin features, you can:

  • Re-enable the plugins via zinit, or
  • Add your own aliases/functions in ~/.zshrc.local (persistent customization file)

Improved clip Command

clip now supports clean stdin/stdout chaining and composable workflows.

Copying to clipboard

# Copy a string directly
echo "This is now in my clipboard" | clip

# Copy file contents
cat ~/.ssh/id_rsa.pub | clip

# Copy command output
ls -la | clip

Pasting from clipboard

# Paste directly to terminal
clip

# Paste into a file
clip > pasted_data.txt

# Pipe clipboard into another command
clip | grep "error"

Advanced chaining

# Lowercase clipboard content and copy back
clip | tr 'A-Z' 'a-z' | clip

# Format JSON in clipboard and copy back
clip | jq . | clip

Why

  • Avoid large implicit alias surfaces
  • Reduce dependency on upstream plugin behavior
  • Provide more predictable Git workflows
  • Offer a more powerful & composable clipboard workflow
  • Encourage explicit user customization via .zshrc.local

Summary by CodeRabbit

  • New Features

    • Cross-platform clipboard tools (pbcopy/pbpaste/clip), _edit helper and quick-edit wrappers (sconf, zconf, reload)
    • Expanded Git shortcuts including gopen to open remotes in a browser
    • New disk-usage and maintenance aliases
  • Documentation

    • README: clipboard usage examples, update guide (zsu), updated startup badge/asciinema and benchmark numbers
  • Improvements

    • Reordered completion and FZF integration; updated completion styling and scroll bindings

@coderabbitai

coderabbitai Bot commented Feb 27, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@0xdilshan has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 4 minutes and 21 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between c1e6ef7 and 39a6bae.

📒 Files selected for processing (2)
  • .zshrc
  • README.md
📝 Walkthrough

Walkthrough

Removes OMZ clipboard/git plugin loads; adds a cross-platform clipboard shim and clip helper; reorganizes FZF/zoxide/completion/highlighting loading; introduces _edit, sconf, zconf, and gopen plus many Git shortcuts; adds aliases, zstyle/completion tweaks; updates README with badges, Update section, and clipboard examples.

Changes

Cohort / File(s) Summary
Shell Configuration
./.zshrc
Removed OMZ clipboard/git plugin loads; added cross-platform clipboard shim (pbcopy/pbpaste/clip) for macOS, Wayland, X11, WSL/Cygwin/MSYS/Windows with fallback; consolidated completion/highlighting loads (fzf-tab, fast-syntax-highlighting, zsh-autosuggestions); changed fzf/zoxide loading to light/atload with FZF_DEFAULT_COMMAND setup; added _edit, sconf, zconf, gopen functions and many Git shortcuts; added disk usage/maintenance aliases; updated zstyle/completion styling and scroll bindings.
Documentation
README.md
Updated startup badge and metric text/numbers (interactive prompt time and command lag), replaced asciinema embed link, added "Update" section with zsu example, and inserted a collapsible "clip command usage examples" block under Plugin Ecosystem.

Sequence Diagram(s)

sequenceDiagram
  participant User as "User / Shell"
  participant Git as "Git (remote)"
  participant Transformer as "URL transformer"
  participant Opener as "OS opener / Browser"

  User->>Git: git remote get-url
  Git-->>User: remote URL (ssh or https)
  User->>Transformer: convert SSH -> HTTPS if needed
  Transformer-->>User: HTTPS repo URL
  User->>Opener: open URL (xdg-open / open / start)
  Opener-->>User: browser opens repo page
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰
I nibble keys and patch the clip,
pbcopy hops aboard the ship.
Fzf and zoxide spin and twine,
gopen opens the repo fine.
Hooray — configs neat and spry! 🎋

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and comprehensively summarizes the main changes: removal of two plugins and introduction of custom implementations, which aligns with the substantial refactoring described in the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dev

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (2)
README.md (1)

107-113: Polish the update-section sentence for clarity.

Line 109 reads awkwardly; consider tightening it for readability.

✏️ Suggested wording
-You can easily update to latest .zshrc config using alias in the below.
+You can easily update to the latest `.zshrc` config using the alias below.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` around lines 107 - 113, Rewrite the awkward sentence in the Update
section to be clearer and more concise: replace "You can easily update to latest
.zshrc config using alias in the below." with a tighter phrasing that references
the alias zsu (for example: "Update your .zshrc to the latest config using the
zsu alias."). Update the README.md text around the "zsu" alias so the sentence
reads naturally and includes the alias name exactly as shown.
.zshrc (1)

181-185: Prefer $VISUAL/$EDITOR before hardcoded editor fallback.

This improves portability and user expectation for edit commands.

♻️ Suggested refactor
 _edit() {
-  local editor
-  editor=$(command -v nano 2>/dev/null || command -v vi)
+  local editor="${VISUAL:-${EDITOR:-}}"
+  if [[ -z "$editor" ]]; then
+    editor=$(command -v nano 2>/dev/null || command -v vi 2>/dev/null)
+  fi
+  [[ -z "$editor" ]] && { print -u2 "No editor found"; return 1; }
   "$editor" "$@"
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.zshrc around lines 181 - 185, The _edit function currently hardcodes a
fallback editor (nano/vi) before considering user preferences; update _edit to
prefer the VISUAL and EDITOR environment variables first (e.g., check $VISUAL
then $EDITOR and use command -v to resolve them), falling back to command -v
nano or command -v vi only if neither env var is set or resolvable; ensure the
chosen editor is executable and return a non-zero status or print a helpful
message if no editor is available.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.zshrc:
- Around line 227-236: The gopen function currently echoes "Could not open:
$url" but then returns success; update gopen so that when the attempt to open
the URL fails (after trying open and xdg-open) it prints the error and returns a
non-zero status (e.g., return 1) instead of allowing a successful exit code;
modify the final fallback branch that prints "Could not open: $url" in gopen to
emit the message to stderr and explicitly return non-zero so callers can detect
the failure.
- Around line 65-70: Replace the fragile A && B || C expression in the clip
function with an explicit conditional: change clip() { [[ -t 0 ]] && pbpaste ||
pbcopy } to an if/then/else block (if [[ -t 0 ]]; then pbpaste; else pbcopy; fi)
so pbcopy does not run when pbpaste fails; also ensure clip is always defined
even on unsupported systems by removing the early return and instead defining a
no-op clip() { return 0; } (or a stub that exits non‑zero) in the branch that
detects “no clipboard backend found”, so callers never see an undefined
function.

In `@README.md`:
- Line 31: The embedded asciinema image tag on the README (the <img> inside the
<a href="https://asciinema.org/a/lfoK4Wtcqwo6bJsK" ...>) is missing an alt
attribute; update that <img> element to include a descriptive alt="" value
(e.g., alt="Asciinema recording: demo of feature X") to satisfy
accessibility/MD045 and improve screen-reader support—make the change directly
in the README where the <img> is defined.

---

Nitpick comments:
In @.zshrc:
- Around line 181-185: The _edit function currently hardcodes a fallback editor
(nano/vi) before considering user preferences; update _edit to prefer the VISUAL
and EDITOR environment variables first (e.g., check $VISUAL then $EDITOR and use
command -v to resolve them), falling back to command -v nano or command -v vi
only if neither env var is set or resolvable; ensure the chosen editor is
executable and return a non-zero status or print a helpful message if no editor
is available.

In `@README.md`:
- Around line 107-113: Rewrite the awkward sentence in the Update section to be
clearer and more concise: replace "You can easily update to latest .zshrc config
using alias in the below." with a tighter phrasing that references the alias zsu
(for example: "Update your .zshrc to the latest config using the zsu alias.").
Update the README.md text around the "zsu" alias so the sentence reads naturally
and includes the alias name exactly as shown.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d23edc4 and 26631b0.

📒 Files selected for processing (3)
  • .zshrc
  • README.md
  • benchmark/z-shift-bench.webp

Comment thread .zshrc
Comment on lines +65 to +70
else
return 0 # No clipboard backend found; skip defining functions
fi

clip() { [[ -t 0 ]] && pbpaste || pbcopy }
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Fix clip control flow; current ternary pattern can misfire and block.

Line 69 uses A && B || C; if pbpaste fails, pbcopy runs unexpectedly. Also, Lines 65-67 leave clip undefined on unsupported systems.

🛠️ Suggested fix
   else
-    return 0  # No clipboard backend found; skip defining functions
+    clip() {
+      print -u2 "clip: no clipboard backend detected on this system"
+      return 127
+    }
+    return 0
   fi

-  clip() { [[ -t 0 ]] && pbpaste || pbcopy }
+  clip() {
+    if [[ -t 0 ]]; then
+      pbpaste
+    else
+      pbcopy
+    fi
+  }
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
else
return 0 # No clipboard backend found; skip defining functions
fi
clip() { [[ -t 0 ]] && pbpaste || pbcopy }
}
else
clip() {
print -u2 "clip: no clipboard backend detected on this system"
return 127
}
return 0
fi
clip() {
if [[ -t 0 ]]; then
pbpaste
else
pbcopy
fi
}
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.zshrc around lines 65 - 70, Replace the fragile A && B || C expression in
the clip function with an explicit conditional: change clip() { [[ -t 0 ]] &&
pbpaste || pbcopy } to an if/then/else block (if [[ -t 0 ]]; then pbpaste; else
pbcopy; fi) so pbcopy does not run when pbpaste fails; also ensure clip is
always defined even on unsupported systems by removing the early return and
instead defining a no-op clip() { return 0; } (or a stub that exits non‑zero) in
the branch that detects “no clipboard backend found”, so callers never see an
undefined function.

Comment thread .zshrc
Comment thread README.md Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (2)
.zshrc (2)

229-230: ⚠️ Potential issue | 🟡 Minor

gopen should return non-zero when openers fail.

Line 229 falls through to echo, which returns success and masks failure for callers.

🛠️ Proposed fix
-  open "$url" 2>/dev/null || xdg-open "$url" 2>/dev/null || echo "Could not open: $url"
+  if open "$url" 2>/dev/null || xdg-open "$url" 2>/dev/null; then
+    return 0
+  fi
+  echo "Could not open: $url" >&2
+  return 1
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.zshrc around lines 229 - 230, The gopen function currently falls through to
echo "Could not open: $url" which returns success and hides failure; modify
gopen so that after attempting open/xdg-open it returns a non-zero status on
failure (e.g., after the echo, make the function return a non-zero code) so
callers can detect the error; locate the open "$url" ... || xdg-open "$url" ||
echo "Could not open: $url" line and change the final fallback to both print the
message and return a non-zero status from gopen.

54-56: ⚠️ Potential issue | 🟠 Major

Always define clip in the no-backend branch.

Line 55 returns before clip() is declared, so on unsupported systems the clip command is missing instead of failing predictably.

🛠️ Proposed fix
   else
-    return 0
+    clip() {
+      print -u2 "clip: no clipboard backend detected on this system"
+      return 127
+    }
+    return 0
   fi
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.zshrc around lines 54 - 56, The else branch currently returns before the
clip() function is defined, causing unsupported systems to lack a predictable
clip command; modify the branch so clip() is declared regardless of backend
availability (e.g., define the fallback clip() implementation before the return
or remove the early return and place the return after declaring clip()),
ensuring the function name clip is always defined in the no-backend path.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.zshrc:
- Around line 175-179: The _edit() helper can call an empty/invalid command if
no editor is found; modify _edit so after setting editor="$(command -v nano
2>/dev/null || command -v vi)" it checks if editor is non-empty and executable,
and if not prints a clear error to stderr (e.g., using printf >&2) and returns a
non-zero status (return 1); otherwise proceed to invoke "$editor" "$@" so the
function never attempts to execute an empty command.

---

Duplicate comments:
In @.zshrc:
- Around line 229-230: The gopen function currently falls through to echo "Could
not open: $url" which returns success and hides failure; modify gopen so that
after attempting open/xdg-open it returns a non-zero status on failure (e.g.,
after the echo, make the function return a non-zero code) so callers can detect
the error; locate the open "$url" ... || xdg-open "$url" || echo "Could not
open: $url" line and change the final fallback to both print the message and
return a non-zero status from gopen.
- Around line 54-56: The else branch currently returns before the clip()
function is defined, causing unsupported systems to lack a predictable clip
command; modify the branch so clip() is declared regardless of backend
availability (e.g., define the fallback clip() implementation before the return
or remove the early return and place the return after declaring clip()),
ensuring the function name clip is always defined in the no-backend path.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 26631b0 and 85f9eab.

📒 Files selected for processing (1)
  • .zshrc

Comment thread .zshrc

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (3)
.zshrc (3)

229-230: ⚠️ Potential issue | 🟡 Minor

Send gopen failure message to stderr.

Line 229 now returns non-zero on failure (good), but the error still prints to stdout; that can break scripting expectations.

🔧 Proposed fix
-  open "$url" 2>/dev/null || xdg-open "$url" 2>/dev/null || { echo "Could not open: $url"; return 1; }
+  open "$url" 2>/dev/null || xdg-open "$url" 2>/dev/null || { echo "Could not open: $url" >&2; return 1; }
#!/bin/bash
# Verify gopen fallback output stream usage
rg -n -A6 -B2 '^gopen\(\)|Could not open:' .zshrc
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.zshrc around lines 229 - 230, The gopen function prints failure messages to
stdout; change the failure echo inside gopen (the line that currently says echo
"Could not open: $url") to write to stderr instead (use the shell redirection to
>&2) while keeping the non-zero return; update the fallback chain around
open/xdg-open in gopen so the error message goes to stderr and the function
still returns 1 on failure.

54-56: ⚠️ Potential issue | 🟠 Major

Define clip in fallback backend path to avoid an undefined command.

Line 55 returns before clip() is declared, so unsupported systems still end up without clip. This reintroduces the earlier behavior gap.

🔧 Proposed fix
   else
-    return 0
+    clip() {
+      print -u2 "clip: no clipboard backend detected on this system"
+      return 127
+    }
+    return 0
   fi
#!/bin/bash
# Verify fallback control flow relative to clip() declaration
rg -n -C4 'else|return 0|clip\(\)' .zshrc
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.zshrc around lines 54 - 56, The else branch currently returns before the
fallback clip() function is declared, leaving unsupported systems without clip;
move or add the clip() declaration into the else/fallback path (or remove the
early `return 0`) so that clip() is defined for systems that hit the fallback
branch—ensure the function named clip() (and any aliases to pbcopy/xclip) is
present inside that else block so unsupported backends still get a usable clip
implementation.

175-178: ⚠️ Potential issue | 🟡 Minor

Guard _edit when no editor is resolvable.

At Line 178, "$editor" can be empty and trigger a command-not-found path. Add an explicit non-empty check and fail clearly.

🔧 Proposed fix
 _edit() {
   local editor
-  editor=$(command -v nano 2>/dev/null || command -v vi)
+  editor="${VISUAL:-${EDITOR:-$(command -v nano 2>/dev/null || command -v vi)}}"
+  if [[ -z "$editor" ]]; then
+    print -u2 "_edit: no editor found (set \$VISUAL or \$EDITOR)"
+    return 127
+  fi
   "$editor" "$@"
 }
#!/bin/bash
# Verify whether _edit has an editor guard
rg -n -A8 -B2 '^_edit\(\)' .zshrc
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.zshrc around lines 175 - 178, The _edit function may call an empty
"$editor" when neither nano nor vi are found; update the _edit() implementation
to check that the local variable editor (set by editor=$(command -v nano
2>/dev/null || command -v vi)) is non-empty before invoking it, and if empty
emit a clear error (e.g., echo to stderr) and return/non-zero exit status;
ensure you reference and guard the variable named editor inside the _edit
function so the function fails cleanly when no editor is resolvable.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@README.md`:
- Around line 109-113: Reword the awkward sentence that reads "You can easily
update to latest .zshrc config using alias in the below." to a clearer
instruction that references the alias and .zshrc explicitly; for example,
replace it with a line like "Run the alias below to update to the latest .zshrc
config." Ensure the alias name `zsu` and the `.zshrc` filename remain mentioned
so readers know which command to run and which file is updated.

---

Duplicate comments:
In @.zshrc:
- Around line 229-230: The gopen function prints failure messages to stdout;
change the failure echo inside gopen (the line that currently says echo "Could
not open: $url") to write to stderr instead (use the shell redirection to >&2)
while keeping the non-zero return; update the fallback chain around
open/xdg-open in gopen so the error message goes to stderr and the function
still returns 1 on failure.
- Around line 54-56: The else branch currently returns before the fallback
clip() function is declared, leaving unsupported systems without clip; move or
add the clip() declaration into the else/fallback path (or remove the early
`return 0`) so that clip() is defined for systems that hit the fallback
branch—ensure the function named clip() (and any aliases to pbcopy/xclip) is
present inside that else block so unsupported backends still get a usable clip
implementation.
- Around line 175-178: The _edit function may call an empty "$editor" when
neither nano nor vi are found; update the _edit() implementation to check that
the local variable editor (set by editor=$(command -v nano 2>/dev/null ||
command -v vi)) is non-empty before invoking it, and if empty emit a clear error
(e.g., echo to stderr) and return/non-zero exit status; ensure you reference and
guard the variable named editor inside the _edit function so the function fails
cleanly when no editor is resolvable.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 85f9eab and c1e6ef7.

📒 Files selected for processing (2)
  • .zshrc
  • README.md

Comment thread README.md Outdated
@0xdilshan
0xdilshan merged commit 34fd2f9 into main Feb 27, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant