Fixed by changing major mode. It seems typescript-ts-mode
didn't work well with tsx files, so switched to tsx-ts-mode
(after upgrading https://github.com/llemaitre19/jtsx)
Emacs
A community for the timeless and infinitely powerful editor. Want to see what Emacs is capable of?!
Get Emacs
Rules
- Posts should be emacs related
- Be kind please
- Yes, we already know: Google results for "emacs" and "vi" link to each other. We good.
Emacs Resources
Emacs Tutorials
- Beginner’s Guide to Emacs
- Absolute Beginner's Guide to Emacs
- How to Learn Emacs: A Hand-drawn One-pager for Beginners
Useful Emacs configuration files and distributions
Quick pain-saver tip
Though I tend to do something rather along the lines of vif
(using evil's defun
text-object, or evil-treesitter if that's what you prefer) I tried what you indicate and it does work here…
So, could you be a bit more precise in what you're trying to do and how it fails? (a file example, trying without other packages than evil, etc.)
You can select in one go in GNU Emacs. You can bind this to some shortcut.
(defun select-func-at-point ()
(interactive)
(let (bounds pos1 pos2 mything)
(setf bounds (bounds-of-thing-at-point 'defun))
(setf pos1 (car bounds))
(setf pos2 (cdr bounds))
(set-mark pos1)
(goto-char pos2)))
If I understand what you're describing, your point is on the first line of a function (not necessarily at the end). You press V
to go into (line) visual mode, and then $%
. And that's not working?
When I do that, I do wind up with the entire function selected as I'd expect. FWIW, I'm using evil mode as configured by Spacemacs, and I tested it out in a random Go file I had open. It looks like Spacemacs does add a bunch of extra packages in their evil layer*, but I checked and %
is bound to evil-jump-item
from the evil package.
* Not to be confused with their evil lair.