Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text objects for code/verbatim (inline) and source code blocks #332

Closed
Maltimore opened this issue Jun 12, 2022 · 3 comments
Closed

Text objects for code/verbatim (inline) and source code blocks #332

Maltimore opened this issue Jun 12, 2022 · 3 comments
Labels
core-feature Feature is in orgmode core

Comments

@Maltimore
Copy link
Contributor

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

@rwmpelstilzchen
Copy link
Contributor

rwmpelstilzchen commented Sep 3, 2023

I would suggest the following:

  • Expanding this to other markings in the Org markup: *bold*, /italic/, _underlined_ and +strike-through+.
  • Supporting not only i (‘inner’) but also a (‘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.

kristijanhusak added a commit that referenced this issue Feb 25, 2024
@kristijanhusak
Copy link
Member

This was partially addressed in 44a20fb.

First 2 options from previous comment:

  • Expanding this to other markings in the Org markup: *bold*, /italic/, _underlined_ and +strike-through+.
  • Supporting not only i (‘inner’) but also a (‘around’? ‘all’?); see :h object-select.

@Maltimore
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-feature Feature is in orgmode core
Projects
None yet
Development

No branches or pull requests

3 participants