Text objects for code/verbatim (inline) and source code blocks
Does this feature exist in Emacs orgmode core?
N/A
Orgmode link
Not sure, didn't find anything during a quick web search. But I'm sure it exists.
Feature value
If I have inline code:
Here is inline code: ~echo hello world~
I would like to be able to interact with the code easily, for instance yi~ to copy the code while the cursor is somewhere inside the code. Same for verbatim here is =verbatim=. Would be nice to be able to do yi= or di= or whatever. And one could even extend it to full source code blocks demarked by
#+BEGIN_SRC
..
..
#+END_SRC
I noticed that neovim can already do this with backticks (that (I think) are not part of org): here `this works`. I can do yi`.
Additional context
No response
I would suggest the following:
- [x] Expanding this to other markings in the Org markup:
*bold*,/italic/,_underlined_and+strike-through+. - [x] Supporting not only
i(‘inner’) but alsoa(‘around’? ‘all’?); see:h object-select. - [ ] Supporting
s(‘surround’) as well, like surround.vim does. This is particularly useful when you want to remove (ds) or change (cs) surrounding markings. If we don’t actually rely on surround.vim as a dependency, maybe care should be taken so the behaviour of the two packages doesn’t collide.
This was partially addressed in https://github.com/nvim-orgmode/orgmode/commit/44a20fb5a5628a1374d481d384ee198d428cc330.
First 2 options from previous comment:
- [x] Expanding this to other markings in the Org markup:
*bold*,/italic/,_underlined_and+strike-through+. - [x] Supporting not only
i(‘inner’) but alsoa(‘around’? ‘all’?); see:h object-select.
Works perfectly. Thanks a lot!
The main part in this issue has been addressed. Making it work like surround.vim should be its own issue I think, so I'm closing.