From 28453d703825ba4c93869ba1ee1d38a6f281d7d3 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Tue, 11 Jun 2019 09:45:53 +0200 Subject: [PATCH] Support Multiple Cursor mode Detect the use of plugin https://github.com/mg979/vim-visual-multi and show mode "MULTI" when it is active. closes #1933 --- CHANGELOG.md | 1 + autoload/airline.vim | 6 +++++- autoload/airline/init.vim | 1 + doc/airline.txt | 36 +++++++++++++++++++----------------- 4 files changed, 26 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d4c7bb01..8131b4ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ This is the Changelog for the vim-airline project. recreating the highlighting groups (which might have a serious performance impact if done very often, as might be the case when the configuration variable `airline_skip_empty_sections` is active). + - airline can now also detect multiple cursor mode (issue #1933) ## [0.10] - 2018-12-15 - New features diff --git a/autoload/airline.vim b/autoload/airline.vim index 87d6020c..27a8646d 100644 --- a/autoload/airline.vim +++ b/autoload/airline.vim @@ -226,7 +226,11 @@ function! airline#check_mode(winnr) else let l:mode = ['normal'] endif - if index(['Rv', 'no', 'ni', 'ix', 'ic'], l:m) == -1 + if exists("*VMInfos") && !empty(VMInfos()) + " Vim plugin Multiple Cursors https://github.com/mg979/vim-visual-multi + let l:m = 'multi' + endif + if index(['Rv', 'no', 'ni', 'ix', 'ic', 'multi'], l:m) == -1 let l:m = l:m[0] endif let w:airline_current_mode = get(g:airline_mode_map, l:m, l:m) diff --git a/autoload/airline/init.vim b/autoload/airline/init.vim index 095155ca..1a684892 100644 --- a/autoload/airline/init.vim +++ b/autoload/airline/init.vim @@ -40,6 +40,7 @@ function! airline#init#bootstrap() \ 'i' : 'INSERT', \ 'ic' : 'INSERT COMPL', \ 'ix' : 'INSERT COMPL', + \ 'multi' : 'MULTI', \ 'n' : 'NORMAL', \ 'ni' : '(INSERT)', \ 'no' : 'OP PENDING', diff --git a/doc/airline.txt b/doc/airline.txt index f57ffd31..00977920 100644 --- a/doc/airline.txt +++ b/doc/airline.txt @@ -176,24 +176,26 @@ values): " or copy paste the following into your vimrc for shortform text let g:airline_mode_map = { - \ '__' : '-', - \ 'c' : 'C', - \ 'i' : 'I', - \ 'ic' : 'I', - \ 'ix' : 'I', - \ 'n' : 'N', - \ 'ni' : 'N', - \ 'no' : 'N', - \ 'R' : 'R', - \ 'Rv' : 'R', - \ 's' : 'S', - \ 'S' : 'S', - \ '' : 'S', - \ 't' : 'T', - \ 'v' : 'V', - \ 'V' : 'V', - \ '' : 'V', + \ '__' : '-', + \ 'c' : 'C', + \ 'i' : 'I', + \ 'ic' : 'I', + \ 'ix' : 'I', + \ 'n' : 'N', + \ 'multi' : 'M', + \ 'ni' : 'N', + \ 'no' : 'N', + \ 'R' : 'R', + \ 'Rv' : 'R', + \ 's' : 'S', + \ 'S' : 'S', + \ '' : 'S', + \ 't' : 'T', + \ 'v' : 'V', + \ 'V' : 'V', + \ '' : 'V', \ } + Note: 'multi' is for displaying the multiple cursor mode < * define the set of filename match queries which excludes a window from having its statusline modified >