Additional tweaks for #25

Further improvements to README as well.
This commit is contained in:
Reed Esau
2015-01-10 12:58:15 -07:00
parent ad195ab208
commit 72d0a6d5f7
2 changed files with 14 additions and 8 deletions

View File

@@ -215,7 +215,7 @@ Because auto-detect might not work as intended, you can invoke a command
to set the behavior for the current buffer: to set the behavior for the current buffer:
* `PencilSoft` - initialize _pencil_ with soft line wrap mode * `PencilSoft` - initialize _pencil_ with soft line wrap mode
* `PencilHard` - initialize _pencil_ with hard line break mode (and autoformat) * `PencilHard` - initialize _pencil_ with hard line break mode (and Vims autoformat)
## Automatic formatting ## Automatic formatting
@@ -226,16 +226,17 @@ When inserting text while in *PencilHard* mode, Vims autoformat feature
will be enabled by default and can offer many of the same benefits as will be enabled by default and can offer many of the same benefits as
soft line wrap. soft line wrap.
A useful exception: if used with popular prose-oriented syntax plugins, One useful exception: if used with popular prose-oriented syntax plugins,
_pencil_ will **disable** autoformat when you enter Insert mode from _pencil_ will **disable** autoformat when you enter Insert mode from
inside a code block or table. (See the advanced section below for more inside a code block or table. (See the advanced section below for more
details.) details on the blacklisting feature.)
Where you need to manually enable/disable autoformat, you can do so with a command: Where you need to manually enable/disable autoformat for the current
buffer, you can do so with a command:
* `PFormat` - enables autoformat * `PFormat` - allows autoformat to be enabled (if not blacklisted)
* `PFormatOff` - disables autoformat * `PFormatOff` - prevents autoformat from enabling (blacklist all)
* `PFormatToggle` - toggle to enable if disabled, etc. * `PFormatToggle` - toggle to allow if off, etc.
To set the default behavior, add to your `.vimrc`: To set the default behavior, add to your `.vimrc`:
@@ -466,6 +467,11 @@ let g:pencil#autoformat_blacklist = [
\ ] \ ]
``` ```
_WARNING: the implementation of this blacklist may be changing in the
future._
Theres also a whitelist to override the blacklist. See code for details.
You can override this in your `.vimrc`. Additions to defaults with good You can override this in your `.vimrc`. Additions to defaults with good
use cases are welcome. use cases are welcome.

View File

@@ -103,7 +103,7 @@ fun! s:maybe_enable_autoformat()
" either of which greenlights a whitelist check " either of which greenlights a whitelist check
if !l:found_empty if !l:found_empty
if synstack(l:line, 1) == [] || if synstack(l:line, 1) == [] ||
\ (l:last_col > 2 && synstack(l:line, l:last_col-1) == []) \ (l:last_col > 1 && synstack(l:line, l:last_col-1) == [])
let l:found_empty = 1 let l:found_empty = 1
en en
en en