Skip to content

Commit

Permalink
fix: highlighting is lost when colorscheme is changed
Browse files Browse the repository at this point in the history
New vim restores default highlight links, but fails to do it when there is no default link in the first place.

Without this fix, vim-exchange looses highlighting after `:colorscheme ...`

Relates to vim/vim#6970
  • Loading branch information
habamax committed Dec 16, 2020
1 parent 13d3895 commit e797a21
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions plugin/exchange.vim
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ function! s:get_setting(setting, default)
endfunction

highlight default link ExchangeRegion IncSearch
execute 'highlight default link _exchange_region' (s:enable_highlighting ? 'ExchangeRegion' : 'None')

nnoremap <silent> <expr> <Plug>(Exchange) ':<C-u>set operatorfunc=<SID>exchange_set<CR>'.(v:count1 == 1 ? '' : v:count1).'g@'
vnoremap <silent> <Plug>(Exchange) :<C-u>call <SID>exchange_set(visualmode(), 1)<CR>
Expand Down

0 comments on commit e797a21

Please sign in to comment.