Skip to content

Commit

Permalink
Merge pull request #1195 from haleyrc/master
Browse files Browse the repository at this point in the history
Modify the resize behavior for godoc
  • Loading branch information
fatih authored Feb 19, 2017
2 parents 70aba7c + 884870e commit 92d0d07
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions autoload/go/doc.vim
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,20 @@ function! s:GodocView(newposition, position, content) abort
execute bufwinnr(s:buf_nr) . 'wincmd w'
endif

" cap buffer height to 20, but resize it for smaller contents
let max_height = 20
let content_height = len(split(a:content, "\n"))
if content_height > max_height
exe 'resize ' . max_height
if a:position == "split"
" cap buffer height to 20, but resize it for smaller contents
let max_height = 20
let content_height = len(split(a:content, "\n"))
if content_height > max_height
exe 'resize ' . max_height
else
exe 'resize ' . content_height
endif
else
exe 'resize ' . content_height
" set a sane maximum width for vertical splits. In this case the minimum
" that fits the godoc for package http without extra linebreaks and line
" numbers on
exe 'vertical resize 84'
endif

setlocal filetype=godoc
Expand Down

0 comments on commit 92d0d07

Please sign in to comment.