diff --git a/README.markdown b/README.markdown index cb08c09..64c6aba 100644 --- a/README.markdown +++ b/README.markdown @@ -8,7 +8,7 @@ This plugin focuses on the fundamentals of word processing in Vim: -* Use for editing text, markdown, textile, and other file types. +* Use for editing text, markdown, textile, and other file types * Configures wrap mode for buffer, auto-detecting via modeline if present * Adjusts navigation key mappings to suit the wrap mode * For hard line break mode, enables Insert-mode only autoformat @@ -27,7 +27,7 @@ environment by installing those plugins that meet your specific needs. While programmers will extol the many virtues of Vim in writing code, few will appreciate its powerful text manipulation capabilities for writing documentation and prose. But with plenty of word processing tools -available, including those which specifically cater to writers, why use +available, including those that specifically cater to writers, why use a programmer’s editor like Vim for writing? There are good reasons NOT to use Vim for writing: @@ -86,40 +86,40 @@ But for files of type `text`, it will *always* use hard line endings. Because auto-detect might not work as intended, you can invoke a command to set the behavior for the current buffer: -* `SoftPencil` - configure for the soft wrapping of very long lines -* `HardPencil` - configure for line endings with hard line breaks -* `TogglePencil` - if off, enables with detection; if on, turns off -* `NoPencil` - removes navigation mappings and restores buffer to global settings +* `SoftPencil` - mode for soft line wrapping +* `HardPencil` - mode for hard line breaks +* `ChangePencils` - if off, enables with detection; if on, turns off +* `DropPencil` - removes navigation mappings and restores buffer to global settings Optionally, you can map to keys in your `.vimrc`: ```vim nmap ps :SoftPencil nmap ph :HardPencil -nmap pn :NoPencil -nmap pp :TogglePencil +nmap pd :DropPencil +nmap pc :ChangePencils ``` ### Automatic formatting _This ‘autoformat’ feature affects **HardPencil** mode only._ -When using **HardPencil** mode, Vim’s autoformat feature will be enabled -by default and can offer many of the same benefits as soft wrapping lines. -But autoformat can cause havoc when editing anything but paragraphs of -words, such as a table or code block. In these cases you will need to -disable it, at least temporarily, via a command: +When in **HardPencil** mode, Vim’s autoformat feature will be enabled by +default and can offer many of the same benefits as soft line wrapping. But +autoformat can cause havoc when editing anything but paragraphs of words, +such as a code block or table. In these cases you will need to disable it, +at least temporarily, via a command: * `AutoPencil` - enables autoformat * `ManualPencil` - disables autoformat -* `ToggleAutoPencil` - enables if disabled, etc. +* `ShiftPencil` - enables if disabled, etc. Or optionally map to keys in your `.vimrc`: ```vim nnoremap pa :AutoPencil nnoremap pm :ManualPencil -nnoremap pt :ToggleAutoPencil +nnoremap pp :ShiftPencil ``` To set the default behavior, add to your `.vimrc`: diff --git a/autoload/pencil.vim b/autoload/pencil.vim index ce153e2..d81b240 100644 --- a/autoload/pencil.vim +++ b/autoload/pencil.vim @@ -43,11 +43,11 @@ endfunction function! pencil#setAutoFormat(mode) " 1=auto, 0=manual, -1=toggle - if !exists('b:lastAF') - let b:lastAF = 0 + if !exists('b:last_autoformat') + let b:last_autoformat = 0 endif - let b:lastAF = a:mode == -1 ? !b:lastAF : a:mode - if b:lastAF + let b:last_autoformat = a:mode == -1 ? !b:last_autoformat : a:mode + if b:last_autoformat augroup pencil_autoformat autocmd InsertEnter set formatoptions+=a autocmd InsertLeave set formatoptions-=a diff --git a/plugin/pencil.vim b/plugin/pencil.vim index eae82f8..685ee6a 100644 --- a/plugin/pencil.vim +++ b/plugin/pencil.vim @@ -42,14 +42,14 @@ if !exists('g:pencil#cursorwrap') endif " # Commands -command -nargs=0 HardPencil call pencil#init({'wrap': 'hard'}) -command -nargs=0 SoftPencil call pencil#init({'wrap': 'soft'}) -command -nargs=0 NoPencil call pencil#init({'wrap': 'off' }) -command -nargs=0 TogglePencil call pencil#init({'wrap': 'toggle'}) +command -nargs=0 HardPencil call pencil#init({'wrap': 'hard'}) +command -nargs=0 SoftPencil call pencil#init({'wrap': 'soft'}) +command -nargs=0 DropPencil call pencil#init({'wrap': 'off' }) +command -nargs=0 ChangePencils call pencil#init({'wrap': 'toggle'}) -command -nargs=0 AutoPencil call pencil#setAutoFormat(1) -command -nargs=0 ManualPencil call pencil#setAutoFormat(0) -command -nargs=0 ToggleAutoPencil call pencil#setAutoFormat(-1) +command -nargs=0 AutoPencil call pencil#setAutoFormat(1) +command -nargs=0 ManualPencil call pencil#setAutoFormat(0) +command -nargs=0 ShiftPencil call pencil#setAutoFormat(-1) let &cpo = s:save_cpo unlet s:save_cpo