summaryrefslogtreecommitdiff
path: root/README.adoc
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2020-10-01 11:54:01 +0200
committerPřemysl Eric Janouch <p@janouch.name>2020-10-01 11:58:32 +0200
commitb8c767354ec847e1415550b8002430c71e99ed47 (patch)
treed90cce80028436a29bb87b55c2cf9157381c7c68 /README.adoc
parentc07f557c1613c7b962c51206415db911090bdd0d (diff)
downloadsdn-b8c767354ec847e1415550b8002430c71e99ed47.tar.gz
sdn-b8c767354ec847e1415550b8002430c71e99ed47.tar.xz
sdn-b8c767354ec847e1415550b8002430c71e99ed47.zip
Show external command line if appropriate
Since I'm already dealing with the fish shell. All of our supported shells seem to handle cursor position in Unicode (wide character) codepoints. It was easiest and most straight-forward to pass the data through yet-unused program arguments. The cursor position is marked by a Unicode glyph equivalent to ACS_DIAMOND, although ncurses doesn't get a chance to make any ACS translation.
Diffstat (limited to 'README.adoc')
-rw-r--r--README.adoc9
1 files changed, 6 insertions, 3 deletions
diff --git a/README.adoc b/README.adoc
index 18f922a..dd4e583 100644
--- a/README.adoc
+++ b/README.adoc
@@ -55,7 +55,7 @@ To start using this navigator, put the following in your '.zshrc':
----
sdn-navigate () {
# ... possibly zle-line-init
- while eval "`sdn`"; do
+ while eval "`sdn "$BUFFER" "$CURSOR"`"; do
[ -z "$cd" ] || cd "$cd"
[ -z "$insert" ] || LBUFFER="$LBUFFER$insert "
[ -z "$helper" ] && break
@@ -74,7 +74,9 @@ To start using this navigator, put the following in your 'config.fish':
----
function sdn-navigate
set --local IFS
- while eval (sdn | string replace -ar '^(.*?)=' 'set --$1 ')
+ set --local buffer (commandline)
+ set --local cursor (commandline --cursor)
+ while eval (sdn $buffer $cursor | string replace -ar '^(.*?)=' 'set --$1 ')
test -z "$cd" || cd "$cd"
test -z "$insert" || commandline --insert "$insert "
test -z "$helper" && break
@@ -96,7 +98,7 @@ sdn-navigate () {
SDN_L=$READLINE_LINE SDN_P=$READLINE_POINT
READLINE_LINE=
- while eval "`sdn`"; do
+ while eval "`sdn "$SDN_L" "$SDN_P"`"; do
[[ -z "$cd" ]] || cd "$cd"
[[ -z "$insert" ]] || {
SDN_L="${SDN_L:0:$SDN_P}$insert ${SDN_L:$SDN_P}"
@@ -129,6 +131,7 @@ cursor 231 202
bar 16 255 ul
cwd bold
input
+cmdline 102
....
Filename colours are taken from the `LS_COLORS` environment variable.