orgmode
orgmode copied to clipboard
Blocks text objects
Does this feature exist in Emacs orgmode core?
No
Orgmode link
No response
Feature value
Most of the text objects are made around heading and their subtrees. But org has more than just headings. Notably, blocks. I think it would be quite useful to have the b (block) text object which one could work around and within. Perhaps this might get my idea accross a bit better:
dib(delete inner block) -> deletes everything within the limits of#+begin_srcand#+end_src. And this could be block type agnostic (quote blocks, code blocks, etc...)dab(delete around block) -> deletes the#+begin_...and#+end_...lines but not the contents
This could even allow some quite sophisticated behaviour with existing plugins such as vim-surround. Similarly to html tags, block have some sort of label (src, quote, etc). Some also have additional info (ex: #+begin_src go specifies golang as the syntax inside the block). This means you could have a similar behaviour to html tags. Take this for example from vim-surround:
Say you have hello my [quaint] friend in a document and wrote cs]t (Change Surrounding ] with an html Tag). Vim surround opens up a small command prompt where you can write div id="myID" and press Enter. The result is then the following hello my <div id="myID">quaint</id> friend.
In a similar fashion writing cs]b and write src lisp in the command prompt could change the brackets with a block structured as such: +begin_src lisp ... #+end_src.
Additional context
No response