Skip to content

Commit 50b8282

Browse files
committed
integration: Use floating fzf window
1 parent 877c1a0 commit 50b8282

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

sphinxnotes/snippet/integration/plugin.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@
1212
# Returns: snippet_id
1313
function snippet_list() {
1414
$SNIPPET list --tags $1 --width $(($(tput cols) - 2)) | \
15-
fzf --with-nth 2.. --no-hscroll --header-lines 1 | \
16-
cut -d ' ' -f1
15+
fzf --with-nth 2.. \
16+
--no-hscroll \
17+
--header-lines 1 \
18+
--margin=2 \
19+
--border=rounded \
20+
--height=60% | cut -d ' ' -f1
1721
}
1822

1923
# vim: set shiftwidth=2:

sphinxnotes/snippet/integration/plugin.vim

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,17 @@ function! s:SplitID(row)
1414
endfunction
1515

1616
function! g:SphinxNotesSnippetList(callback, tags)
17+
let l:width = 0.9
1718
let cmd = [s:snippet, 'list',
1819
\ '--tags', a:tags,
19-
\ '--width', &columns - 2,
20+
\ '--width', float2nr(&columns * l:width) - 2,
2021
\ ]
22+
" https://github.com/junegunn/fzf/blob/master/README-VIM.md#fzfrun
2123
call fzf#run({
2224
\ 'source': join(cmd, ' '),
2325
\ 'sink': a:callback,
2426
\ 'options': ['--with-nth', '2..', '--no-hscroll', '--header-lines', '1'],
27+
\ 'window': {'width': l:width, 'height': 0.6},
2528
\ })
2629
endfunction
2730

0 commit comments

Comments
 (0)