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