Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

How to capture the tab completion result?

Hi all

I need some help and possibly also an advice.

I want is to surround the result of the tab-completion with a special
not-printable chars.

I'm working on an application with embedded a special terminal emulator
inherited from gnome-terminal. I want to modify the common TAB behaviour
and manipulate the result of all TAB-completions: any string generated
pressing TAB should be handled by my app before going on screen.
So: the "special not printable chars" would be the way to tell my terminal:
"hey... there are some tab completions for you".

In my program I will do some work on the completion result and then I will
display it to the user in the terminal window (in some cases). I need to do
the job in my c++ code and there is no way to do that at shell level.

The best would be to switch on and off this features with an environment
var in order not to mess up the system in case I login with a standard
terminal. The dream would also have some difference between "file
completion" and everything else (as command option). For example:
completing an "ls /etc/ap" gives me a lot of result: I should know in my
terminal app that the results are files and which is their full path. In
this case, parsing the "ls /etc/ap" wuold be easy... but sometimes in the
command line there are many more chars...

The "surround char" is what I think is the easiest way... maybe also
putting everything in an env variable could be another valid way.
Everything should works also through an ssh connection... this means: I
cannot use any trick as piping result in a socket or anything else that
uses local resource.

I just spent three day into bash sources without any acceptable result. So,
looking for an alternative, I came on zsh.
So: can I do what I need with zsh?
One "yes!" and a general suggestion will be enough.


Messages sorted by: Reverse Date, Date, Thread, Author