nvim-orgmode / orgmode

Orgmode clone written in Lua for Neovim 0.9+.
https://nvim-orgmode.github.io/
MIT License
3.04k stars 134 forks source link

Support mapping in other mode? #70

Closed romariorobby closed 3 years ago

romariorobby commented 3 years ago

Does this feature exist in Emacs orgmode core?

N/A

Orgmode link

No response

Feature value

No response

Additional context

Is there a way to bind in insert mode? I'd like to bind do_demote with TAB and do_promote S-TAB . I know in documentation says only works in normal mode.

kristijanhusak commented 3 years ago

You can do something like this:

imap <TAB> <C-o>>>

<C-o> leaves insert mode for single normal mode command >> does the demote

Adding insert mode specific mappings is tricky because it doesn't allow changing content programatically that easily, so I don't plan to add any support for those. I'll probably just add handling the Enter to properly continue list item/checkbox (related comment https://github.com/kristijanhusak/orgmode.nvim/issues/57#issuecomment-887980098) at some point, since pressing <leader><CR> to achieve that is a bit obnoxious.

romariorobby commented 3 years ago

Yes, that how i solved this too with recursive mapping. Thank you!

darg2012 commented 1 year ago

Hi, I'm trying to achieve the same behavior with the meta_return mapping, at the end of my lua/after/org.lua file I have: vim.keymap.set('i', '<Space><CR>', '<C-o><leader><CR>') but it does not work as keymap despite the {rhs} working as expected if typed manually.

I tried also this mapping: vim.keymap.set('i', '<<Tab>', '<C-o><leader>oi.') but I only get oi. inserted in my buffer.

Could anyone guide me on applying such keymaps? Thanks.