Abbreviate dir names in location and speed up history (#654)

- Pass directories through tilde-abbr before displaying them
- Leave tabs and newlines in history mode. Makes it MUCH faster for
  the listing to appear.
This commit is contained in:
Diego Zamboni 2018-03-30 02:42:39 +02:00 committed by Qi Xiao
parent 0f1bf8cf10
commit 4ed724a0a3

View File

@ -15,7 +15,7 @@ const narrowElv = `
# but different keys can be specified with the options. To disable a
# binding, specify its key as "".
# Example:
# narrow:bind-trigger-keys &location=Alt-l &lastcmd=""
# narrow:bind-trigger-keys &location=Alt-l &lastcmd=""
# Hooks
# Each hook variable is an array which must contain lambdas, all of
@ -36,7 +36,7 @@ fn location {
score = (splits . $arg[score] | take 1)
put [
&content=$arg[path]
&display=$score" "$arg[path]
&display=$score" "(tilde-abbr $arg[path])
]
})]
@ -53,7 +53,7 @@ fn history {
candidates = [(edit:command-history | each [arg]{
put [
&content=$arg[cmd]
&display=$arg[id]" "(replaces "\t" " " (replaces "\n" " " $arg[cmd]))
&display=$arg[id]" "$arg[cmd]
]
})]