From bfb5444c3477534c8f2c59699b609fed15b88e20 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sat, 23 Apr 2022 16:50:28 +0800 Subject: [PATCH] feat(major_mode): add wrap line major mode icon --- autoload/SpaceVim/layers/core/statusline.vim | 5 +++++ autoload/SpaceVim/layers/ui.vim | 8 +++++++- docs/documentation.md | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/autoload/SpaceVim/layers/core/statusline.vim b/autoload/SpaceVim/layers/core/statusline.vim index 56d502941..09d077742 100644 --- a/autoload/SpaceVim/layers/core/statusline.vim +++ b/autoload/SpaceVim/layers/core/statusline.vim @@ -97,6 +97,11 @@ let s:modes = { \ 'icon_asc' : 'w', \ 'desc' : 'whitespace mode', \ }, + \ 'wrapline' :{ + \ 'icon' : s:MESSLETTERS.circled_letter('W'), + \ 'icon_asc' : 'W', + \ 'desc' : 'wrap line mode', + \ }, \ } if SpaceVim#layers#isLoaded('checkers') diff --git a/autoload/SpaceVim/layers/ui.vim b/autoload/SpaceVim/layers/ui.vim index 7df88791f..ed35fb966 100644 --- a/autoload/SpaceVim/layers/ui.vim +++ b/autoload/SpaceVim/layers/ui.vim @@ -275,7 +275,8 @@ function! SpaceVim#layers#ui#config() abort call SpaceVim#mapping#space#def('nnoremap', ['t', 'l'], 'setlocal list!', \ 'toggle-hidden-listchars', 1) - call SpaceVim#mapping#space#def('nnoremap', ['t', 'W'], 'setlocal wrap!', + call SpaceVim#mapping#space#def('nnoremap', ['t', 'W'], 'call call(' + \ . string(s:_function('s:toggle_wrap_line')) . ', [])', \ 'toggle-wrap-line', 1) call SpaceVim#mapping#space#def('nnoremap', ['t', 'w'], 'call call(' \ . string(s:_function('s:toggle_whitespace')) . ', [])', @@ -476,6 +477,11 @@ function! s:toggle_whitespace() abort call SpaceVim#layers#core#statusline#toggle_mode('whitespace') endfunction +function! s:toggle_wrap_line() abort + setlocal wrap! + call SpaceVim#layers#core#statusline#toggle_mode('wrapline') +endfunction + function! s:toggle_conceallevel() abort if &conceallevel == 0 setlocal conceallevel=2 diff --git a/docs/documentation.md b/docs/documentation.md index b3c3fe0f0..9f345b12e 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -723,6 +723,7 @@ The letters displayed in the statusline correspond to the key bindings used to t | `SPC t s` | ⓢ | s | syntax checking (neomake) | | `SPC t S` | Ⓢ | S | enabled in spell checking | | `SPC t w` | ⓦ | w | whitespace mode (highlight trailing whitespace) | +| `SPC t W` | Ⓦ | W | wrap line mode | **colorscheme of statusline:**