diff options
Diffstat (limited to 'vim/plugin/copy_linebreak.vim')
-rw-r--r-- | vim/plugin/copy_linebreak.vim | 50 |
1 files changed, 27 insertions, 23 deletions
diff --git a/vim/plugin/copy_linebreak.vim b/vim/plugin/copy_linebreak.vim index 5c8d5f77..faeb1617 100644 --- a/vim/plugin/copy_linebreak.vim +++ b/vim/plugin/copy_linebreak.vim @@ -6,32 +6,36 @@ " Author: Tom Ryder <tom@sanctum.geek.nz> " License: Same as Vim itself " -if has('eval') +if exists('g:loaded_copy_linebreak') + \ || !has('linebreak') + \ || &compatible + finish +endif +let g:loaded_copy_linebreak = 1 - " Define function - function! s:CopyLinebreak() +" 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 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 + " If it's off, turn it on + else + setlocal linebreak linebreak? + setlocal showbreak< + if exists('&breakindent') + setlocal breakindent endif + endif - endfunction +endfunction - " Provide mapping proxy to the function just defined - noremap <silent> <unique> - \ <Plug>CopyLinebreak - \ :<C-U>call <SID>CopyLinebreak()<CR> -endif +" Provide mapping proxy to the function just defined +noremap <silent> <unique> + \ <Plug>CopyLinebreak + \ :<C-U>call <SID>CopyLinebreak()<CR> |