blob: faeb161752d6c9f47f41065895507eb17a8a21d2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
"
" Bind a user-defined key sequence to turn off linebreak and toggle the
" showbreak characters and breakindent mode on and off, for convenience of
" copying multiple lines from terminal emulators.
"
" Author: Tom Ryder <tom@sanctum.geek.nz>
" License: Same as Vim itself
"
if exists('g:loaded_copy_linebreak')
\ || !has('linebreak')
\ || &compatible
finish
endif
let g:loaded_copy_linebreak = 1
" Define function
function! s:CopyLinebreak()
" If linebreak is on, turn it off
if &l:linebreak
setlocal nolinebreak linebreak?
setlocal showbreak=
if exists('&breakindent')
setlocal nobreakindent
endif
" If it's off, turn it on
else
setlocal linebreak linebreak?
setlocal showbreak<
if exists('&breakindent')
setlocal breakindent
endif
endif
endfunction
" Provide mapping proxy to the function just defined
noremap <silent> <unique>
\ <Plug>CopyLinebreak
\ :<C-U>call <SID>CopyLinebreak()<CR>
|