svermeulen / vim-easyclip

Simplified clipboard functionality for Vim
693 stars 21 forks source link

EasyClipUseGlobalPasteToggle should be listed in the documentation #78

Closed agilmor closed 8 years ago

agilmor commented 8 years ago

Hi!

I have my own pastetoggle map and it stop working when sing EasyClip. I've grepped a little bit in the code and I've found the EasyClipUseGlobalPasteToggle variable with a very nice info:

" Always toggle to 'paste mode' before pasting in insert mode
" We have two methods of doing this here, both with different advantages/disadvantages
" The first modifies the global value for pastetoggle, which may be undesirable if you want to bind
" pastetoggle to something yourself
" The second avoids the need to set the global pastetoggle but leaves insert mode briefly, which can
" cause the indentation level to change sometimes (for eg. when hitting 'o' then immediately doing CTRL+V to paste something)
if get(g:, 'EasyClipUseGlobalPasteToggle', 1)
    set pastetoggle=<plug>PasteToggle
    imap <expr> <plug>EasyClipInsertModePaste '<plug>PasteToggle<C-r>' . EasyClip#GetDefaultReg() . '<plug>PasteToggle'
else
    inoremap <expr> <plug>EasyClipInsertModePaste '<c-o>:setl paste<cr><c-r>' . EasyClip#GetDefaultReg() . '<c-o>:setl nopaste<cr>'
endif

I've let g:EasyClipUseGlobalPasteToggle = 0 and everything worked again like a chram. So, may be we should move/copy some of he above info in the main documentation to avoid more greppings? ;-)

Thanks for this really helpful plugin!

Albert

svermeulen commented 8 years ago

Hey, no problem, glad to hear that you've benefited from the plugin.

You're right, that should be documented. I've added a note about it to the readme in the section where it talks about insert mode paste. Thanks!