Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Extending zed
- X-seq: zsh-users 24099
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- Subject: Re: Extending zed
- Date: Sun, 28 Jul 2019 13:01:53 +0200
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=9HMnm1OZNyOltomJBa7f2HUKf1EG8RMIdChp8PpoX7c=; b=t722YuqA2LBlgnORETzPRFyuENysevEtFA/zZKpS+Du0rB/C4fAx7bQCTzDoVULvxX LBAq+uIXdLsUYka3VqvFIVNGdqP7kQPaKUwlDr/NDLXn+oomZl0EHkiA8T885/kh0j2R EEsPeIEsaR/VuQO8WEBNoKGa8/oZBsonKoddK/xYsJX8iRPXZUgs0l3ifqxvuY8fCkb9 u9i57+j1hv8guV2/K6ctrTJIhb8VImPcxYd0H2UkSNiVxNjgowiUz2u4ges221QynNie WLhiy6LxN+yXgvpYnXa0FGu1seRPb5ZZsW9rHzx/XCuhQRfIBsynfMmquFtDuaafYBsU iPXA==
- In-reply-to: <CAKc7PVAtp=UX+VmD-38z0WsZw9_9KHNyT0hM1iez7bxUwM7BAg@mail.gmail.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>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CGME20180603055854epcas5p1e92f5a41384aeb9d1555751df74f57ee@epcas5p1.samsung.com> <CAKc7PVDas7ZvXA0CvR1opSH5Wz0d=FVj=NZHGSu2k3C_o=fGZQ@mail.gmail.com> <20180604083801eucas1p258b13dadf37a66e8a59e8714462d0577~06DN1ECXq0206402064eucas1p26@eucas1p2.samsung.com> <CAKc7PVCV3TCe4k-SyJOiD6aDA+uF5FRM_5Q45X9sLPOeCOunWA@mail.gmail.com> <20180604095044eucas1p2ae6dd78f9518e91e6171d15d3717f924~07CtDwS5C1968619686eucas1p2k@eucas1p2.samsung.com> <CAKc7PVB6JhtAQa+MUs0tm28211e4xJ4QRt-83=QYmuOczKwcOA@mail.gmail.com> <7026.1528128511@thecus> <CAKc7PVAtp=UX+VmD-38z0WsZw9_9KHNyT0hM1iez7bxUwM7BAg@mail.gmail.com>
śOn Tue, 5 Jun 2018 at 16:40, Sebastian Gniazdowski
<sgniazdowski@xxxxxxxxx> wrote:
>
> On 4 June 2018 at 18:08, Oliver Kiddle <okiddle@xxxxxxxxxxx> wrote:
> > -i vi-cmd-mode). I followed the naming of the __zed_pg_up widgets in
> > naming this __zed_init but I'm not especially fond of this – it looks
> > like a completion function.
>
> It hurts me a little too. For my plugin functions, I use "-", i.e.
> "-zed_pg_up", but didn't propose this as it is somewhat controversial
> – requires to use "--" when handling the function, e.g. when passing
> to `autoload -- -zed_pg_up`.
A proposal for a function naming scheme. The prefix and then its description:
- . (dot) - for normal yet private functions, i.e. functions that
shouldn't interfere with command-line completion, i.e. shouldn't be
completed when user enters e.g. "$ z<TAB>",
- + - for IO functions, e.g.: +myprj_print_msg or +myprj-print-msg
- @ - for API-like functions, i.e. functions that are used across
projects, that are exposed for use by some code with another ogigin,
.e.g @myprj-register-hook
- / - for debug-like functions, e.g. /myprj-dbg-print. The slash makes
the function impossible to be autoloaded, but the assumption is that
the debug functions shouldn't need this, at least not that it cannot
be resigned from,
- : - for a handler- or callback-, etc like functions; so e.g.
add-zsh-hook precmd :my-precmd-handler
So an example condensed code would look like this:
.prjid_register_hooks() {
integer ret
add-zsh-hook precmd :prjid-precmd-handler; ret+=$?
/prjid-dmsg "Installed precmd hook with result: $ret"
@otherprj-notice-hook precmd-hook :prjid-precmd-handler; ret+=$?
+prjid-print "Initialization complete (errors: $ret)"
}
--
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org
Messages sorted by:
Reverse Date,
Date,
Thread,
Author