Skip to content
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

Initial version of an idea – an on demand plugin-id completor and #331

Closed
wants to merge 4 commits into from

Conversation

psprint
Copy link
Contributor

@psprint psprint commented Jul 6, 2022

PR provides an Initial version of an idea – an on demand plugin-id completor and verifier. One will be able to do, e.g.:

zinit fzf<Alt>-a » zinit junegunn/fzf
zinit cd rip<Alt>-a » zinit cd BurntSushi/ripgrep
zinit cd tmux/tmux<Alt>-v » "tmux/tmux" highlighted in blue
                          » or red, depending on existence  of such
                          » plugin on the disk

and so on. The <Alt>-a and <Alt>-v shortcuts work with ALL commands, regardless if it's zinit command or not.

Two autoloaded functions are added, ziactioncomplete (the proper implementation of the main features) and ziprocessbuffer (a very useful library function that takes care of $BUFFFER/$CURSOR processing), which is little uncommon for zinit (to use autoloading mechanism by the plugin manager itself).

Description

I'm looking for some ideas of what else interesting can be done by editing of command line by a widget function hooked to a key binding.

Motivation and Context

It solves particular problem of problematic, lengthy plugin-id entering... Completion doesn't support for-syntax, so big win here. Also, I think that action-complete has better responsiveness than regular completion (in the scenarios that it also works, like cd subcommand).

Related Issue(s)

How Has This Been Tested?

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@github-actions github-actions bot added the zinit label Jul 6, 2022
@psprint
Copy link
Contributor Author

psprint commented Jul 6, 2022

Introducing cycling and ice-completion (<Alt>-i).

Cycling will allow to choose a particular match, say for, e.g.:

zinit at<Alt-i> » zinit atclone<Alt-i> » zinit atinit<Alt-i> »
         » zinit atload<Alt-i> » zinit atpull<Alt-i> »
         » zinit run-atpull<Alt-i> » zinit atclone"

It works for plugin-id completion in the same way, i.e.: <Alt-a> cycles through the matches.

For ices, the value of the ice is preserved, e.g.:

  zinit at'./configure'<Alt-i> » zinit atclone'./configure'<Alt-i> »
               » zinit atinit'./configure'<Alt-i> »
               » etc.

@psprint
Copy link
Contributor Author

psprint commented Jul 19, 2022

@vladdoster Hi. Did you maybe tried the feature? You can easily switch to the PR via the @tj / git-extras git pr {PR num} [remote] command. Its coding style leaves much objections but it just works.

@psprint psprint closed this Aug 13, 2022
@psprint psprint reopened this Sep 8, 2022
verifier. One will be able to obtain, e.g.:

zinit fzf<Alt>-a » zinit junegunn/fzf
zinit cd rip<Alt>-a » zinit cd BurntSushi/ripgrep
zinit cd tmux/tmux<Alt>-v » "tmux/tmux" highlighted eighter in blue
                          » or red, depending on existence  of
                          » such plugin

and so on. The <Alt>-a and <Alt>-v shortcuts work with ALL commands,
regardless if it's zinit command or not.

Two autoloaded functions added, ziactioncomplete (the proper imple-
mentation of the main features) and ziprocessbuffer (a very useful
library function that takes care of $BUFFFER/$CURSOR processing).
@psprint
Copy link
Contributor Author

psprint commented Sep 29, 2022

I've resolved conflicts. A small video: https://asciinema.org/a/VkIE2I7MfCoaaIh2mPxG6LLep

@psprint psprint force-pushed the action-complete branch 2 times, most recently from 80c1630 to 489bcd9 Compare September 30, 2022 14:09
@psprint
Copy link
Contributor Author

psprint commented Sep 30, 2022

@psprint
Copy link
Contributor Author

psprint commented Sep 30, 2022

@vladdoster I've simplified the code, there are no autosuggestions workarounds now

@psprint psprint force-pushed the action-complete branch 2 times, most recently from 04b424e to 7b56da7 Compare September 30, 2022 16:42
Cycling will allow to choose a particular match, say for, e.g.:
zinit at<Alt-C>   »   zinit atclone<Alt-C> » zinit atinit<Alt-C> »
                  »   zinit atload<Alt-C> » zinit atpull<Alt-C> »
                  »   zinit run-atpull<Alt-C> » zinit atclone"

It works for plugin-id completion in the same way, i.e.: <Alt-A>
cycles through the matches.

For ices, the value of the ice is preserved, e.g.:
zinit at'./configure'<Alt-C> » zinit atclone'./configure'<Alt-C> »
                             » zinit atinit'./configure'<Alt-C> »
                             » etc.
zi-action-complete Outdated Show resolved Hide resolved
zi-process-buffer Outdated Show resolved Hide resolved
@psprint psprint mentioned this pull request Oct 31, 2022
7 tasks
@psprint
Copy link
Contributor Author

psprint commented Dec 29, 2022

I'm closing because the feature is mature at #406.

@psprint psprint closed this Dec 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants