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