Compatibility improvements

This commit is contained in:
Reed Esau
2014-09-17 06:40:04 -06:00
parent b54232eace
commit 6964928289

View File

@@ -155,17 +155,29 @@ 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
setl linebreak
" TODO breakat not working yet with n and m-dash if has('linebreak')
setl breakat-=* " avoid breaking footnote* setl linebreak
setl breakat-=@ " avoid breaking at email addresses " TODO breakat not working yet with n and m-dash
setl colorcolumn=0 " doesn't align as expected 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 el
setl textwidth< setl textwidth<
setl wrap< nowrap< setl wrap< nowrap<
setl linebreak< nolinebreak<
setl breakat< if has('linebreak')
setl colorcolumn< setl linebreak< nolinebreak<
setl breakat<
en
if has('syntax')
setl colorcolumn<
en
en en
if ( v:version > 704 || if ( v:version > 704 ||
@@ -191,14 +203,16 @@ 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 b:pencil_wrap_mode && get(l:args, 'cursorwrap', g:pencil#cursorwrap) if has('virtualedit')
set whichwrap+=<,>,b,s,h,l,[,] if b:pencil_wrap_mode && get(l:args, 'cursorwrap', g:pencil#cursorwrap)
aug pencil_cursorwrap set whichwrap+=<,>,b,s,h,l,[,]
au BufEnter <buffer> set virtualedit+=onemore aug pencil_cursorwrap
au BufLeave <buffer> set virtualedit-=onemore au BufEnter <buffer> set virtualedit+=onemore
aug END au BufLeave <buffer> set virtualedit-=onemore
el aug END
sil! au! pencil_cursorwrap * <buffer> el
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
@@ -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
setl nosmartindent " avoid c-style indents in prose
if has('smartindent')
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
setl smartindent< nosmartindent< if has('smartindent')
setl autoindent< noautoindent< setl smartindent< nosmartindent<
setl list< nolist< en
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