branch: master commit c90784d13cdc68025bc878c4c328aea3d9f69970 Author: Oleh Krehel <ohwoeo...@gmail.com> Commit: Oleh Krehel <ohwoeo...@gmail.com>
doc/ivy.org: Update (Example - =counsel-describe-function=): Add a paragraph on :preselect. --- doc/ivy.org | 7 ++++++- doc/ivy.texi | 18 ++++++++++++------ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/doc/ivy.org b/doc/ivy.org index e1f5956..4d20cce 100644 --- a/doc/ivy.org +++ b/doc/ivy.org @@ -1137,7 +1137,7 @@ Note that only the first two arguments (and the =action=) are really important - the rest is just fine-tuning and could be omitted. The =action= argument could also be omitted - but then =ivy-read= -would no nothing except returning the string result, which you could +would do nothing except returning the string result, which you could later use yourself. However, it's recommended that you use the =action= argument. @@ -1168,6 +1168,11 @@ Here are the interesting features of the above function, in the order that they - The =prompt= argument is a simple string ending in ": ". - The =collection= argument evaluates to a (large) list of strings. - The =keymap= argument allows for a custom keymap to supplement =ivy-minibuffer-map=. +- The =preselect= is provided via =counsel-symbol-at-point=. This way, + if the point lies on a symbol or a word, ivy will try to pre-select + the first candidate that matches this symbol. If it happens to be + the candidate that the user wanted, it can be selected with ~RET~ + and no need for further input. - The =history= argument ensures that the command has its own history, and doesn't need to share the common history =ivy-history= that all commands without their own history share. diff --git a/doc/ivy.texi b/doc/ivy.texi index 3301b22..dc7c156 100644 --- a/doc/ivy.texi +++ b/doc/ivy.texi @@ -88,8 +88,8 @@ Key bindings Minibuffer key bindings * Key bindings for navigation:: -* Key bindings for single selection, action, then exit minibuffer: Key bindings for single selection action then exit minibuffer. -* Key bindings for multiple selections and actions, keep minibuffer open: Key bindings for multiple selections and actions keep minibuffer open. +* Key bindings for single selection, action, then exit minibuffer: Key bindings for single selection action then exit minibuffer. +* Key bindings for multiple selections and actions, keep minibuffer open: Key bindings for multiple selections and actions keep minibuffer open. * Key bindings that alter the minibuffer input:: * Other key bindings:: * Hydra in the minibuffer:: @@ -362,8 +362,8 @@ fully capable editing area: bindings like @kbd{C-a}, @kbd{C-f}, @kbd{M-d}, @code{fundamental-mode} buffer. @menu * Key bindings for navigation:: -* Key bindings for single selection, action, then exit minibuffer: Key bindings for single selection action then exit minibuffer. -* Key bindings for multiple selections and actions, keep minibuffer open: Key bindings for multiple selections and actions keep minibuffer open. +* Key bindings for single selection, action, then exit minibuffer: Key bindings for single selection action then exit minibuffer. +* Key bindings for multiple selections and actions, keep minibuffer open: Key bindings for multiple selections and actions keep minibuffer open. * Key bindings that alter the minibuffer input:: * Other key bindings:: * Hydra in the minibuffer:: @@ -1420,7 +1420,7 @@ Note that only the first two arguments (and the @code{action}) are really important - the rest is just fine-tuning and could be omitted. The @code{action} argument could also be omitted - but then @code{ivy-read} -would no nothing except returning the string result, which you could +would do nothing except returning the string result, which you could later use yourself. However, it's recommended that you use the @code{action} argument. @@ -1456,6 +1456,12 @@ The @code{collection} argument evaluates to a (large) list of strings. @item The @code{keymap} argument allows for a custom keymap to supplement @code{ivy-minibuffer-map}. @item +The @code{preselect} is provided via @code{counsel-symbol-at-point}. This way, +if the point lies on a symbol or a word, ivy will try to pre-select +the first candidate that matches this symbol. If it happens to be +the candidate that the user wanted, it can be selected with @kbd{RET} +and no need for further input. +@item The @code{history} argument ensures that the command has its own history, and doesn't need to share the common history @code{ivy-history} that all commands without their own history share. @@ -1569,4 +1575,4 @@ we want to kill the running process created by @printindex vr -@bye \ No newline at end of file +@bye