[vim] More border styles
Before adoption: this commit came in with the history the project adopted, so no landing records it.
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' } }
authored by Junegunn Choi · committed by Junegunn Choi · parent 5e1db9f · Browse files · 3 files·+25 added−13 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+25 added−13 removed
- other:+25 added−13 removed
Provenance
- Commit
4fb410a- Tree
10c47a7- Author
Junegunn Choi <junegunn.c@gmail.com>- Committer
Junegunn Choi <junegunn.c@gmail.com>- Parent
5e1db9f
3 files changed+25 added−13 removed
modified:doc/fzf.txt+7 added-5 removed
1-fzf.txt fzf Last change: February 6 20201+fzf.txt fzf Last change: February 14 20202 FZF - TABLE OF CONTENTS *fzf* *fzf-toc*3 ==============================================================================4 5 FZF Vim integration213 unmodified lines219 - Required:220 - `width` [float range [0 ~ 1]]221 - `height` [float range [0 ~ 1]]222 - Optional:223- - `xoffset` [float default 0.0 range [0 ~ 1]]224- - `yoffset` [float default 0.0 range [0 ~ 1]]223+ - `yoffset` [float default 0.5 range [0 ~ 1]]224+ - `xoffset` [float default 0.5 range [0 ~ 1]]225 - `highlight` [string default `'Comment'`]: Highlight group for border226- - `border` [string default `rounded`]: Border style (`rounded` | `sharp` | `horizontal`)226+ - `border` [string default `rounded`]: Border style227+ - `rounded` / `sharp` / `horizontal` / `vertical` / `top` / `bottom` / `left` / `right`228 229 230 FZF#WRAP231 ==============================================================================83 unmodified lines315 " Optional:316 " - xoffset [float default 0.5 range [0 ~ 1]]317 " - yoffset [float default 0.5 range [0 ~ 1]]318 " - highlight [string default 'Comment']: Highlight group for border318- " - border [string default 'rounded']: Border style ('rounded' | 'sharp' | 'horizontal')319+ " - border [string default 'rounded']: Border style320+ " - 'rounded' / 'sharp' / 'horizontal' / 'vertical' / 'top' / 'bottom' / 'left' / 'right'321 let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.6 } }322 <323 324 Hide statusline~25 unmodified linesmodified:plugin/fzf.vim+14 added-6 removed
870 unmodified lines871 let row += !has('nvim')872 let col += !has('nvim')873 874 " Border style875- let style = get(a:opts, 'border', 'rounded')875+ let style = tolower(get(a:opts, 'border', 'rounded'))876 if !has_key(a:opts, 'border') && !get(a:opts, 'rounded', 1)877 let style = 'sharp'878 endif879 880- if style == 'horizontal'880+ if style =~ 'vertical\|left\|right'881+ let mid = style == 'vertical' ? '│' .. repeat(' ', width - 2 * ambidouble) .. '│' :882+ \ style == 'left' ? '│' .. repeat(' ', width - 1 * ambidouble)883+ \ : repeat(' ', width - 1 * ambidouble) .. '│'884+ let border = repeat([mid], height)885+ let shift = { 'row': 0, 'col': style == 'right' ? 0 : 2, 'width': style == 'vertical' ? -4 : -2, 'height': 0 }886+ elseif style =~ 'horizontal\|top\|bottom'887 let hor = repeat('─', width / ambidouble)888 let mid = repeat(' ', width)883- let border = [hor] + repeat([mid], height - 2) + [hor]884- let margin = 0889+ let border = style == 'horizontal' ? [hor] + repeat([mid], height - 2) + [hor] :890+ \ style == 'top' ? [hor] + repeat([mid], height - 1)891+ \ : repeat([mid], height - 1) + [hor]892+ let shift = { 'row': style == 'bottom' ? 0 : 1, 'col': 0, 'width': 0, 'height': style == 'horizontal' ? -2 : -1 }893 else894 let edges = style == 'sharp' ? ['┌', '┐', '└', '┘'] : ['╭', '╮', '╰', '╯']895 let bar = repeat('─', width / ambidouble - 2)896 let top = edges[0] .. bar .. edges[1]897 let mid = '│' .. repeat(' ', width - 2 * ambidouble) .. '│'898 let bot = edges[2] .. bar .. edges[3]899 let border = [top] + repeat([mid], height - 2) + [bot]892- let margin = 2900+ let shift = { 'row': 1, 'col': 2, 'width': -4, 'height': -2 }901 endif902 903 let highlight = get(a:opts, 'highlight', 'Comment')904 let frame = s:create_popup(highlight, {905 \ 'row': row, 'col': col, 'width': width, 'height': height, 'border': border906 \ })907 call s:create_popup('Normal', {900- \ 'row': row + 1, 'col': col + margin, 'width': width - margin * 2, 'height': height - 2908+ \ 'row': row + shift.row, 'col': col + shift.col, 'width': width + shift.width, 'height': height + shift.height909 \ })910 if has('nvim')911 execute 'autocmd BufWipeout <buffer> bwipeout '..frame912 endif38 unmodified linesmodified:README-VIM.md+4 added-2 removed
202 unmodified lines203 - Optional:204 - `yoffset` [float default 0.5 range [0 ~ 1]]205 - `xoffset` [float default 0.5 range [0 ~ 1]]206 - `highlight` [string default `'Comment'`]: Highlight group for border207- - `border` [string default `rounded`]: Border style (`rounded` | `sharp` | `horizontal`)207+ - `border` [string default `rounded`]: Border style208+ - `rounded` / `sharp` / `horizontal` / `vertical` / `top` / `bottom` / `left` / `right`209 210 `fzf#wrap`211 ----------212 87 unmodified lines300 " Optional:301 " - xoffset [float default 0.5 range [0 ~ 1]]302 " - yoffset [float default 0.5 range [0 ~ 1]]303 " - highlight [string default 'Comment']: Highlight group for border303-" - border [string default 'rounded']: Border style ('rounded' | 'sharp' | 'horizontal')304+" - border [string default 'rounded']: Border style305+" - 'rounded' / 'sharp' / 'horizontal' / 'vertical' / 'top' / 'bottom' / 'left' / 'right'306 let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.6 } }307 ```308 309 #### Hide statusline22 unmodified lines