Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs - how to avoid backtracking cursor movements when navigating

I've been using emacs for years, but I noticed a habit of mine that slows down my workflow. I do a lot of "backtracking" with "forward"-moving commands.

For example, when I use M-f to several times to jump forward a word, but it jumps me to the end of the words, so often when I reach the word I'm trying to get to press M-b to go back to the beginning of the word.

Similar thing happens when I search with C-s to search, when I find the pattern, the cursor is at the end of the matched pattern and I need to press M-b again to go back to the beginning.

Given how frequently I do these sorts of actions, this adds up to a slower workflow. In some cases, using reverse-oriented commands like backward-kill can help, but this requires memorizing more commands and isn't applicable in all cases (for example, if I want to start typing at the beginning of the word).

Is there a better approach to navigation in emacs that avoids these redundant actions?

like image 247
daj Avatar asked Oct 08 '22 00:10

daj


1 Answers

Recently I use Ace Jump mode

"What's ace-jump-mode?

ace-jump-mode is an fast/direct cursor location minor mode. It will create the N-Branch search tree internal and marks all the possible position with predefined keys in current view. Allowing you to move to the character/word/line almost directly." --emacswiki

there is a video http://emacsrocks.com/e10.html

like image 73
Shihpin Avatar answered Oct 13 '22 11:10

Shihpin