Skip to content

Zsh vi-mode plugin for instant man-page help β€” press Shift-K to open a command’s man page with the option under your cursor auto-searched. πŸ”

License

Notifications You must be signed in to change notification settings

TunaCuma/zsh-vi-man

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“– zsh-vi-man

Smart man page lookup for zsh vi mode

Press Shift-K on any command or option to instantly open its man page

License: MIT Zsh


zsh-vi-man demo

✨ Features

🎯 Smart Detection

Automatically finds the right man page for subcommands

git commit β†’ man git-commit
docker run β†’ man docker-run

πŸ” Option Jumping

Opens man page directly at the option definition

grep -r    β†’ jumps to -r entry
ls --color β†’ jumps to --color entry

πŸ”— Combined Options

Works with combined short options

rm -rf    β†’ finds both -r and -f
tar -xvf  β†’ finds -x, -v, -f

πŸ“ Value Extraction

Handles options with values

--color=always     β†’ searches --color
--output=file.txt  β†’ searches --output

πŸ”€ Pipe Support

Detects correct command in pipelines

cat file | grep -i  β†’ opens man grep
tree | less -N      β†’ opens man less

πŸ› οΈ Multiple Formats

Supports various man page styles

GNU: -R, -r, --recursive
jq:  --slurp / -s:
find: -name, -type, -exec

πŸ“¦ Installation

zinit
zinit light TunaCuma/zsh-vi-man
antidote

Add to your .zsh_plugins.txt:

TunaCuma/zsh-vi-man
oh-my-zsh
git clone https://github.com/TunaCuma/zsh-vi-man \
  ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-vi-man

Then add to your .zshrc:

plugins=(... zsh-vi-man)
Manual
git clone https://github.com/TunaCuma/zsh-vi-man ~/.zsh-vi-man
echo 'source ~/.zsh-vi-man/zsh-vi-man.plugin.zsh' >> ~/.zshrc

πŸš€ Usage

  1. Type a command (e.g., ls -la or git commit --amend)
  2. Press Escape to enter vi normal mode
  3. Move cursor to any word
  4. Press K to open the man page

Examples

Command Cursor On Result
ls -la ls Opens man ls
ls -la -la Opens man ls, jumps to -l
git commit --amend commit Opens man git-commit
grep --color=auto --color=auto Opens man grep, jumps to --color
cat file | sort -r -r Opens man sort, jumps to -r
find . -name "*.txt" -name Opens man find, jumps to -name

βš™οΈ Configuration

Set these variables before sourcing the plugin:

# Change the trigger key (default: K)
ZVM_MAN_KEY='?'

# Use a different pager (default: less)
ZVM_MAN_PAGER='bat'

πŸ”Œ Integration with zsh-vi-mode

This plugin works seamlessly with zsh-vi-mode. It automatically detects zsh-vi-mode and hooks into its lazy keybindings system.

For best results, source this plugin after zsh-vi-mode:

source /path/to/zsh-vi-mode.zsh
source /path/to/zsh-vi-man.zsh

πŸ“„ License

MIT License - see LICENSE for details.


Made with ❀️ by Tuna Cuma

About

Zsh vi-mode plugin for instant man-page help β€” press Shift-K to open a command’s man page with the option under your cursor auto-searched. πŸ”

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages