From c90846d8c7918c8650f1f45cd74cf7ec9cf5160b Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 28 May 2018 10:04:35 +1200 Subject: Use script variable to keep showbreak setting The 'showbreak' option is global and has no local value--that is, it's not global-local--so `setlocal` actually just changes the global value, and hence we can't "change back" using `setlocal showbreak<`. Instead, keep the "normal" value in a script variable so that we can reliably switch back to it. This surprised me, as I had thought it was working, but I can't find even an older Vim that behaves the way I expected it too. I suppose I must just not have changed back often enough to actually notice. --- vim/plugin/copy_linebreak.vim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'vim/plugin/copy_linebreak.vim') diff --git a/vim/plugin/copy_linebreak.vim b/vim/plugin/copy_linebreak.vim index 9d241d5a..0924134c 100644 --- a/vim/plugin/copy_linebreak.vim +++ b/vim/plugin/copy_linebreak.vim @@ -17,7 +17,8 @@ let g:loaded_copy_linebreak = 1 " Enable copy-friendly linebreak options function! s:CopyLinebreakEnable() setlocal nolinebreak linebreak? - setlocal showbreak= + let s:showbreak = &showbreak + set showbreak= if exists('+breakindent') setlocal nobreakindent endif @@ -26,7 +27,7 @@ endfunction " Disable copy-friendly linebreak options function! s:CopyLinebreakDisable() setlocal linebreak linebreak? - setlocal showbreak< + let &showbreak = s:showbreak if exists('+breakindent') setlocal breakindent< endif -- cgit v1.2.3