blob: 3ea5f1c70ced46888037961e09a8cb3c52005675 (
plain) (
tree)
|
|
" Enable copy-friendly linebreak options
function! copy_linebreak#Enable() abort
setlocal nolinebreak linebreak?
let s:showbreak_save = &showbreak
set showbreak=
if exists('+breakindent')
setlocal nobreakindent
endif
endfunction
" Disable copy-friendly linebreak options
function! copy_linebreak#Disable() abort
setlocal linebreak linebreak?
if exists('s:showbreak_save')
let &showbreak = s:showbreak_save
unlet s:showbreak_save
endif
if exists('+breakindent')
setlocal breakindent<
endif
endfunction
" Toggle copy-friendly linebreak options, using the current setting for the
" 'linebreak' option as the pivot
function! copy_linebreak#Toggle() abort
if &linebreak
call copy_linebreak#Enable()
else
call copy_linebreak#Disable()
endif
endfunction
|