I just saw your edit. You are saying that copying doesn’t work at all for you, in Insert Mode?
Also, if you reply, please make sure to use the correct terms so everything can be clear. Regular copying is called Copy. In Vim, it is called Yanking, and it goes to Vim registers, not to your system clipboard. (In Obsidian, as of now.)
No. As far as I know, there have been no changes to any features with regards to the Vim bindings in Obsidian.
As far as I can tell, it is simply provided through Code Mirror’s Vim bindings, and that is not being developed on the Code Mirror side.
The workaround right now - if you want to use your system clipboard - is to use Copy, rather than Yanking. You can Copy just fine in Normal Mode, and it copies to the system clipboard. You can even Copy when using a Visual selection in Vim mode.
I’ll say it again to be clear: If you are actually having trouble Copying (Ctrl-C), please specifically say so. Copying (Ctrl-C) should work. Yanking (y, etc.) will not go to the system clipboard. Copying should.
Are you saying that Ctrl-C does not work for you in Vim Normal mode? It does for me, by default without any workaround. (MacOS, every version of Obsidian I’ve tested.)
No one has said specifically yet, so I’ll ask again for emphasis: @santi Does Ctrl-C copy not work for you in Vim Normal mode?
(Maybe we’re working off different assumptions if it only works in Mac and no other OS?)
yes!!! that’s amazing I don’t know why I didn’t try that already. I was getting used to putting it in the console. This is perfect thanks for the tip, this just made my day!
@blairfrandeen I just realized that unmap <C-c> eventhough it works, it shows a constant annoying error at the end of the screen, when using regular obsidian shortcuts. such as “navigate back”
any ideas on how to avoid the error from showing, while still making ctrl+c work like normal in obsidian with vim mode? Thanks!
I noticed this too, and had to remove the line that I stated above from my .vimrc file. My workaround for now is to simply type the command in normal mode when I start Obsidian–type : to get to the Vim console, and then unmap <C-c> to have the same effect.
I think the issue stems from the way the vim extension plugin is written, in that it seems to run the commands every time a note is brought into focus. I took a look at the source code but I’m not proficient enough in TypeScript or the CodeMirror Vim module to implement a more effective fix. Looks like you’ve already raised the issue on Github, thank you for doing that.
thanks for the help @blairfrandeen and for contributing to that GitHub issue.
Just for a quick summary for anyone else who might find this post and wants to achieve regular ctrl+c shortcut while in vim mode.
Everything works great now thanks to @esm90, the shortcut ctrl+c works without any error mesages from version 0.1.1 of the community plugin “vimrc support” by putting unmap <C-c>
in the .obsidian.vimrc file which is a hidden file (dot file) located in your vault
I’d like to add to what others have said, the specific behavior of Ctrl+C on Windows and Linux is that it does nothing in normal mode, and in insert mode it exits back to normal mode without copying to the system clipboard.
Even with the unmap <C-c> fix, copying is fixed in normal mode but in insert mode it still exits to normal mode without copying.
As an alternative (or addition) to unmap <C-c>, one can set clipboard=unnamed to yank to system clipboard. It still requires the obsidian-vimrc plugin.
I find it pretty annoying that I can’t yank to the system clipboard with "*y. I don’t want to destroy my clipboard any time I yank, delete, etc. in codemirror. Anyone have a workaround for this?
Oddly enough, in Win 10, if you select some text in Obsidian, right click, and then choose “Copy” from the popup menu, that works perfectly well in Windows. It is only the keystroke that is screwed up. I suspect another workaround would be an Autohotkey macro that sent the right-click copy sequence to an Obsidian window. That ought to work in both insert and normal mode.