feat: add neovim pager support and refactor into modular architecture#8
Merged
feat: add neovim pager support and refactor into modular architecture#8
Conversation
- Add neovim/vim as supported pagers with :Man command integration - Refactor main file into modular lib/ structure: - lib/parser.zsh: word and command parsing - lib/pattern.zsh: search pattern builders for less/nvim - lib/pager.zsh: pager-specific man page opening logic - lib/keybinding.zsh: keybinding management - Add comprehensive neovim pattern tests (test_nvim.zsh) - Update CI workflow and Makefile with neovim tests - Fix false positives in nvim search patterns - Patterns now only match option definitions, not mentions in descriptions Fixes #4
- Add dedicated zvm_open_vim() function for vim pager - Load vim's bundled man.vim ftplugin before calling :Man - Use </dev/tty to fix terminal access from zle widget - Fixes 'E492: Not an editor command: Man' error - Fixes terminal corruption and prompt indentation issues
The pattern "-.*[,/]" was too greedy, matching across entire description lines when it should only match option definition lines. Changes: - Replace "-.*" with "-[^[:space:],/]*" to stop at spaces/commas/slashes - Add "\(-[^[:space:],/]*[,/][[:space:]]*\)\+" to handle multiple preceding options like "-R, -r, --recursive" This fixes the case where searching for "-l" would incorrectly match: " -f ...this option has no effect on the -d, -l, -R..." The pattern now correctly requires that options be in a proper option definition format (comma/slash-separated list at line start) rather than mentioned in description prose.
When MANPAGER is set to nvim but ZVM_MAN_PAGER is set to less, calling man directly would invoke nvim through the system MANPAGER. This breaks the shell when nvim is spawned from a zle widget without proper terminal access. Fix by setting MANPAGER=cat inline to neutralize the system pager, then always pipe through ZVM_MAN_PAGER.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds neovim/vim as supported pagers and refactors the codebase into a modular architecture for easier extensibility.
Changes
Neovim Pager Support
:Mancommandnvim +"Man <cmd>" +only +/<pattern>format for proper integrationModular Architecture
Refactored the monolithic
zsh-vi-man.zshinto logical layers:Benefits:
lib/pager.zsh)lib/keybinding.zsh)Testing
test_nvim.zshwith 46 comprehensive tests for neovim patternstest-nvimtargetFalse Positive Prevention
-f ...has no effect on the -d, -l, -R...-@ ...in long (-l) output.Testing Done
make test-all # All tests passManual testing with:
ls -la→ finds-l, pressnfor-agit commit -m→ opensgit-commitman pagetree | grep -r→ opensgrepman (nottree)Fixes
Fixes #4