esm7 / obsidian-vimrc-support

A plugin for the Obsidian.md note-taking software
MIT License
1.07k stars 47 forks source link

Feature Request: <esc> key mapping #18

Open Gatongone opened 3 years ago

Gatongone commented 3 years ago

Thank you for your nice plugin.

I found that the key cannot be mapped during the process of using the plugin.

I am personally used to map the switch of Normal mode and Insert mode to the key.

Can you support the mapping of the key?

LostLaplace commented 3 years ago

FYI I've found that while mapping to <ESC> does not work, mapping to <C-[> does. I've also found that while inoremap isn't working properly, imap is.

esm7 commented 3 years ago

It's probably a CodeMirror limitation and maybe I can work around it, I'll look into it when I get a few hours to work on the plugin.

velixor commented 3 years ago

FYI I've found that while mapping to <ESC> does not work, mapping to <C-[> does. I've also found that while inoremap isn't working properly, imap is.

I think it's CodeMirror limitations. For example, instead of <ESC> try use <Esc>. https://github.com/codemirror/CodeMirror/blob/58bb622cfc210af2c1adcd50a55971fd0d631bfb/keymap/vim.js#L63

About inoremap , there just no such mapping https://github.com/codemirror/CodeMirror/blob/58bb622cfc210af2c1adcd50a55971fd0d631bfb/keymap/vim.js#L230-L234

esm7 commented 3 years ago

I created https://github.com/esm7/obsidian-vimrc-support/issues/24 as a stand-alone issue, since it seems like there are many use cases for inoremap and it's very easy to implement.

Gatongone commented 3 years ago

It's probably a CodeMirror limitation and maybe I can work around it, I'll look into it when I get a few hours to work on the plugin.

Thanks

fuatto commented 3 years ago

It's not related to this issue but, my .obsidian.vimrc is not working, probably I'm missing something, any idea?

Here is my folder tree (vault root): image

Here is the content of it: image

esm7 commented 3 years ago

It's not related to this issue but, my .obsidian.vimrc is not working, probably I'm missing something, any idea?

Here is my folder tree (vault root): image

Here is the content of it: image

If you're sure that the Vimrc plugin is installed & enabled, can you please open a separate issue for this, hopefully also together with any logs you may have in the development console (press Ctrl+Shift+I and copy what's in the Console tab)?

patrick-motard commented 3 years ago

Definitely subscribing to this issue. I want to use vim mode but not being able to rebind escape is a non starter for me.

RIT3shSapata commented 2 years ago

Hey @patrick-motard is it working for you now? I set this plugin up and mapped Esc key to jj and works for me.

chrisgrieser commented 2 years ago

For example, instead of <ESC> try use <Esc>.

this is the solution, btw. <Esc> works flawlessly.

patrick-motard commented 2 years ago

@RIT3shSapata I followed the suggested approach and was able to rebind escape using:

imap fd <Esc>
karmicdude commented 1 year ago

For example, instead of <ESC> try use <Esc>.

@velixor how unobvious it is. Ty man

sachasmart commented 10 months ago

Not working for me still even with Esc (uppercase E, lowercase sc) - and incredibly annoying

patrick-motard commented 10 months ago

@sachasmart - I'm wondering if your vimrc file is set up correctly in Obsidian. Can you confirm the following for us?

Lets assume your vault is in ~/Documents/vault/ and your rc file is called .obsidian.vimrc.

If you can try this and let us know if it works or not, we can rule out several possible places where an issue could be in your setup.