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: 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 * Configures wrap mode for buffer, auto-detecting via modeline if present
* Adjusts navigation key mappings to suit the wrap mode * Adjusts navigation key mappings to suit the wrap mode
* For hard line break mode, enables Insert-mode only autoformat * 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 While programmers will extol the many virtues of Vim in writing code, few
will appreciate its powerful text manipulation capabilities for writing will appreciate its powerful text manipulation capabilities for writing
documentation and prose. But with plenty of word processing tools 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? a programmers editor like Vim for writing?
There are good reasons NOT to use 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 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:
* `SoftPencil` - configure for the soft wrapping of very long lines * `SoftPencil` - mode for soft line wrapping
* `HardPencil` - configure for line endings with hard line breaks * `HardPencil` - mode for hard line breaks
* `TogglePencil` - if off, enables with detection; if on, turns off * `ChangePencils` - if off, enables with detection; if on, turns off
* `NoPencil` - removes navigation mappings and restores buffer to global settings * `DropPencil` - removes navigation mappings and restores buffer to global settings
Optionally, you can map to keys in your `.vimrc`: Optionally, you can map to keys in your `.vimrc`:
```vim ```vim
nmap <silent> <leader>ps :SoftPencil<cr> nmap <silent> <leader>ps :SoftPencil<cr>
nmap <silent> <leader>ph :HardPencil<cr> nmap <silent> <leader>ph :HardPencil<cr>
nmap <silent> <leader>pn :NoPencil<cr> nmap <silent> <leader>pd :DropPencil<cr>
nmap <silent> <leader>pp :TogglePencil<cr> nmap <silent> <leader>pc :ChangePencils<cr>
``` ```
### Automatic formatting ### Automatic formatting
_This autoformat feature affects **HardPencil** mode only._ _This autoformat feature affects **HardPencil** mode only._
When using **HardPencil** mode, Vims autoformat feature will be enabled When in **HardPencil** mode, Vims autoformat feature will be enabled by
by default and can offer many of the same benefits as soft wrapping lines. default and can offer many of the same benefits as soft line wrapping. But
But autoformat can cause havoc when editing anything but paragraphs of autoformat can cause havoc when editing anything but paragraphs of words,
words, such as a table or code block. In these cases you will need to such as a code block or table. In these cases you will need to disable it,
disable it, at least temporarily, via a command: at least temporarily, via a command:
* `AutoPencil` - enables autoformat * `AutoPencil` - enables autoformat
* `ManualPencil` - disables autoformat * `ManualPencil` - disables autoformat
* `ToggleAutoPencil` - enables if disabled, etc. * `ShiftPencil` - enables if disabled, etc.
Or optionally map to keys in your `.vimrc`: Or optionally map to keys in your `.vimrc`:
```vim ```vim
nnoremap <silent> <leader>pa :AutoPencil<cr> nnoremap <silent> <leader>pa :AutoPencil<cr>
nnoremap <silent> <leader>pm :ManualPencil<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`: To set the default behavior, add to your `.vimrc`:

View File

@@ -43,11 +43,11 @@ endfunction
function! pencil#setAutoFormat(mode) function! pencil#setAutoFormat(mode)
" 1=auto, 0=manual, -1=toggle " 1=auto, 0=manual, -1=toggle
if !exists('b:lastAF') if !exists('b:last_autoformat')
let b:lastAF = 0 let b:last_autoformat = 0
endif endif
let b:lastAF = a:mode == -1 ? !b:lastAF : a:mode let b:last_autoformat = a:mode == -1 ? !b:last_autoformat : a:mode
if b:lastAF if b:last_autoformat
augroup pencil_autoformat augroup pencil_autoformat
autocmd InsertEnter <buffer> set formatoptions+=a autocmd InsertEnter <buffer> set formatoptions+=a
autocmd InsertLeave <buffer> set formatoptions-=a autocmd InsertLeave <buffer> set formatoptions-=a

View File

@@ -42,14 +42,14 @@ if !exists('g:pencil#cursorwrap')
endif endif
" # Commands " # Commands
command -nargs=0 HardPencil call pencil#init({'wrap': 'hard'}) command -nargs=0 HardPencil call pencil#init({'wrap': 'hard'})
command -nargs=0 SoftPencil call pencil#init({'wrap': 'soft'}) command -nargs=0 SoftPencil call pencil#init({'wrap': 'soft'})
command -nargs=0 NoPencil call pencil#init({'wrap': 'off' }) command -nargs=0 DropPencil call pencil#init({'wrap': 'off' })
command -nargs=0 TogglePencil call pencil#init({'wrap': 'toggle'}) command -nargs=0 ChangePencils call pencil#init({'wrap': 'toggle'})
command -nargs=0 AutoPencil call pencil#setAutoFormat(1) command -nargs=0 AutoPencil call pencil#setAutoFormat(1)
command -nargs=0 ManualPencil call pencil#setAutoFormat(0) 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 let &cpo = s:save_cpo
unlet s:save_cpo unlet s:save_cpo