aboutsummaryrefslogtreecommitdiff
path: root/vim/plugin/copy_linebreak.vim
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-05-28 10:04:35 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-05-28 10:04:35 +1200
commitc90846d8c7918c8650f1f45cd74cf7ec9cf5160b (patch)
tree5462badf3c2ac63c04ffb7f0df09390981bc876f /vim/plugin/copy_linebreak.vim
parentf2e641a399dd5901707905953b1c5db199769835 (diff)
downloaddotfiles-c90846d8c7918c8650f1f45cd74cf7ec9cf5160b.tar.gz
dotfiles-c90846d8c7918c8650f1f45cd74cf7ec9cf5160b.zip
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.
Diffstat (limited to 'vim/plugin/copy_linebreak.vim')
-rw-r--r--vim/plugin/copy_linebreak.vim5
1 files changed, 3 insertions, 2 deletions
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