Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: How to make a function use inbuilt completions of another command?
- X-seq: zsh-users 18981
- From: "Keerthan jai.c" <jckeerthan@xxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: How to make a function use inbuilt completions of another command?
- Date: Sun, 20 Jul 2014 20:52:32 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=+SN7JTsdxGrH7D1LbRwKoSxlim9OOAmTMyYBoYcHz3w=; b=N9bIcAB2SDD5bN8X4lEydFIwAOKIEE/97T9nWlSzEjKLFc1yocdiyg0GBvyyYyW464 J/3PoPI/JSs/NsLxRobXPZ/z6SUpASYCoJMWX91TeMBgAK6x/JmzlnAdmC+2TkxytuYN 7UQwiI5jyEXUDOYiEH5wuieMEMT1GZKCjldtSuj3Fn6QlAonTW+p7h7//qk5cuA5QbmI Qt9lOSpfER5NoTin7Zz3/WrQ9xS1roRQAmOW46DGHbZ7w1tC+/pHHDKKqRvbpXXIzE0V MvbxAqC03EU7WG8mIPzgy3lRxEKarZ0wYeNq4EuSiuQ48LMW7n47BdDN8C1bBseG3nra SYTA==
- In-reply-to: <140204100824.ZM21452@torch.brasslantern.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAHyxEs0RWnm_h1X6C6+VognALdCjZDabBATjUUtSUR58x+nHDw@mail.gmail.com> <140204073937.ZM21329@torch.brasslantern.com> <87eh3ic0zb.fsf@ft.bewatermyfriend.org> <140204100824.ZM21452@torch.brasslantern.com>
It turns out that tmux has an inbuilt way of supporting this behaviour.
The -A flag makes new-session behave like attach-session if session-name
already exists.
I have modified the completion script to support this:
--- /usr/share/zsh/functions/Completion/Unix/_tmux 2014-01-06
05:59:47.000000000 -0500
+++ _tmux 2014-07-20 20:50:01.994939784 -0400
@@ -573,12 +573,13 @@
local -a args
args=(
'-d[do not attach new session to current terminal]'
+ '-A[attach to existing session if it already exists]'
'-n[name the initial window]:window name'
- '-s[name the session]:session name'
+ '-s[name the session]:session name:__tmux-sessions'
'-t[specify target session]:sessions:__tmux-sessions'
'*:: :_command'
)
- _arguments ${args}
+ _arguments -s ${args}
}
function _tmux-new-window() {
On Tue, Feb 4, 2014 at 1:08 PM, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
wrote:
> On Feb 4, 5:10pm, Frank Terbeck wrote:
> }
> } > compdef _tmux funcname=sessions
> }
> } I wrote the _tmux completion and indeed don't have a clue about said
> } extension. Where can I take a closer look at it? Which completion should
> } I look at for guidance?
>
> Any of these should be good:
>
> _pkgtool
> _git
> _urpmi
> _uml
>
> Or just fgrep Completion/**/*(.) for references to '$service' ...
>
--
have a nice day
-jck
Messages sorted by:
Reverse Date,
Date,
Thread,
Author