" 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