diff --git a/autoload/SpaceVim/layers/core/statusline.vim b/autoload/SpaceVim/layers/core/statusline.vim index 0b5e1d7bb..1f055dc07 100644 --- a/autoload/SpaceVim/layers/core/statusline.vim +++ b/autoload/SpaceVim/layers/core/statusline.vim @@ -53,7 +53,7 @@ let s:modes = { \ }, \ } -let s:loaded_sections = ['syntax checking', 'major mode', 'minor mode lighters', 'version control info'] +let s:loaded_sections = ['syntax checking', 'major mode', 'minor mode lighters', 'version control info', 'cursorpos'] function! s:battery_status() abort if executable('acpi') @@ -156,6 +156,10 @@ function! s:whitespace() abort endif endfunction +function! s:cursorpos() abort + return ' %l:%c ' +endfunction + function! s:modes() abort let m = ' ❖ ' @@ -240,7 +244,10 @@ function! s:active() abort if index(s:loaded_sections, 'battery status') != -1 call add(rsec, s:battery_status()) endif - call add(rsec, '%{" " . &ff . "|" . (&fenc!=""?&fenc:&enc) . " "}') + call add(rsec, '%{" " . &ff . " | " . (&fenc!=""?&fenc:&enc) . " "}') + if index(s:loaded_sections, 'cursorpos') != -1 + call add(rsec, s:cursorpos()) + endif call add(rsec, ' %P ') if index(s:loaded_sections, 'time') != -1 call add(rsec, s:time()) @@ -343,6 +350,8 @@ function! SpaceVim#layers#core#statusline#config() abort \ 'toggle the battery status', 1) call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 't'], 'call SpaceVim#layers#core#statusline#toggle_section("time")', \ 'toggle the time', 1) + call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'p'], 'call SpaceVim#layers#core#statusline#toggle_section("cursorpos")', + \ 'toggle the cursor position', 1) call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'T'], 'if &laststatus == 2 | let &laststatus = 0 | else | let &laststatus = 2 | endif', \ 'toggle the statuline itself', 1) function! TagbarStatusline(...) abort diff --git a/docs/documentation.md b/docs/documentation.md index e6079bf4e..a52b2ee71 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -397,7 +397,7 @@ Key Binding | Description `SPC t m m` | toggle the minor mode lighters `SPC t m M` | toggle the major mode `SPC t m n` | toggle the cat! (if colors layer is declared in your dotfile) -`SPC t m p` | toggle the point character position +`SPC t m p` | toggle the cursor position `SPC t m t` | toggle the time `SPC t m T` | toggle the mode line itself `SPC t m v` | toggle the version control info