From: Domagoj Pintaric <domagoj.pintaric@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: zsh-workers@zsh.org
Subject: Re: Custom auto complete
Date: Wed, 6 Aug 2014 00:37:55 +0200 [thread overview]
Message-ID: <CALGc2Bpr1Hv4KNbUiN8F==pE-pS7d8QU4oinju-4_wOH-KW8dA@mail.gmail.com> (raw)
In-Reply-To: <140804135755.ZM2030@torch.brasslantern.com>
[-- Attachment #1: Type: text/plain, Size: 2276 bytes --]
Hi,
The solution you posted sort of dose what I want. With this code I have to
type ?<some char(s)> in order for it to work. If I just type ? and hit tab
it dose not work.
I get that's because of ( \?* ) and I tried (\?) but it dose not work.
Interesting, if I use for example ( \! ) that works as expected. Is the '?'
special for some reason?
Also I found another way of getting what I want I think it's a more
intuitive solution than the whole '?' idea. I found that I can write my own
widget and bind it to a key so this is what I did:
zle -C custom-complete menu-expand-or-complete _parse_sb_file
_parse_sb_file() {
WORDS=( ${(f)"$(<$SB_FILE_PATH)"} )
ARRAY=()
integer POS=1
for ITEM in ${WORDS}; do
ARRAY[${POS}]=${POS}") "${WORDS[${POS}]}
(( POS++ ))
done
compadd -l -d ARRAY -a -S '' -- WORDS
}
bindkey ${CTRLTAB_KEY} custom-complete
This works but I have some issues with this to:
1) if I press ctrl-tab I can not select the options with arrow keys I can
just switch them with ctrl-tab, unless I first run for example "cp <TAB>"
then I get the menu and I can select options. And if I after that (after cp
<TAB> showed the menu with select) use ctrl-tab I get menu with select? Not
sure why I first have invoke another menu for ctrl-tab to work in a same
manner?
2) if I have this string, for example, in a file "cp file1 file2" it is
inserted like this "cp\ file1\ file2". The white spaces are escaped, how
can I disable this, and tell zsh to insert a string as it is.
Thanks for your help.
Regards,
Domagoj
On Mon, Aug 4, 2014 at 10:57 PM, Bart Schaefer <schaefer@brasslantern.com>
wrote:
> On Aug 4, 1:39pm, Bart Schaefer wrote:
> }
> } # Now anything starting with '?'
> } (\?*) _message "Querying answerfile"
> } compstate[insert]=menu
> } compadd -U -a answers # -U to replace "?" with the result
> } ;;
>
> Hmm, it occurs to me that this should probably be in the order
>
> compadd -U -a answers # -U to replace "?" with the result
> compstate[insert]=menu
>
> so that the initial value of compstate[insert] is visible to compadd
> before we change it. I don't know exactly when that would matter, but
> the doc for compstate[insert] implies that it might.
>
next prev parent reply other threads:[~2014-08-05 22:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-03 16:17 Domagoj Pintaric
2014-08-04 20:39 ` Bart Schaefer
2014-08-04 20:57 ` Bart Schaefer
2014-08-05 22:37 ` Domagoj Pintaric [this message]
2014-08-06 3:45 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CALGc2Bpr1Hv4KNbUiN8F==pE-pS7d8QU4oinju-4_wOH-KW8dA@mail.gmail.com' \
--to=domagoj.pintaric@gmail.com \
--cc=schaefer@brasslantern.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).