* Complete global aliases? @ 2022-09-17 14:20 Sebastian Gniazdowski 2022-09-17 23:27 ` Bart Schaefer 2022-09-18 2:11 ` Eric Cook 0 siblings, 2 replies; 6+ messages in thread From: Sebastian Gniazdowski @ 2022-09-17 14:20 UTC (permalink / raw) To: Zsh hackers list [-- Attachment #1: Type: text/plain, Size: 367 bytes --] Hi, I think that the global aliases should be completed out of the box, what do you say? In a project I've created a bunch of global aliases to allow comfortable jumpings to its directories to become disappointed that they (global aliases) aren't completed like the named directories are. IMO this should be fixed on the upstream. Could someone add a snippet for it? [-- Attachment #2: Type: text/html, Size: 419 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Complete global aliases? 2022-09-17 14:20 Complete global aliases? Sebastian Gniazdowski @ 2022-09-17 23:27 ` Bart Schaefer 2022-09-18 9:43 ` Sebastian Gniazdowski 2022-09-18 2:11 ` Eric Cook 1 sibling, 1 reply; 6+ messages in thread From: Bart Schaefer @ 2022-09-17 23:27 UTC (permalink / raw) To: Sebastian Gniazdowski; +Cc: Zsh hackers list On Sat, Sep 17, 2022 at 7:27 AM Sebastian Gniazdowski <sgniazdowski@gmail.com> wrote: > > I think that the global aliases should be completed out of the box, what do you say? I think there needs to be a bit more specification about how this would work. Where would this fit in the overall design of contexts? E.g. does it happen in "-default-" context (which isn't always applied) and if so do alaises complete instead of files, as well as files, or only when there are no files (that is, _files returns nonzero)? Do the aliases expand or is just their name completed? What happens if you complete to the right of a global alias that (if expanded) changes the syntax of the command line? There are probably several other cases to consider, depending on the answers to those. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Complete global aliases? 2022-09-17 23:27 ` Bart Schaefer @ 2022-09-18 9:43 ` Sebastian Gniazdowski 2022-09-19 1:46 ` Bart Schaefer 0 siblings, 1 reply; 6+ messages in thread From: Sebastian Gniazdowski @ 2022-09-18 9:43 UTC (permalink / raw) To: Bart Schaefer; +Cc: Zsh hackers list [-- Attachment #1: Type: text/plain, Size: 1075 bytes --] On Sun, 18 Sept 2022 at 01:27, Bart Schaefer <schaefer@brasslantern.com> wrote: > On Sat, Sep 17, 2022 at 7:27 AM Sebastian Gniazdowski > <sgniazdowski@gmail.com> wrote: > > > > I think that the global aliases should be completed out of the box, what > do you say? > > I think there needs to be a bit more specification about how this would > work. > > Where would this fit in the overall design of contexts? E.g. does it > happen in "-default-" context (which isn't always applied) and if so > do alaises complete instead of files, as well as files, or only when > there are no files (that is, _files returns nonzero)? > I'm not sure, however there's a solution on the web, see: https://stackoverflow.com/a/59513051/11999858 > > Do the aliases expand or is just their name completed? I think that only its name should be completed. > What happens > if you complete to the right of a global alias that (if expanded) > changes the syntax of the command line I think that it shouldn't be expanded, so the issue isn't actual. -- Best regards, Sebastian Gniazdowski [-- Attachment #2: Type: text/html, Size: 2724 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Complete global aliases? 2022-09-18 9:43 ` Sebastian Gniazdowski @ 2022-09-19 1:46 ` Bart Schaefer 2022-09-24 11:02 ` Sebastian Gniazdowski 0 siblings, 1 reply; 6+ messages in thread From: Bart Schaefer @ 2022-09-19 1:46 UTC (permalink / raw) To: Sebastian Gniazdowski; +Cc: Zsh hackers list On Sun, Sep 18, 2022 at 2:43 AM Sebastian Gniazdowski <sgniazdowski@gmail.com> wrote: > > On Sun, 18 Sept 2022 at 01:27, Bart Schaefer <schaefer@brasslantern.com> wrote: >> >> Where would this fit in the overall design of contexts? > > I'm not sure, however there's a solution on the web, see: https://stackoverflow.com/a/59513051/11999858 That solution gives the user control over when global aliases are completed, by adding a function that can be placed anywhere in the completer zstyle. The suggested value of that zstyle happens to make global aliases complete before anything else, but that doesn't answer the question of how a default should work. >> Do the aliases expand or is just their name completed? > > I think that only its name should be completed. I'll note that theoretically the ^Xa key binding (expand aliases) can be programmed to complete when a partial word matches an alias and expand when a full word matches. I didn't attempt setting up the necessary zstyle contexts. >> What happens >> if you complete to the right of a global alias that (if expanded) >> changes the syntax of the command line > > I think that it shouldn't be expanded, so the issue isn't actual. Upon further thought, I agree that it's not an issue for completion of an alias itself. More generally, though, if the expansion of a global alias contains ";" or "|" or "&&" or "||" etc., then ideally further completions shouldn't be using the context of the preceding command word. Unfortunately that requires checking every word to the left of the cursor for a global alias, and expanding it, to get the "real" context. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Complete global aliases? 2022-09-19 1:46 ` Bart Schaefer @ 2022-09-24 11:02 ` Sebastian Gniazdowski 0 siblings, 0 replies; 6+ messages in thread From: Sebastian Gniazdowski @ 2022-09-24 11:02 UTC (permalink / raw) To: Bart Schaefer; +Cc: Zsh hackers list [-- Attachment #1: Type: text/plain, Size: 2291 bytes --] On Mon, 19 Sept 2022 at 03:46, Bart Schaefer <schaefer@brasslantern.com> wrote: > On Sun, Sep 18, 2022 at 2:43 AM Sebastian Gniazdowski > <sgniazdowski@gmail.com> wrote: > > > > On Sun, 18 Sept 2022 at 01:27, Bart Schaefer <schaefer@brasslantern.com> > wrote: > >> > >> Where would this fit in the overall design of contexts? > > > > I'm not sure, however there's a solution on the web, see: > https://stackoverflow.com/a/59513051/11999858 > > That solution gives the user control over when global aliases are > completed, by adding a function that can be placed anywhere in the > completer zstyle. The suggested value of that zstyle happens to make > global aliases complete before anything else, but that doesn't answer > the question of how a default should work. > Maybe looking from named dirs perspective can help? Currently, cd ~HO<tab> doesn't complete, too. I think that lack of such an obvious feature can make forward a way of completing also global aliases (like alias -g HOME ~)? How should be ~HOME completed I think that everybody knows (with exception of me)? The global aliases should be completed the same. > >> Do the aliases expand or is just their name completed? > > > > I think that only its name should be completed. > > I'll note that theoretically the ^Xa key binding (expand aliases) can > be programmed to complete when a partial word matches an alias and > expand when a full word matches. I didn't attempt setting up the > necessary zstyle contexts. > > When I tried ^Xa on my incomplete global alias it didn't complete… > > I think that it shouldn't be expanded, so the issue isn't actual. > > Upon further thought, I agree that it's not an issue for completion of > an alias itself. More generally, though, if the expansion of a global > alias contains ";" or "|" or "&&" or "||" etc., then ideally further > completions shouldn't be using the context of the preceding command > word. Unfortunately that requires checking every word to the left of > the cursor for a global alias, and expanding it, to get the "real" > context. > Could it just complete like ~HO<tab> should ? I don't really see the context issue, HO and ~HO should just complete… -- Best regards, Sebastian Gniazdowski [-- Attachment #2: Type: text/html, Size: 3904 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Complete global aliases? 2022-09-17 14:20 Complete global aliases? Sebastian Gniazdowski 2022-09-17 23:27 ` Bart Schaefer @ 2022-09-18 2:11 ` Eric Cook 1 sibling, 0 replies; 6+ messages in thread From: Eric Cook @ 2022-09-18 2:11 UTC (permalink / raw) To: zsh-workers On 9/17/22 10:20, Sebastian Gniazdowski wrote: > Hi, > I think that the global aliases should be completed out of the box, what do you say? In a project I've created a bunch of global aliases to allow comfortable jumpings to its directories to become disappointed that they (global aliases) aren't completed > like the named directories are. IMO this should be fixed on the upstream. Could someone add a snippet for it? There are dynamic named directories for this very thing. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-09-24 11:08 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-09-17 14:20 Complete global aliases? Sebastian Gniazdowski 2022-09-17 23:27 ` Bart Schaefer 2022-09-18 9:43 ` Sebastian Gniazdowski 2022-09-19 1:46 ` Bart Schaefer 2022-09-24 11:02 ` Sebastian Gniazdowski 2022-09-18 2:11 ` Eric Cook
Code repositories for project(s) associated with this public inbox https://git.vuxu.org/mirror/zsh/ This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).