mirror of
https://github.com/preservim/vim-pencil.git
synced 2025-11-14 04:43:47 -05:00
command names now friendlier
This commit is contained in:
@@ -87,18 +87,18 @@ But for files of type `text`, it will *always* use hard line endings.
|
|||||||
Because auto-detect doesn’t always work correctly, you can invoke commands
|
Because auto-detect doesn’t always work correctly, you can invoke commands
|
||||||
to set the behavior for the current buffer:
|
to set the behavior for the current buffer:
|
||||||
|
|
||||||
* `PencilSoft` - configure for soft wrapping
|
* `SoftPencil` - configure for soft wrapping
|
||||||
* `PencilHard` - configure for hard line endings
|
* `HardPencil` - configure for hard line endings
|
||||||
* `PencilToggle` - if off, enables with detection; if on, turns off
|
* `TogglePencil` - if off, enables with detection; if on, turns off
|
||||||
* `PencilOff` - removing mappings and restore global settings
|
* `NoPencil` - removing mappings and restore 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>ws :PencilSoft<cr>
|
nmap <silent> <leader>ps :SoftPencil<cr>
|
||||||
nmap <silent> <leader>wh :PencilHard<cr>
|
nmap <silent> <leader>ph :HardPencil<cr>
|
||||||
nmap <silent> <leader>ww :PencilToggle<cr>
|
nmap <silent> <leader>pn :NoPencil<cr>
|
||||||
nmap <silent> <leader>w0 :PencilOff<cr>
|
nmap <silent> <leader>pp :TogglePencil<cr>
|
||||||
```
|
```
|
||||||
|
|
||||||
Also, more commands in ‘Automatic Formatting’ below.
|
Also, more commands in ‘Automatic Formatting’ below.
|
||||||
@@ -146,16 +146,16 @@ augroup END
|
|||||||
|
|
||||||
You can also toggle it as needed with a command:
|
You can also toggle it as needed with a command:
|
||||||
|
|
||||||
* `PencilFormatAuto` - enables autoformat
|
* `AutoPencil` - enables autoformat
|
||||||
* `PencilFormatManual` - disables autoformat
|
* `ManualPencil` - disables autoformat
|
||||||
* `PencilFormatToggle`
|
* `ToggleAutoPencil` - enables if disabled, etc.
|
||||||
|
|
||||||
Or bind to keys in your `.vimrc`:
|
Or bind to keys in your `.vimrc`:
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
nmap <silent> <leader>wa :PencilFormatAuto<cr>
|
nmap <silent> <leader>pa :AutoPencil<cr>
|
||||||
nmap <silent> <leader>wm :PencilFormatManual<cr>
|
nmap <silent> <leader>pm :ManualPencil<cr>
|
||||||
nmap <silent> <leader>wf :PencilFormatToggle<cr>
|
nmap <silent> <leader>pt :ToggleAutoPencil<cr>
|
||||||
```
|
```
|
||||||
|
|
||||||
Again, when using soft line wrapping, Vim’s autoformat feature does not
|
Again, when using soft line wrapping, Vim’s autoformat feature does not
|
||||||
|
|||||||
@@ -36,14 +36,14 @@ if !exists('g:pencil#joinspaces')
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
" # Commands
|
" # Commands
|
||||||
command -nargs=0 PencilHard call pencil#init({'wrap': 'hard'})
|
command -nargs=0 HardPencil call pencil#init({'wrap': 'hard'})
|
||||||
command -nargs=0 PencilSoft call pencil#init({'wrap': 'soft'})
|
command -nargs=0 SoftPencil call pencil#init({'wrap': 'soft'})
|
||||||
command -nargs=0 PencilOff call pencil#init({'wrap': 'off' })
|
command -nargs=0 NoPencil call pencil#init({'wrap': 'off' })
|
||||||
command -nargs=0 PencilToggle call pencil#init({'wrap': 'toggle' })
|
command -nargs=0 TogglePencil call pencil#init({'wrap': 'toggle'})
|
||||||
|
|
||||||
command -nargs=0 PencilFormatAuto call pencil#setAutoFormat(1)
|
command -nargs=0 AutoPencil call pencil#setAutoFormat(1)
|
||||||
command -nargs=0 PencilFormatManual call pencil#setAutoFormat(0)
|
command -nargs=0 ManualPencil call pencil#setAutoFormat(0)
|
||||||
command -nargs=0 PencilFormatToggle call pencil#setAutoFormat(-1)
|
command -nargs=0 ToggleAutoPencil call pencil#setAutoFormat(-1)
|
||||||
|
|
||||||
let &cpo = s:save_cpo
|
let &cpo = s:save_cpo
|
||||||
unlet s:save_cpo
|
unlet s:save_cpo
|
||||||
|
|||||||
Reference in New Issue
Block a user