aloxaf.fzf-tab/test/select
Aloxaf fc30c60e4c
More configuration via zstyle (#46)
* Use zstyle for configuration

* Fix bug when disable sort

* Fix typo

* Fix curcontext

* Update doc

* All via zstyle and change delimiter to \x02

* Better support of preview

* Fix bug when disable sort

* Change `fzf_tab` to `fzf-tab`

* Add basic test

* \2 to \0

* Update
2020-03-06 17:17:49 +08:00

30 lines
459 B
Bash
Executable file

#!/usr/bin/env zsh
zmodload zsh/zutil
local -A headers range query
zparseopts -E h:=headers n:=range q:=query
print -r -- "<QUERY>${query//\"/}</QUERY>" >&2
local -a lines=()
while read input; do
lines+=($input)
done
for ((i = 1; i <= headers; i++)); do
print -r -- $lines[i] >&2
done
lines[1,headers]=()
for i in {1..$#lines}; do
print -r -- ${lines[i]//$'\0'}"<EC>" >&2
done
for i in ${(s:,:)range}; do
print -r -- $lines[i]
done