obsidian-vimrc-support icon indicating copy to clipboard operation
obsidian-vimrc-support copied to clipboard

`"+y`, `"+p`, etc. support

Open Craftidore opened this issue 3 years ago • 6 comments

Currently we have the option to always yank, paste, etc. from the system clipboard by adding

set clipboard=unnamed

or

set clipboard=unnamedplus

However, there is no way to make vim work normally, where "+ means system clipboard and without that, CodeMirror Vim just uses it's default buffer.

This is a very very minor quality-of-life feature, so I won't blame you at all if you prioritize basically any other feature over this one.

Craftidore avatar Jul 01 '22 15:07 Craftidore

That's not something that can be implemented here.

https://github.com/esm7/obsidian-vimrc-support/pull/107#issuecomment-1172909748

kometenstaub avatar Jul 02 '22 14:07 kometenstaub

A basic implementation of the plus register is available in codemirror-vim (and also in Obsidian‘s version of it), so this issue can be closed.

kometenstaub avatar Dec 07 '22 09:12 kometenstaub

I can see that it is implemented in obsidian, e.g., "_dd will delete the line without being added to the register or the clipboard for that matter if set clipboard=unnamed. However, how can I add that to a mapping, so d deletes without yanking. I tried nmap/map/noremap d "_d, but it doesn't work.

Thanks in advance!

idr4n avatar Jan 23 '23 20:01 idr4n

+1 to this, I saw in a different thread that noremap is supported, but it isn't working for this specific usecase

imreverse avatar Apr 28 '23 21:04 imreverse

Is there a way to save the content to some random register that I can ignore if nmap d "_d does not work ?

userrand avatar Sep 03 '23 03:09 userrand

For deleting lines (edit: without saving the line to the clipboard), I found a work around that consists of using the "code editor shortcuts" plugin (as with any plugin use at your any risk) and defining dd to run the deleteLine command there. This forced me to unmap d but I can use ctrl+backspace in insert mode for deleting words and accept to use c for everything else with the same issue of it copying to the clipboard.

After installing and enabling the code editor shortcuts plugin

One can add this to their vimrc file

unmap d
exmap delL obcommand obsidian-editor-shortcuts:deleteLine
nmap dd :delL

userrand avatar Jan 20 '24 09:01 userrand