Added 'auto' mode indicator to fix #18

An indicator to show that Vim's autoformat is activated while in HardPencil mode.
This commit is contained in:
Reed Esau
2015-09-07 00:19:42 -06:00
parent 632ae63c2c
commit 290b0872d0
2 changed files with 19 additions and 5 deletions

View File

@@ -375,12 +375,22 @@ or if using [bling/vim-airline][va]:
let g:airline_section_x = '%{PencilMode()}' let g:airline_section_x = '%{PencilMode()}'
``` ```
If you dont like the default indicators, you can specify different ones: The default indicators now include auto for when Vims autoformat is
activated in hard line break mode.
```vim ```vim
let g:pencil#mode_indicators = {'hard': '', 'soft': '', 'off': '',} let g:pencil#mode_indicators = {'hard': 'H', 'auto': 'A', 'soft': 'S', 'off': '',}
``` ```
If Unicode is detected, the default indicators are:
```vim
let g:pencil#mode_indicators = {'hard': '␍', 'auto': 'ª', 'soft': '⤸', 'off': '',}
```
If you dont like the default indicators, you can specify your own in
your `.vimrc`.
Note that `PencilMode()` will return blank for buffers in which _pencil_ Note that `PencilMode()` will return blank for buffers in which _pencil_
has not been initialized. has not been initialized.

View File

@@ -31,7 +31,11 @@ fun! PencilMode()
if b:pencil_wrap_mode ==# s:WRAP_MODE_SOFT if b:pencil_wrap_mode ==# s:WRAP_MODE_SOFT
return get(g:pencil#mode_indicators, 'soft', 'S') return get(g:pencil#mode_indicators, 'soft', 'S')
elsei b:pencil_wrap_mode ==# s:WRAP_MODE_HARD elsei b:pencil_wrap_mode ==# s:WRAP_MODE_HARD
if &fo =~ 'a'
return get(g:pencil#mode_indicators, 'auto', 'A')
el
return get(g:pencil#mode_indicators, 'hard', 'H') return get(g:pencil#mode_indicators, 'hard', 'H')
en
el el
return get(g:pencil#mode_indicators, 'off', '') return get(g:pencil#mode_indicators, 'off', '')
en en
@@ -135,9 +139,9 @@ en
if !exists('g:pencil#mode_indicators') if !exists('g:pencil#mode_indicators')
" used to set PencilMode() for statusline " used to set PencilMode() for statusline
if s:unicode_enabled() if s:unicode_enabled()
let g:pencil#mode_indicators = {'hard': '␍', 'soft': '⤸', 'off': '',} let g:pencil#mode_indicators = {'hard': '␍', 'auto': 'ª', 'soft': '⤸', 'off': '',}
el el
let g:pencil#mode_indicators = {'hard': 'H', 'soft': 'S', 'off': '',} let g:pencil#mode_indicators = {'hard': 'H', 'auto': 'A', 'soft': 'S', 'off': '',}
en en
en en