mirror of
https://github.com/preservim/vim-pencil.git
synced 2025-11-14 04:43:47 -05:00
Ensure the global options have init() equivalents
This commit is contained in:
@@ -107,6 +107,10 @@ plugin will auto-detect the line wrap approach, with `hard` as the
|
|||||||
default. But for files of type `text`, it will *always* initialize with
|
default. But for files of type `text`, it will *always* initialize with
|
||||||
hard line break mode.
|
hard line break mode.
|
||||||
|
|
||||||
|
Configurable options for `pencil#init()` include: `autoformat`,
|
||||||
|
`concealcursor`, `conceallevel`, `cursorwrap`, `joinspaces`, `textwidth`,
|
||||||
|
and `wrap`.
|
||||||
|
|
||||||
### Commands
|
### Commands
|
||||||
|
|
||||||
Because auto-detect might not work as intended, you can invoke a command
|
Because auto-detect might not work as intended, you can invoke a command
|
||||||
|
|||||||
@@ -145,7 +145,8 @@ fun! pencil#init(...) abort
|
|||||||
" Compensate for disabled modeline
|
" Compensate for disabled modeline
|
||||||
exe 'setl textwidth=' . b:max_textwidth
|
exe 'setl textwidth=' . b:max_textwidth
|
||||||
elsei &textwidth == 0
|
elsei &textwidth == 0
|
||||||
exe 'setl textwidth=' . g:pencil#textwidth
|
exe 'setl textwidth=' .
|
||||||
|
\ get(l:args, 'textwidth', g:pencil#textwidth)
|
||||||
el
|
el
|
||||||
setl textwidth<
|
setl textwidth<
|
||||||
en
|
en
|
||||||
@@ -170,7 +171,7 @@ fun! pencil#init(...) abort
|
|||||||
if b:wrap_mode
|
if b:wrap_mode
|
||||||
set display+=lastline
|
set display+=lastline
|
||||||
set backspace=indent,eol,start
|
set backspace=indent,eol,start
|
||||||
if g:pencil#joinspaces
|
if get(l:args, 'joinspaces', g:pencil#joinspaces)
|
||||||
set joinspaces " two spaces after .!?
|
set joinspaces " two spaces after .!?
|
||||||
el
|
el
|
||||||
set nojoinspaces " only one space after a .!? (default)
|
set nojoinspaces " only one space after a .!? (default)
|
||||||
@@ -185,7 +186,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 b:wrap_mode && g:pencil#cursorwrap
|
if b: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
|
||||||
au BufEnter <buffer> set virtualedit+=onemore
|
au BufEnter <buffer> set virtualedit+=onemore
|
||||||
@@ -218,8 +219,10 @@ fun! pencil#init(...) abort
|
|||||||
"setl formatoptions+=r " don't insert comment leader
|
"setl formatoptions+=r " don't insert comment leader
|
||||||
|
|
||||||
if has('conceal') && v:version >= 703
|
if has('conceal') && v:version >= 703
|
||||||
exe ':setl conceallevel=' . g:pencil#conceallevel
|
exe ':setl conceallevel=' .
|
||||||
exe ':setl concealcursor=' . g:pencil#concealcursor
|
\ get(l:args, 'conceallevel', g:pencil#conceallevel)
|
||||||
|
exe ':setl concealcursor=' .
|
||||||
|
\ get(l:args, 'concealcursor', g:pencil#concealcursor)
|
||||||
en
|
en
|
||||||
el
|
el
|
||||||
setl smartindent< nosmartindent<
|
setl smartindent< nosmartindent<
|
||||||
|
|||||||
Reference in New Issue
Block a user