-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Highlight executables in path subdirs #228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
You are describing the PATH_DIRS option. Yes, it would be possible to support that. This would include:
Would you be interested in implementing this? Even simply adding a test would be helpful. |
About the implementation: the option might have to be tested early, like INTERACTIVE_COMMENTS is, and for the same reason. Also, the first hunk and a half of this diff (ignore the log message and the remaining hunks) might be reusable here. (That commit is an unfinished fix for #202; I'm hoping to finish it the fix in time for the next release.) |
Hmm, ok. Along fortnight, I will look what could be done. |
Actually, can you try this patch? diff --git a/highlighters/main/main-highlighter.zsh b/highlighters/main/main-highlighter.zsh
index 64a2032..83e40b1 100644
--- a/highlighters/main/main-highlighter.zsh
+++ b/highlighters/main/main-highlighter.zsh
@@ -86,7 +86,12 @@ _zsh_highlight_main_highlighter()
if [[ -o interactive_comments ]]; then
local interactive_comments= # set to empty
fi
+ if [[ -o path_dirs ]]; then
+ integer path_dirs_is_set=1
+ fi
emulate -L zsh
+ (( path_dirs_is_set )) && setopt path_dirs # required for detecting command words
+ unset path_dirs_is_set # remove the parameter, leave the option
setopt localoptions extendedglob bareglobqual
local start_pos=0 end_pos highlight_glob=true arg style
typeset -a ZSH_HIGHLIGHT_TOKENS_COMMANDSEPARATOR Turns out the If the patch works, we'd still need (a) a test, (b) to make the |
Draft patch, seems like it did the job. |
Highlighting prefix of a valid command in yellow has been requested before (see #148). It's a good idea. The specific case of "the command-word-so-far is [edit: a prefix of] a directory name in $PATH, and PATH_DIRS is set" will probably need to be coded explicitly, though (in the catchall branch of the |
If the |
… test. Fixes #182. Prerequisite for testing issue #228. * tests/test-highlighting.zsh (run_test): Move functionality to run_test_internal; make run_test be a wrapper that handles creating and cleaning up the tempdir. * tests/README.md: Document the new feature. * "highlighters/main/test-data/path-space- .zsh" * highlighters/main/test-data/path-tilde-named.zsh * highlighters/main/test-data/path.zsh Change test data to not depend on being run from the source directory.
This builds upon the test harness auto-cleaned-up directories work (c015339).
Thanks for the implementation! |
No problem. (I thought neovim was mostly compatible with vim, though? A 95% drop-in replacement?) |
Aah, not so simple when you use >100 plugins:) Part of them hit some neovim bugs, part was necessary to fix/enhance/wrap under jobs API, being unable to use interactive shell in neovim. And overall doesn't new vim gives great reason to inspect and refactor old bloated configs by applying all the last years experience?)) |
Wow. Good luck with your project! :) |
I have something like
ZSH allows me to call binaries in subdirs by relative path:
rarely-used.d/pr1.bin
from any place.Could it be possible to highlight them as a valid commands to launch?
Like example -- launching searching for binaries inside PATH nested subdirs on each
/
entered?The text was updated successfully, but these errors were encountered: