mirror of
https://github.com/preservim/vim-pencil.git
synced 2025-11-16 22:03:39 -05:00
Compatibility improvements
This commit is contained in:
@@ -155,18 +155,30 @@ fun! pencil#init(...) abort
|
||||
elsei b:pencil_wrap_mode ==# s:WRAP_MODE_SOFT
|
||||
setl textwidth=0
|
||||
setl wrap
|
||||
|
||||
if has('linebreak')
|
||||
setl linebreak
|
||||
" TODO breakat not working yet with n and m-dash
|
||||
setl breakat-=* " avoid breaking footnote*
|
||||
setl breakat-=@ " avoid breaking at email addresses
|
||||
en
|
||||
|
||||
if has('syntax')
|
||||
setl colorcolumn=0 " doesn't align as expected
|
||||
en
|
||||
el
|
||||
setl textwidth<
|
||||
setl wrap< nowrap<
|
||||
|
||||
if has('linebreak')
|
||||
setl linebreak< nolinebreak<
|
||||
setl breakat<
|
||||
en
|
||||
|
||||
if has('syntax')
|
||||
setl colorcolumn<
|
||||
en
|
||||
en
|
||||
|
||||
if ( v:version > 704 ||
|
||||
\ (v:version ==# 704 && has('patch-7.4.338')))
|
||||
@@ -191,6 +203,7 @@ fun! pencil#init(...) abort
|
||||
" because ve=onemore is relatively rare and could break
|
||||
" other plugins, restrict its presence to buffer
|
||||
" Better: restore ve to original setting
|
||||
if has('virtualedit')
|
||||
if b:pencil_wrap_mode && get(l:args, 'cursorwrap', g:pencil#cursorwrap)
|
||||
set whichwrap+=<,>,b,s,h,l,[,]
|
||||
aug pencil_cursorwrap
|
||||
@@ -200,6 +213,7 @@ fun! pencil#init(...) abort
|
||||
el
|
||||
sil! au! pencil_cursorwrap * <buffer>
|
||||
en
|
||||
en
|
||||
|
||||
" Because syntax for fenced code blocks will mess with the
|
||||
" definition of a word (via iskeyword) we'll impose a prose-
|
||||
@@ -221,7 +235,11 @@ fun! pencil#init(...) abort
|
||||
setl nolist
|
||||
setl wrapmargin=0
|
||||
setl autoindent " needed by formatoptions=n
|
||||
|
||||
if has('smartindent')
|
||||
setl nosmartindent " avoid c-style indents in prose
|
||||
en
|
||||
|
||||
setl formatoptions+=n " recognize numbered lists
|
||||
setl formatoptions+=1 " don't break line before 1 letter word
|
||||
setl formatoptions+=t " autoformat of text (vim default)
|
||||
@@ -245,15 +263,18 @@ fun! pencil#init(...) abort
|
||||
\ get(l:args, 'concealcursor', g:pencil#concealcursor)
|
||||
en
|
||||
el
|
||||
if has('smartindent')
|
||||
setl smartindent< nosmartindent<
|
||||
setl autoindent< noautoindent<
|
||||
setl list< nolist<
|
||||
setl wrapmargin<
|
||||
setl formatoptions<
|
||||
en
|
||||
if has('conceal')
|
||||
setl conceallevel<
|
||||
setl concealcursor<
|
||||
en
|
||||
|
||||
setl autoindent< noautoindent<
|
||||
setl list< nolist<
|
||||
setl wrapmargin<
|
||||
setl formatoptions<
|
||||
en
|
||||
|
||||
if b:pencil_wrap_mode ==# s:WRAP_MODE_SOFT
|
||||
|
||||
Reference in New Issue
Block a user