I'm a vim user and have recently been trying out emacs for fun. I find that the feature I'm missing most so far from vim is the "super star" (find the word under the cursor by typing *) feature, and I have yet to find the equivalent in emacs. If it's not built in, what would I need to add to my emacs file to get something similar?
相关问题
- Symbol's function definition is void: declare-
- What is the best way to do a search in a large fil
- How can I set the SVN password with Emacs 23.1 bui
- Emacs shell: save commit message
- How to change the first two uppercase characters o
相关文章
- 如何让 vim 支持 .cshtml 文件的代码高亮
- What is the complexity of bisect algorithm?
- Auto-save in VIM as you type
- ess-rdired: I get this error “no ESS process is as
- Emacs/xterm color annoyance on Linux
- How can I use gcc's -I command to add recursiv
- Visual Studio: Is there an incremental search for
- Vim: overloaded mapping for multiple modes
As pointed out by paldepind,
isearch-forward-symbol-at-point
(M-s., by default) is a close equivalent to * in Vim. This function is available starting in GNU Emacs 24.4; if your Emacs is different or older, read on for alternatives.Usually I just do (M-b ...) C-s C-w ... C-s. That is:
Here is a go at integrating it into I-Search (invoked via C-s and C-r; use C-h k C-s for info on
isearch
).Integrating it into I-Search takes advantage of its word matching and case sensitivity settings (C-s M-c C-* would do a case-sensitive search on the word under point).
Here is a start:
C-s C-w
is ok but it's not strictly symbol search, but "word part at the right of point" search.The correct answer is
M-s .
This starts symbol search with the symbol at point preloaded. Symbol search is a special mode of isearch that you can start withM-s _
. If you're already in isearch (for example, after pressingC-s
orC-r
) you can also typeM-s _
to enter symbol search.I urge you to read the entire documentation of isearch since it's very powerful and versatile.
These days there is also Smart Scan, a lightweight add-on package that provides this functionality.
It is available from MELPA; instructions for adding MELPA to the list of enabled
package-archives
are here.To install it:
M-x
package-install
RETsmartscan
RETYou can then enable it via
The default key bindings for searching forward and backward are M-n and M-p, respectively.
PS: If you are interested, the original blog post introducing this package is here.
Try C-sC-w
if you're using viper (which works great) this should work similarly enough: