mirror of
https://github.com/junegunn/fzf.vim.git
synced 2025-12-07 05:04:30 +08:00
[[B]Commits] Do not enable preview on narrow screen
Only enable --preview if &columns > 120. Caveat: When fzf starts in a terminal buffer, &columns does not represent the width of the window. Related: #461
This commit is contained in:
@@ -44,6 +44,8 @@ if s:is_win
|
|||||||
let s:bin.preview = (executable('ruby') ? 'ruby' : 'bash').' '.escape(s:bin.preview, '\')
|
let s:bin.preview = (executable('ruby') ? 'ruby' : 'bash').' '.escape(s:bin.preview, '\')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
let s:wide = 120
|
||||||
|
|
||||||
function! s:extend_opts(dict, eopts, prepend)
|
function! s:extend_opts(dict, eopts, prepend)
|
||||||
if empty(a:eopts)
|
if empty(a:eopts)
|
||||||
return
|
return
|
||||||
@@ -327,7 +329,7 @@ function! fzf#vim#_lines(all)
|
|||||||
let rest = []
|
let rest = []
|
||||||
let buf = bufnr('')
|
let buf = bufnr('')
|
||||||
let longest_name = 0
|
let longest_name = 0
|
||||||
let display_bufnames = &columns > 100
|
let display_bufnames = &columns > s:wide
|
||||||
if display_bufnames
|
if display_bufnames
|
||||||
let bufnames = {}
|
let bufnames = {}
|
||||||
for b in s:buflisted()
|
for b in s:buflisted()
|
||||||
@@ -1120,7 +1122,7 @@ function! s:commits(buffer_local, args)
|
|||||||
let options.options[-1] .= ',ctrl-d'
|
let options.options[-1] .= ',ctrl-d'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !s:is_win
|
if !s:is_win && &columns > s:wide
|
||||||
call extend(options.options,
|
call extend(options.options,
|
||||||
\ ['--preview', 'grep -o "[a-f0-9]\{7,\}" <<< {} | xargs git show --format=format: --color=always | head -200'])
|
\ ['--preview', 'grep -o "[a-f0-9]\{7,\}" <<< {} | xargs git show --format=format: --color=always | head -200'])
|
||||||
endif
|
endif
|
||||||
|
|||||||
Reference in New Issue
Block a user