Questions tagged [motion]

is for moving the cursor around the buffer. Emacs provides key-bindings for alternative ways of moving the cursor interactively: by syntactical elements such as characters and words; by forward and backward searches; by arbitrary lines; by units such as sentences, paragraphs, and s-expressions; and by other methods unique to certain modes.

Filter by
Sorted by
Tagged with
2
votes
1answer
38 views

How to calculate a point N lines from another point in elisp?

Given a point, how can I get the point N lines before/after it? Will post own answer, but I'm not sure it's optimal.
0
votes
1answer
56 views

How to define a custom function that runs a command twice?

In dired mode, 'm trying to make a function that runs dired-next-line twice and then bind to SPC so that I navigate files faster in dired mode. I tried to add this in my dired.el file but it didn't ...
0
votes
0answers
23 views

decrease initial delay for line-up/line-down movement

so every time I press C-n or C-p for moving the point up and down and keep pressing n or p I move several lines. However, after the first line move, there is a delay before the point is moving down in ...
5
votes
2answers
91 views

Is there an emacs command to go to end of code line (before line comment and whitespaces start)

say you have that: stuff indented stuff # commented stuff We already got move-beginning-of-line and back-to-indentation for the left side. Now, for the right side... I'd love to know if you ...
0
votes
2answers
158 views

how to define an evil-operator to move forward/backward a text-object?

I am trying to define a function that moves to the begin/end of current text-object. First - I define an operator: (evil-define-operator evil-forward-text-object (beg end type) "move to end of ...
0
votes
1answer
122 views

Jump to non-whitespace characters along a column

I'd like to have a command that moves down to the first line of the next string of nonwhitespace characters along the current column, and the analogous commands that move upward, and to the last line ...
0
votes
1answer
72 views

How can I get working motion keys with `emacs -nw`?

when I start Emacs without windowing system (-nw), the motion keys are not working. Instead, I get (parts of) the escape sequences, like: ;; This buffer is for text that is not saved, and for Lisp ...
1
vote
1answer
28 views

Move to beginning of line when top arrow is pressed in beg-of-buffer line

Like in all modern editors, including the SE Q&A fields, I'd like my cursor to move to the beginning of the first line, when I press the Up arrow on the first line of a buffer. Currently, it stays ...
4
votes
1answer
76 views

Ignore tags in `org-end-of-line` and similar motions

Is there a convenient function for jumping to the last non-tag character in the line of an org-mode heading? For instance... * This is |my header :tag1:tag2: I would like a command that moves ...
1
vote
0answers
69 views

Slowness opening and moving around within large files

I'm running spacemacs 0.200.13 on emacs 25.3.1 from a macOS 10.12 machine. In some scenarios, things feel very sluggish. They get worse as a dozen buffers or so are opened during the day. From the ...
0
votes
0answers
26 views

Enable Evil jump to work across all panes instead of only active pane

Is there a way to enable evil-jump-forward and evil-jump-backward to use the jump list of all panes instead of only the active pane? In the gif below, here's what happens: Start on left pane at ...
1
vote
0answers
34 views

Move point to just before end of a comment

Given that the point is right in front of a comment, how do I move it to the end of the comment, but before the comment end markers? For example: for a C++ // xxx comment, I would like to move the ...
0
votes
1answer
317 views

Spacemacs visual line navigation not working

Running spacemacs 0.200.13 on emacs 25.2.2 on Kubuntu 18.04. In ~/.spacemacs, there is: (global-visual-line-mode t) (add-hook 'text-mode-hook #'visual-line-mode) So, when I open a text file, I see ...
1
vote
1answer
89 views

Unexpected behavior using SHIFT+arrows and CTRL+arrows on emacs (orgmode) + terminal + mosh + screen

I am connecting in a machine using a terminal, mosh and then screen. Then, in my orgmode file I can't use the shortcuts like SHIFT+up, SHIFT+left or CTRL+up etc. If I press that, it produces something ...
2
votes
3answers
73 views

is there a keybinding to save curor position for returning after viewing other section of same buffer?

when i am editing a large file, often need to view other sections of the same buffer only once. But after that I need to go back to the position I was editing at. Is there a key for doing that?
4
votes
2answers
90 views

Move cursor left/right while entering isearch

How can I move my cursor left and right while entering my isearch text? isearch-forward Enter some text Press cursor left to edit the search text Argh! Emacs returns the cursor to the main buffer. ...
1
vote
5answers
205 views

Skip vertical whitespace/non-whitespace blocks (sort of vertical M-f / M-b)

Say the point is on the 0 here: as0sasasa asasasasa as1sasasa asa as3sasasa asasasasa as2sasasa I'd like to have a command – like a vertical forward-word – that when run repeatedly would jump ...
0
votes
0answers
73 views

How can I run (recenter) after (call-interactive …) that jumps to a buffer?

I would like to jump to a buffer using rtags for eg. Example snippet: (defun generic-lookup () "Follow link/goto line." (interactive) (cond ((string= major-mode "c-mode") (progn ...
0
votes
2answers
152 views

How to use a menu to jump between sections of a document?

I would like to define my own rules for what a section of a document is, then use this so I can popup a list of sections I can auto-complete or use arrow keys to jump between them. Take a simple ...
2
votes
1answer
169 views

Make evil paragraphs behave like vim paragraphs

I have moved from vim to emacs using evil-mode. I've found that I prefer emacs (as long as I can edit text vim style), but I have one small inconvenience. I've found, mainly while writing prose, but ...
3
votes
1answer
93 views

New line in cursor-intangible area and line-beginning position

I want to make the beginning of a line uneditable, which I can achieve by applying the read-only and cursor-intangible properties. But I have the problem, that line-beginning-position moves point not ...
0
votes
1answer
147 views

Custom keybinding for jumping down 2 lines on spacemacs (evil-mode)

What I want is to have the option to scroll faster. Currently when in evil-mode normal state when I press j evil-next-visual-line is called. If I hold jthen the cursor moves down. What I want is ...
0
votes
1answer
31 views

Make prelude C-a go to the absolute beginning of the line

Emacs prelude "smartens" C-a by rebinding it to "crux-move-beginning-of-line" My muscle memory likes the vanilla emacs setting better, where C-a moves point to the absolute beginning of the line. ...
1
vote
1answer
190 views

Move cursor to beginning of visible text in current buffer

Is there a shortcut key combination for moving the cursor to the beginning, resp. end, of the visible text in the current buffer, i.e. to the first, resp. last, cursor position that can be seen on the ...
1
vote
1answer
96 views

Navigating lisp

I want to programmatically navigate emacs lisp (and similar "nested paren code"). Specific functions I want: Go to first child (which errors if there are no children (maybe lispy-outline-goto-child ...
1
vote
1answer
147 views

Moving around within xml documents?

Are there any useful functions / modes / hydras / utilities for navigating xml documents? Some features that might be nice to have: Jump to parent Jump to next child Jump to matching tag (like % in ...
1
vote
1answer
51 views

Lispy: recommended way to exit a string?

I'm trying to get a hang of lispy for editing and navigating Lisp code. My assumption is that most of the keymap choices are made to offer convenience in practice. Some practical tasks involve more ...
3
votes
1answer
217 views

Move to goal-column inserting spaces if necessary

I have a bunch of lines of text and I'm trying to insert text starting at a certain column on each line. For example: 'Some text' This is ok 'Another longer text' ask Ram 'weird stuff' ...
1
vote
1answer
60 views

Is it possible to use avy to jump to known positions in a buffer?

I want to use avy to jump to fields in a bibtex entry. I have only found a way to use a regex to specify jump places in avy so far. I don't want to just build a regex to match the fields in an entry, ...
10
votes
3answers
357 views

How to jump to matching (double or single) quote of a quoted string?

When cursor on one quote symbol, how to jump to the pairing quote?
1
vote
1answer
51 views

goto-chg stops at undo branch point?

I'm using package goto-chg to move cursor to the last edit. It works great most of the time, but it sometimes said "No further change info" even though there were more changes. Using undo-tree's ...
4
votes
2answers
434 views

Moving cursor to the middle of the line where it currently is

Is there a way to define a function that, when called, would move the cursor to the middle (or close to the middle) of the current line, similarly to how we can move it to the beginning and end of the ...
0
votes
0answers
52 views

how to debug who move cursor

I have very annoying problem, after I run M-x compile time to time cursor jump from middle of buffer to the first line. I want to find out culprit (I found mode who responsible for this, but I want ...
2
votes
0answers
43 views

How to navigate horizontally in a Helm buffer?

When I use helm-occur it prints the path to the source file of the buffer, which is inconvenient on a small display. How can I navigate horizontally? How can I hide paths in a helm buffer?
1
vote
1answer
74 views

What is the correct way skip to prev/next method/function definition?

I do not want an answer about something like Imenu or tags - features that suppose you know some keywords about the method/function name to move to. What I want is just general commands which jump ...
1
vote
1answer
147 views

elisp - detect line change event to trigger function

I want to detect line change event (arrow-,arrow- or mouse click) to trigger my function call. Below example handled arrow- arrow- but can not handle mouse click or C-n C-p line change event. (defun ...
1
vote
2answers
667 views

How to make end-of-buffer move to the last line not beyond it?

I'm playing with evil-mode and this is one of the things where evil differs from vim. In vim G takes you to the last line, but evil uses Emacs end-of-buffer which for some reason takes me beyond last ...
1
vote
1answer
59 views

next/prev-imenu-item function

I would like to have a single shortcut to jump to the next item on the imenu of current buffer. E.g., if the current buffer is in org mode, next-imenu-item = org-next-visible-heading. Anyone did ...
3
votes
2answers
195 views

How to move the cursor to the beginning/end of a shift-selected region by a left/right motion?

In most modern editors, after canceling a selection by a left/right motion, the cursor will be moved to the beginning/end of the previously-selected region correspondingly. Similarly, if we cancel a ...
6
votes
1answer
165 views

Point motion strategy for Emacs 25 and older

I've read What is inhibit-point-motion-hooks?. Assume some minor-mode my-mode that wants to do point-motion-y things. Assume my--point-entered and my--point-left functions that work fine in Emacs &...
2
votes
1answer
28 views

Finding Like Variables or Functions

Is there a command that will jump cursor to other iteration of the variable or function name under the cursor? I suppose it wouldn't matter if the text is specifically a variable or function, but ...
6
votes
1answer
2k views

Find position in file by character number

When an error occur in compiling a program in Ghostscript, the error message gives a "Current file position is ..." with a number. I use emacs to edit the program file, so I would like to be able ...
0
votes
1answer
157 views

How to jump out of any surrounds?

Not just parenthesis, but any surround. We are given the advantage of a pair being made and the cursor conveniently placed within. That's only 1/2 the procedure; what about jumping out? Previous (...
0
votes
1answer
56 views

Go to specific character sequence if on line programmatically

Is there a function that checks if a specific character sequence - "abc" - is on a line and puts point there if it is? And returning something (presumably nil) if "abc" isn't on the current line?
2
votes
1answer
1k views

Move cursor up or down multiple lines while preserving column

I find it convenient to move by multiple lines for quickly scrolling up/down: ;; replaces forward-sentence (global-set-key (kbd "M-e") (lambda () (interactive) (next-line 3))) ;; ...
12
votes
3answers
4k views

Emacs point(cursor) movement lag

When running previous-line, C-p or <up> the cursor jumps up a line without any issues or lags. When running next-line, C-n or <down> the cursor properly jumps down a line, but with a ...
2
votes
1answer
282 views

How can I move by screen lines as quickly as forward-line?

next-line is very slow, and this is creating problems. I'll give some background then explain why. By default, linum.el treats a wrapped line as a single line, and it takes into account hidden lines ...
2
votes
2answers
164 views

Temporarily disable scrolling

Is there a way to temporarily disable scrolling in an emacs buffer? I would like to "lock" a particular line to be (say) the top of the displayed portion of the buffer, so that if I accidentally try ...
2
votes
2answers
228 views

Move to the beginning of a heading smartly in Org-mode

I just started with Org-mode today and noticed whenever I press C-a on a heading, the cursor is moved all the way to the beginning of the line instead of the first character in the heading. Like so :-...
2
votes
2answers
220 views

Move the cursor backwards to the end of the 1st word on it's between 2 words

If the cursor is placed on a whitespace and there're multiple whitespaces between 2 words, how can I move the cursor backwards to the end of the 1st word?