-
Notifications
You must be signed in to change notification settings - Fork 489
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #670 from cherryblossom000/patch-1
Update legacy syntax from Elvish widget
- Loading branch information
Showing
1 changed file
with
13 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,29 @@ | ||
use str | ||
|
||
fn call-navi []{ | ||
fn call-navi { | ||
if (eq $edit:current-command '') { | ||
answer = (navi --print) | ||
var answer = (navi --print) | ||
edit:replace-input $answer | ||
} elif (not (str:contains-any $edit:current-command '|')) { | ||
answer = (navi --print --query $edit:current-command) | ||
var answer = (navi --print --query $edit:current-command) | ||
if (not-eq $answer '') { | ||
edit:replace-input $answer | ||
} | ||
} else { | ||
cmds = [(str:split '|' $edit:current-command)] | ||
qty = (- (count $cmds) 1) | ||
query = (all $cmds | drop $qty) | ||
cmds = [(all $cmds | take $qty)] | ||
answer = '' | ||
if (eq $query '') { | ||
answer = (navi --print) | ||
} else { | ||
answer = (navi --print --query $query) | ||
} | ||
var @cmds query = (str:split '|' $edit:current-command) | ||
var answer = ( | ||
if (eq $query '') { | ||
navi --print | ||
} else { | ||
navi --print --query $query | ||
} | ||
) | ||
|
||
if (not-eq $answer '') { | ||
cmds = [$@cmds $answer] | ||
set cmds = [$@cmds $answer] | ||
edit:replace-input (str:join '| ' $cmds) | ||
} | ||
} | ||
} | ||
|
||
edit:insert:binding[Alt-h] = []{ call-navi >/dev/tty 2>&1 } | ||
set edit:insert:binding[Alt-h] = { call-navi >/dev/tty 2>&1 } |