mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-12-23 03:19:01 +00:00
parent
b3b101a89c
commit
f6b1962056
@ -272,14 +272,17 @@ string, specify field index expressions between the braces (See \fBFIELD INDEX
|
||||
EXPRESSION\fR for the details).
|
||||
|
||||
.RS
|
||||
e.g. \fBfzf --preview="head -$LINES {}"\fR
|
||||
e.g. \fBfzf --preview='head -$LINES {}'\fR
|
||||
\fBls -l | fzf --preview="echo user={3} when={-4..-2}; cat {-1}" --header-lines=1\fR
|
||||
|
||||
fzf overrides \fB$LINES\fR and \fB$COLUMNS\fR so that they represent the exact
|
||||
size of the preview window.
|
||||
|
||||
A placeholder expression starting with \fB+\fR flag will be replaced to the
|
||||
space-separated list of the selected lines (or the current line if no selection
|
||||
was made) individually quoted.
|
||||
|
||||
e.g. \fBfzf --multi --preview="head -10 {+}"\fR
|
||||
e.g. \fBfzf --multi --preview='head -10 {+}'\fR
|
||||
\fBgit log --oneline | fzf --multi --preview 'git show {+1}'\fR
|
||||
|
||||
Also, \fB{q}\fR is replaced to the current query string.
|
||||
|
@ -1368,6 +1368,12 @@ func (t *Terminal) Loop() {
|
||||
command := replacePlaceholder(t.preview.command,
|
||||
t.ansi, t.delimiter, false, string(t.input), request)
|
||||
cmd := util.ExecCommand(command)
|
||||
if t.pwindow != nil {
|
||||
env := os.Environ()
|
||||
env = append(env, fmt.Sprintf("LINES=%d", t.pwindow.Height()))
|
||||
env = append(env, fmt.Sprintf("COLUMNS=%d", t.pwindow.Width()))
|
||||
cmd.Env = env
|
||||
}
|
||||
out, _ := cmd.CombinedOutput()
|
||||
t.reqBox.Set(reqPreviewDisplay, string(out))
|
||||
} else {
|
||||
|
@ -1319,12 +1319,12 @@ class TestGoFZF < TestBase
|
||||
end
|
||||
|
||||
def test_preview_hidden
|
||||
tmux.send_keys %(seq 1000 | #{FZF} --preview 'echo {{}-{}}' --preview-window down:1:hidden --bind ?:toggle-preview), :Enter
|
||||
tmux.send_keys %(seq 1000 | #{FZF} --preview 'echo {{}-{}-\\$LINES-\\$COLUMNS}' --preview-window down:1:hidden --bind ?:toggle-preview), :Enter
|
||||
tmux.until { |lines| lines[-1] == '>' }
|
||||
tmux.send_keys '?'
|
||||
tmux.until { |lines| lines[-2].include?(' {1-1}') }
|
||||
tmux.until { |lines| lines[-2].match?(/ {1-1-1-[0-9]+}/) }
|
||||
tmux.send_keys '555'
|
||||
tmux.until { |lines| lines[-2].include?(' {555-555}') }
|
||||
tmux.until { |lines| lines[-2].match?(/ {555-555-1-[0-9]+}/) }
|
||||
tmux.send_keys '?'
|
||||
tmux.until { |lines| lines[-1] == '> 555' }
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user