diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2019-05-25 21:04:07 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2019-05-25 21:04:07 +1200 |
commit | 6692eef760ccfc2e1b888d1d604e3e1a156fcbc0 (patch) | |
tree | 870f4df6f021388a92f47125a005dfc84cdcef45 /autoload/copy_linebreak.vim | |
parent | Merge branch 'release/v0.7.0' (diff) | |
parent | Bump VERSION (diff) | |
download | vim-copy-linebreak-6692eef760ccfc2e1b888d1d604e3e1a156fcbc0.tar.gz vim-copy-linebreak-6692eef760ccfc2e1b888d1d604e3e1a156fcbc0.zip |
Merge branch 'release/v1.0.0'v1.0.0
* release/v1.0.0:
Add <unique> attribute to maps
Add missing mode prefix to maps
Move code out to autoload functions
Inline load guard conditionals
Drop support for Vim 6.x
Diffstat (limited to 'autoload/copy_linebreak.vim')
-rw-r--r-- | autoload/copy_linebreak.vim | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/autoload/copy_linebreak.vim b/autoload/copy_linebreak.vim new file mode 100644 index 0000000..3ea5f1c --- /dev/null +++ b/autoload/copy_linebreak.vim @@ -0,0 +1,31 @@ +" 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 |