aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-05-25 21:04:07 +1200
committerTom Ryder <tom@sanctum.geek.nz>2019-05-25 21:04:07 +1200
commit6692eef760ccfc2e1b888d1d604e3e1a156fcbc0 (patch)
tree870f4df6f021388a92f47125a005dfc84cdcef45
parent98eb34d4ef603039cd9d5a50e3c4f12fcb943fce (diff)
parenta1083a07d653fdfaa0bd88c92836bc2a3361f22b (diff)
downloadvim-copy-linebreak-master.tar.gz
vim-copy-linebreak-master.zip
Merge branch 'release/v1.0.0'HEADv1.0.0master
* 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
-rw-r--r--VERSION2
-rw-r--r--autoload/copy_linebreak.vim31
-rw-r--r--doc/copy_linebreak.txt2
-rw-r--r--plugin/copy_linebreak.vim49
4 files changed, 40 insertions, 44 deletions
diff --git a/VERSION b/VERSION
index faef31a..3eefcb9 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.7.0
+1.0.0
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/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..76d9228 100644
--- a/plugin/copy_linebreak.vim
+++ b/plugin/copy_linebreak.vim
@@ -5,53 +5,18 @@
" Author: Tom Ryder <tom@sanctum.geek.nz>
" License: Same as Vim itself
"
-if exists('loaded_copy_linebreak') || &compatible
- finish
-endif
-if !has('linebreak') || v:version < 600
+if exists('loaded_copy_linebreak') || &compatible || v:version < 700
finish
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 <silent>
+nnoremap <silent> <unique>
\ <Plug>(CopyLinebreakEnable)
- \ :<C-U>call <SID>CopyLinebreakEnable()<CR>
-noremap <silent>
+ \ :<C-U>call copy_linebreak#Enable()<CR>
+nnoremap <silent> <unique>
\ <Plug>(CopyLinebreakDisable)
- \ :<C-U>call <SID>CopyLinebreakDisable()<CR>
-noremap <silent>
+ \ :<C-U>call copy_linebreak#Disable()<CR>
+nnoremap <silent> <unique>
\ <Plug>(CopyLinebreakToggle)
- \ :<C-U>call <SID>CopyLinebreakToggle()<CR>
+ \ :<C-U>call copy_linebreak#Toggle()<CR>