changed to friendlier command names

This commit is contained in:
Reed Esau
2014-01-07 21:50:19 -07:00
parent 7570b43178
commit e4f00286de
3 changed files with 26 additions and 26 deletions

View File

@@ -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 programmers 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 <silent> <leader>ps :SoftPencil<cr>
nmap <silent> <leader>ph :HardPencil<cr>
nmap <silent> <leader>pn :NoPencil<cr>
nmap <silent> <leader>pp :TogglePencil<cr>
nmap <silent> <leader>pd :DropPencil<cr>
nmap <silent> <leader>pc :ChangePencils<cr>
```
### Automatic formatting
_This autoformat feature affects **HardPencil** mode only._
When using **HardPencil** mode, Vims 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, Vims 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 <silent> <leader>pa :AutoPencil<cr>
nnoremap <silent> <leader>pm :ManualPencil<cr>
nnoremap <silent> <leader>pt :ToggleAutoPencil<cr>
nnoremap <silent> <leader>pp :ShiftPencil<cr>
```
To set the default behavior, add to your `.vimrc`:

View File

@@ -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 <buffer> set formatoptions+=a
autocmd InsertLeave <buffer> set formatoptions-=a

View File

@@ -44,12 +44,12 @@ 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 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 ShiftPencil call pencil#setAutoFormat(-1)
let &cpo = s:save_cpo
unlet s:save_cpo