In vim, I can use f
to move the cursor forwards to a certain character and F
to do this backwards. How to do it in Emacs? I know you can use C-z
or M-z
to delete until a certain character, and you can also first delete then paste to achieve a motion. But 1) is there a better way to do this, only movement, without delete? and 2) how to do this backwards?
You can also move point using the arrow keys present on most keyboards: RIGHT, LEFT , DOWN, and UP; however, many Emacs users find that it is slower to use the arrow keys than the control keys, because you need to move your hand to the area of the keyboard where those keys are located.
Unlike C-n and C-p, most of the Emacs commands that work on lines work on logical lines. For instance, C-a ( move-beginning-of-line) and C-e ( move-end-of-line) respectively move to the beginning and end of the logical line. Whenever we encounter commands that work on screen lines, such as C-n and C-p, we will point these out.
You can do some work just by typing in the window once emacs comes to life. The backspace or delete key should do what you think it does. In the list below, C- means "control key", M- means "meta key" (escape). For meta commands, press the meta key, then the other key.
To go to a specific line: Type M-x goto-line <return>, then type the line number followed by <return>. There a shortcuts. Type the command "help -q emacs goto " in a local window to find out about it. (Local shortcut is M-x #). Emacs has an excellent on-line help tutorial. To use it, start up emacs.
Forward incremental search is C-s, and reverse incremental search is C-r.
Responding to comment:
To delete from the current position backwards to a specific character, you can use
C-<space> to mark the current position, then C-r <char> <RET> to locate the search character, and C-w to delete between current position and mark.
To get more help on doing things in emacs, you should look at the tutorial. Typing C-h t will open the tutorial in a new buffer.
jump-char was designed specifically for this task.
To delete, use zap-to-char
or activate the mark by pressing C-spc before jumping, then C-w.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With