summaryrefslogtreecommitdiffstats
path: root/README.rst
diff options
context:
space:
mode:
authorpgen <p.gen.progs@gmail.com>2021-02-06 22:11:57 +0100
committerpgen <p.gen.progs@gmail.com>2021-02-10 00:29:28 +0100
commit29b697207b3256232a4775e80ae77ab745e8f68e (patch)
tree04b08dc8cedb701b54444a83c196d99e784782b7 /README.rst
parent7987e79146896d47494bccc37d29effacae4f3f8 (diff)
Add an example in the README file
An example of using smenu to browse the bash history with CTRL-R has been added. It can certainly be improved but it's a start.
Diffstat (limited to 'README.rst')
-rw-r--r--README.rst18
1 files changed, 18 insertions, 0 deletions
diff --git a/README.rst b/README.rst
index e97c3a0..de02c6a 100644
--- a/README.rst
+++ b/README.rst
@@ -130,6 +130,24 @@ On mine (``LANG`` and ``LC_ALL`` set to ``POSIX``) it displays:
Note the presence of a scrollbar.
+Bash example (CRTL-R replacement)
+---------------------------------
+Just add the following in your ``.bashrc``
+
+::
+
+ EOL=$'\n'
+ bind -x '"\C-r": READLINE_LINE=$(fc -lr 1 \
+ | sed "s/[1-9][0-9]*..//" \
+ | smenu -Q -l -a c:7/4b -W"$EOL")
+ READLINE_POINT=${#READLINE_LINE}'
+
+Launch or relaunch **bash** and hit ``CTRL-R`` (``CTRL-C`` or ``q``
+to exit), enjoy!
+
+You can also add the parameter **-d** to instruct **smenu** to clean
+the selection window after selecting an entry.
+
Warning for post v0.9.15 versions.
----------------------------------
These versions use a new options system called **ctxopt** which