diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2020-02-14 00:32:45 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2020-02-14 00:36:20 +0900 |
commit | 4fb410a93c6567cfae1a72e1581a3bd193cd307a (patch) | |
tree | 10c47a7b8375588f9eabed5bd5052f5e9672b675 /plugin/fzf.vim | |
parent | 5e1db9fdd31257bc807348983dd3ae690056e5e0 (diff) |
[vim] More border styles
e.g.
let g:fzf_layout = { 'window': { 'width': 0.4, 'height': 1, 'xoffset': 0, 'border': 'right' } }
let g:fzf_layout = { 'window': { 'width': 0.4, 'height': 1, 'xoffset': 1, 'border': 'left' } }
let g:fzf_layout = { 'window': { 'width': 1, 'height': 0.5, 'yoffset': 1, 'border': 'top' } }
let g:fzf_layout = { 'window': { 'width': 1, 'height': 0.5, 'yoffset': 0, 'border': 'bottom' } }
Diffstat (limited to 'plugin/fzf.vim')
-rw-r--r-- | plugin/fzf.vim | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/plugin/fzf.vim b/plugin/fzf.vim index 4f361b42..8b88ae4b 100644 --- a/plugin/fzf.vim +++ b/plugin/fzf.vim @@ -872,16 +872,24 @@ function! s:popup(opts) abort let col += !has('nvim') " Border style - let style = get(a:opts, 'border', 'rounded') + let style = tolower(get(a:opts, 'border', 'rounded')) if !has_key(a:opts, 'border') && !get(a:opts, 'rounded', 1) let style = 'sharp' endif - if style == 'horizontal' + if style =~ 'vertical\|left\|right' + let mid = style == 'vertical' ? '│' .. repeat(' ', width - 2 * ambidouble) .. '│' : + \ style == 'left' ? '│' .. repeat(' ', width - 1 * ambidouble) + \ : repeat(' ', width - 1 * ambidouble) .. '│' + let border = repeat([mid], height) + let shift = { 'row': 0, 'col': style == 'right' ? 0 : 2, 'width': style == 'vertical' ? -4 : -2, 'height': 0 } + elseif style =~ 'horizontal\|top\|bottom' let hor = repeat('─', width / ambidouble) let mid = repeat(' ', width) - let border = [hor] + repeat([mid], height - 2) + [hor] - let margin = 0 + let border = style == 'horizontal' ? [hor] + repeat([mid], height - 2) + [hor] : + \ style == 'top' ? [hor] + repeat([mid], height - 1) + \ : repeat([mid], height - 1) + [hor] + let shift = { 'row': style == 'bottom' ? 0 : 1, 'col': 0, 'width': 0, 'height': style == 'horizontal' ? -2 : -1 } else let edges = style == 'sharp' ? ['┌', '┐', '└', '┘'] : ['╭', '╮', '╰', '╯'] let bar = repeat('─', width / ambidouble - 2) @@ -889,7 +897,7 @@ function! s:popup(opts) abort let mid = '│' .. repeat(' ', width - 2 * ambidouble) .. '│' let bot = edges[2] .. bar .. edges[3] let border = [top] + repeat([mid], height - 2) + [bot] - let margin = 2 + let shift = { 'row': 1, 'col': 2, 'width': -4, 'height': -2 } endif let highlight = get(a:opts, 'highlight', 'Comment') @@ -897,7 +905,7 @@ function! s:popup(opts) abort \ 'row': row, 'col': col, 'width': width, 'height': height, 'border': border \ }) call s:create_popup('Normal', { - \ 'row': row + 1, 'col': col + margin, 'width': width - margin * 2, 'height': height - 2 + \ 'row': row + shift.row, 'col': col + shift.col, 'width': width + shift.width, 'height': height + shift.height \ }) if has('nvim') execute 'autocmd BufWipeout <buffer> bwipeout '..frame |