Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f65b885

Browse files
committed
Add g:viewdoc_winwidth_max, a cap on paragraph width
1 parent 3ffd7f9 commit f65b885

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

‎doc/viewdoc.txt‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,12 @@ g:viewdoc_copy_to_search_reg =0 (default) *g:viewdoc_copy_to_search_reg*
392392
search register which allows to easily search in the documentation for
393393
occurrences of this word.
394394

395+
g:viewdoc_winwidth_max =0 (default) *g:viewdoc_winwidth_max*
396+
If set, limits the text width passed to doc formatters, so paragraphs
397+
width can be limited to |g:viewdoc_winwidth_max| characters rather than
398+
stretch across very wide windows. Some documentation is pre-formatted,
399+
and this will have no effect.
400+
395401
Added by man handler:~
396402

397403
g:viewdoc_man_cmd ="man" (default) *g:viewdoc_man_cmd*

‎plugin/viewdoc.vim‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ endif
3636
if !exists('g:viewdoc_copy_to_search_reg')
3737
let g:viewdoc_copy_to_search_reg=0
3838
endif
39+
if !exists('g:viewdoc_winwidth_max')
40+
let g:viewdoc_winwidth_max=0
41+
endif
3942

4043
""" Interface
4144
" - command
@@ -101,7 +104,8 @@ function ViewDoc(target, topic, ...)
101104
for h in hh
102105
if exists('h.cmd')
103106
call ViewDoc_SetShellToBash()
104-
let h.cmd = substitute(h.cmd, '{{winwidth}}', winwidth('.'), 'g')
107+
let winwidth = g:viewdoc_winwidth_max > 0 ? min([winwidth('.'), g:viewdoc_winwidth_max]) : winwidth('.')
108+
let h.cmd = substitute(h.cmd, '{{winwidth}}', winwidth, 'g')
105109
execute 'silent 0r ! ( ' . h.cmd . ' ) 2>/dev/null'
106110
call ViewDoc_RestoreShell()
107111
silent $d

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /