From b8793c75151040b3ecc1f092585abaac989fbd94 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 25 May 2019 20:54:18 +1200 Subject: Drop support for Vim 6.x --- doc/copy_linebreak.txt | 2 +- plugin/copy_linebreak.vim | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/copy_linebreak.txt b/doc/copy_linebreak.txt index 754cccb..0ab5989 100644 --- a/doc/copy_linebreak.txt +++ b/doc/copy_linebreak.txt @@ -1,4 +1,4 @@ -*copy_linebreak.txt* For Vim version 6.0 Last change: 2018 June 27 +*copy_linebreak.txt* For Vim version 7.0 Last change: 2019 May 25 DESCRIPTION *copy_linebreak* diff --git a/plugin/copy_linebreak.vim b/plugin/copy_linebreak.vim index 8b93c24..85c823d 100644 --- a/plugin/copy_linebreak.vim +++ b/plugin/copy_linebreak.vim @@ -8,7 +8,7 @@ if exists('loaded_copy_linebreak') || &compatible finish endif -if !has('linebreak') || v:version < 600 +if v:version < 700 finish endif let loaded_copy_linebreak = 1 -- cgit v1.2.3 From 96eb76cfdab7cdf5f9d4ce6509f4861cbfcdcba2 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 25 May 2019 20:54:59 +1200 Subject: Inline load guard conditionals --- plugin/copy_linebreak.vim | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/plugin/copy_linebreak.vim b/plugin/copy_linebreak.vim index 85c823d..ac0f3cf 100644 --- a/plugin/copy_linebreak.vim +++ b/plugin/copy_linebreak.vim @@ -5,10 +5,7 @@ " Author: Tom Ryder " License: Same as Vim itself " -if exists('loaded_copy_linebreak') || &compatible - finish -endif -if v:version < 700 +if exists('loaded_copy_linebreak') || &compatible || v:version < 700 finish endif let loaded_copy_linebreak = 1 -- cgit v1.2.3 From 809fe73a31478f78788ea9a5f208abc81dcdefd5 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 25 May 2019 20:59:54 +1200 Subject: Move code out to autoload functions --- autoload/copy_linebreak.vim | 31 +++++++++++++++++++++++++++++++ plugin/copy_linebreak.vim | 38 +++----------------------------------- 2 files changed, 34 insertions(+), 35 deletions(-) create mode 100644 autoload/copy_linebreak.vim 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 diff --git a/plugin/copy_linebreak.vim b/plugin/copy_linebreak.vim index ac0f3cf..43018f1 100644 --- a/plugin/copy_linebreak.vim +++ b/plugin/copy_linebreak.vim @@ -10,45 +10,13 @@ if exists('loaded_copy_linebreak') || &compatible || v:version < 700 endif let loaded_copy_linebreak = 1 -" Enable copy-friendly linebreak options -function! s:CopyLinebreakEnable() - setlocal nolinebreak linebreak? - let s:showbreak_save = &showbreak - set showbreak= - if exists('+breakindent') - setlocal nobreakindent - endif -endfunction - -" Disable copy-friendly linebreak options -function! s:CopyLinebreakDisable() - 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! s:CopyLinebreakToggle() - if &linebreak - call s:CopyLinebreakEnable() - else - call s:CopyLinebreakDisable() - endif -endfunction - " Provide mappings to the functions just defined noremap \ (CopyLinebreakEnable) - \ :call CopyLinebreakEnable() + \ :call copy_linebreak#Enable() noremap \ (CopyLinebreakDisable) - \ :call CopyLinebreakDisable() + \ :call copy_linebreak#Disable() noremap \ (CopyLinebreakToggle) - \ :call CopyLinebreakToggle() + \ :call copy_linebreak#Toggle() -- cgit v1.2.3 From da09c821a3f690cfa738306269605e53f4d22a37 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 25 May 2019 21:01:17 +1200 Subject: Add missing mode prefix to maps --- plugin/copy_linebreak.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugin/copy_linebreak.vim b/plugin/copy_linebreak.vim index 43018f1..8089bd7 100644 --- a/plugin/copy_linebreak.vim +++ b/plugin/copy_linebreak.vim @@ -11,12 +11,12 @@ endif let loaded_copy_linebreak = 1 " Provide mappings to the functions just defined -noremap +nnoremap \ (CopyLinebreakEnable) \ :call copy_linebreak#Enable() -noremap +nnoremap \ (CopyLinebreakDisable) \ :call copy_linebreak#Disable() -noremap +nnoremap \ (CopyLinebreakToggle) \ :call copy_linebreak#Toggle() -- cgit v1.2.3 From c4c4ef43629711dc6d124e7ad999c13ec036e7e9 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 25 May 2019 21:02:19 +1200 Subject: Add attribute to maps --- plugin/copy_linebreak.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugin/copy_linebreak.vim b/plugin/copy_linebreak.vim index 8089bd7..76d9228 100644 --- a/plugin/copy_linebreak.vim +++ b/plugin/copy_linebreak.vim @@ -11,12 +11,12 @@ endif let loaded_copy_linebreak = 1 " Provide mappings to the functions just defined -nnoremap +nnoremap \ (CopyLinebreakEnable) \ :call copy_linebreak#Enable() -nnoremap +nnoremap \ (CopyLinebreakDisable) \ :call copy_linebreak#Disable() -nnoremap +nnoremap \ (CopyLinebreakToggle) \ :call copy_linebreak#Toggle() -- cgit v1.2.3 From a1083a07d653fdfaa0bd88c92836bc2a3361f22b Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 25 May 2019 21:03:54 +1200 Subject: Bump VERSION --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index faef31a..3eefcb9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.7.0 +1.0.0 -- cgit v1.2.3