aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2023-03-14 19:53:44 +1300
committerTom Ryder <tom@sanctum.geek.nz>2023-03-14 19:53:44 +1300
commitbc96014f9504d6068a0f53d1679fb7db6ee63cc4 (patch)
treebc36d79c378638138b5088e5cbff04bf666b9a46
parentMerge branch 'release/v1.0.0' (diff)
downloadvim-copy-linebreak-bc96014f9504d6068a0f53d1679fb7db6ee63cc4.tar.gz
vim-copy-linebreak-bc96014f9504d6068a0f53d1679fb7db6ee63cc4.zip
Turn off line/column highlighting options too
This can almost certainly be better-structured.
-rw-r--r--autoload/copy_linebreak.vim18
1 files changed, 18 insertions, 0 deletions
diff --git a/autoload/copy_linebreak.vim b/autoload/copy_linebreak.vim
index 3ea5f1c..8c81133 100644
--- a/autoload/copy_linebreak.vim
+++ b/autoload/copy_linebreak.vim
@@ -1,6 +1,12 @@
" Enable copy-friendly linebreak options
function! copy_linebreak#Enable() abort
setlocal nolinebreak linebreak?
+ let s:colorcolumn_save = &colorcolumn
+ setlocal colorcolumn=
+ let s:cursorcolumn_save = &cursorcolumn
+ setlocal nocursorcolumn
+ let s:cursorline_save = &cursorline
+ setlocal nocursorline
let s:showbreak_save = &showbreak
set showbreak=
if exists('+breakindent')
@@ -11,6 +17,18 @@ endfunction
" Disable copy-friendly linebreak options
function! copy_linebreak#Disable() abort
setlocal linebreak linebreak?
+ if exists('s:colorcolumn_save')
+ let &colorcolumn = s:colorcolumn_save
+ unlet s:colorcolumn_save
+ endif
+ if exists('s:cursorcolumn_save')
+ let &cursorcolumn = s:cursorcolumn_save
+ unlet s:cursorcolumn_save
+ endif
+ if exists('s:cursorline_save')
+ let &cursorline = s:cursorline_save
+ unlet s:cursorline_save
+ endif
if exists('s:showbreak_save')
let &showbreak = s:showbreak_save
unlet s:showbreak_save