Questions tagged [cursor-movement]

Moving the cursor another place in the buffer.

Filter by
Sorted by
Tagged with
0
votes
1answer
40 views

How to go to the nth-to-last character in insert mode?

Capital A in Vim takes me to the last character in insert mode, but can I go to the nth-to-last character in insert mode (or append mode) in vim? Example: this is some t|ext how to go specifically to ...
1
vote
1answer
22 views

Restoring cursor to position before delete after Undo

This question is asked multiple places but none have an answer that works for me. I've tried: '' `` g; g, ; , Ctrl+o In a file add: 123456789 Move your cursor over 7 in normal mode, type d4h, press u....
0
votes
2answers
36 views

How to move `n` number char <left> in vim command line?

My init.vim code autocmd FileType cpp nnoremap <F4> :RunWithFile ~/Downloads/ > output.txt && cat output.txt I want my cursor position to be exact 31 times <left> in command ...
0
votes
0answers
19 views

Move right *or* to start of next line, like WYSIWYG right arrow would [duplicate]

In WYSIWYG text editors, pressing the right arrow key will If the cursor isn't at the end of the line, move it to the right. If the cursor is at the end of the line, move it to the start of the next ...
0
votes
1answer
28 views

Is there a plugin for (neo)vim that allows to jump to a possition by label, similar to things like vimium do?

With some browser plugins like vimium, one can press a key and all links on the open webpage get labeled with a short combination of letters. If you then type that combination, the corresponding link ...
3
votes
1answer
514 views

Relative line number colouring

I have relative numbering turned on. There's no immediate way of telling which direction I want to move, however. For example, sometimes I see line number "7" and move 7j (7 lines down) when I really ...
1
vote
1answer
58 views

Text object for a field between tabs

I'd like to define a text object for tab-delimited fields in a tsv file. So far, I have vnoremap af :<C-U>silent! normal! T<Tab>vf<Tab><CR> omap af :normal Vat<CR> ...
32
votes
1answer
7k views

How can I move the cursor to the top or bottom of the screen?

I know that gg and G can move the cursor to the top and bottom of the file. But is there a way to jump to the top or bottom of the visible window?
22
votes
6answers
5k views

How do I move the cursor to the center of current line?

Is there a way I can move my cursor to the middle of the current line? By middle, I don't mean the middle of the screen, but the middle of the line of text, regardless of length. The shortcut M moves ...
1
vote
1answer
79 views

How do I delete until (and including) the 2nd occurrence of some character?

Here's an example: console.log("basename of"path.basename(__filename)) console.log(path.dirname(__filename)) With my cursor on path in the first line, I've tried: dt2) but then my cursor ...
0
votes
1answer
117 views

How to bind these keys to prevent recursive binding in Vim?

I have been trying to do :noremap j k and :noremap k j which works but instead of going up it goes slanted up and down. I want j to move up and k to move down which is opposite in vim. I also tried :...
0
votes
0answers
24 views

Jump to last change that was farther than X lines away

I'm looking for a command similar to g;, but that ignores changes that are close to the cursor (say, less than 5 lines away). When I'm editing some function in the middle of a file, I sometimes need ...
0
votes
1answer
40 views

How do I move to the next/previous number [duplicate]

How do I move the cursor to the next/previous number? Ctrl-x and Ctrl-a can't be used since I have :set nrformats+=alpha.
2
votes
1answer
59 views

Moving by word (w/b) and staying within the line

Background I'm attempting to remap the arrow keys to move by word while staying within the current line. I.e. I'm looking for a behavior similar to w and b, but that acts like h and l in the sense ...
0
votes
1answer
60 views

How can I center the cursor vertically after jumping to a line?

I often use :line to jump to a line number. How can I automatically center that line vertically after jumping? Essentially the same as running :150zz.
2
votes
1answer
25 views

vimscript to skip a block of text with lines containing similar words

I need a little help with some vimscript-ing. I have a huge log file with multiple blocks of text resembling the following: [log file start] ... ... Information: Setting NDR rule shield_rule on net a ...
0
votes
0answers
40 views

What is the fastest way to move cursor to the end of a line by line number?

I recently found out that you can move the cursor the beginning of a line quickly by line number like this: :11 Regardless of your cursor position, this will move the cursor the beginning of line 11. ...
0
votes
2answers
188 views

Possible to increase cursor move speed when holding down (h/j/k/l)?

Is it possible to increase cursor move speed when holding down (h/j/k/l) ? If so, how?
3
votes
2answers
1k views

Vim keep last line at bottom of buffer

I need to configure Vim in such a way that it has a normal scrolloff of 3 or 5. But in such a way that it keeps the last line at the bottom of the screen. I don't want that as I scroll, the last lines ...
63
votes
4answers
18k views

How to jump between matching HTML/XML tags?

How to jump between matching tags (such as <div>, <span>, etc.) when editing HTML/XHTML/XML documents similarly as % is used to jump between matching parentheses?
0
votes
2answers
41 views

cursor position past EOL

Given the following setup edit a long line short move the cursor to line 1, column 9 (> 6 anyway) move down and up again I see that when moving to the short line, the column becomes at most 6 (...
1
vote
1answer
27 views

Why does "cw" from middle of current word not move to beginning of next word like "w" or "dw"? [duplicate]

Example scenario I have this text consisting of two columns with different words of different lengths and alignments: asdf foo bar qwer zzzzz xx Let's say I want to abbreviate the first ...
0
votes
2answers
61 views

Mapping with motion ip

I'm trying to create my own mapping with motion in Vim after reading this stackexchange question. I'm using the plugin vimtux to send code to specific tmux instances and I now want to be able to do ...
1
vote
1answer
34 views

Enter insert mode automatically after moving (e.g. with e, w)

Is there something similar to A and I for "smaller ranges" like w and e, i.e. I don't want to have to press i to insert, after navigating to the end of the word with e?
4
votes
1answer
275 views

How to move cursor to previous line automatically?

On nano&emacs&any other text editor, when the cursor is at the 1st character of a line (not the 1st line), press the left key and it will automatically jump to the last character of previous ...
37
votes
4answers
22k views

How to disable arrow keys in vim?

I want to teach myself to prefer hjkl more over the arrow keys in order to stay on the home row. (I am very aware that one should not use hjkl as the main navigation keys as there are more powerful ...
0
votes
0answers
55 views

Why C-0(zero) in insert mode is not working?

I have mapped some shortcuts to help me in insert mode and one of them is not working. " Go to end of line on insert mode inoremap <C-e> <C-o>$ " Go to beggining of line on ...
17
votes
3answers
12k views

Jumping to a byte offset, and displaying position as byte offset

How can I move the cursor to the nth byte in the buffer? How can I display the current cursor position in the ruler in terms of the byte offset, rather than lines and columns? (Follow-up question: ...
2
votes
1answer
74 views

How to move to Markdown ATX-style headers?

How can I move (navigate) between Markdown ATX-style headers? The Vim plugin https://github.com/gbgar/pandoc-sections.vim does so using the [ and ] keys, but only when there is no space between the ...
11
votes
3answers
3k views

How do I move to the last character in a sentence?

In normal mode ( and ) move to the previous or next first character in the sentence, respectively. How do I move to the very last character. If all of my sentences end with a period I can use )T. (...
2
votes
1answer
137 views

Conflict between system compose key and insert mode meta key mappings

I use the right alt key as a compose key on my system, to easily draw diacritics and accent characters. In Vim, I unlock alt key mappings with this (from stackoverflow): " Allow <alt> key ...
2
votes
1answer
41 views

Midline Shortcut for VI?

Is there a shortcut to take you to the midpoint or the middle of a line inside VI? Ctrl + A and Cntrl + E are super helpful, but I'd love something that's Cntrl + M or something to take me to the line ...
5
votes
3answers
543 views

Prevent the cursor from moving to the start of the yanked text?

Vim help's change.txt states that Note that after a characterwise yank command, Vim leaves the cursor on the first yanked character that is closest to the start of the buffer. This means that "...
2
votes
1answer
208 views

Move cursor back to previous window after splitting

After running a command that opens a new split (e.g. :botright 10new), how can I have the cursor move back to its previous position? A use case would be to show a message in a scratch buffer without ...
2
votes
2answers
45 views

Delete the content and the brackets of a level above while inside in the inner level

My cursor is at H { //foo { //bar { //cursor is Here } //bar2 } } How do I delete the outer layer of brackets while keeping the layer where my cursor is intact? End result ...
9
votes
3answers
937 views

Jump to next identifier in Vim help files

I regularly find myself in the situation that I am reading a help topic and see an identifier (the blue underlined words) that I want to follow with <C-]>. However, most of the time the ...
-1
votes
1answer
35 views

In a new line, moving to the columns of the beginning of the words in the line above?

Is it possible to have a 'smart tab' working as follows: 'move forward to the columns corresponding to the beginnings of the words in the line above' For example, in the situation below: I would like ...
3
votes
2answers
420 views

Simple keycombination to move to the last occurance of a character in a line

I am looking for a simple few key command which would move till the last occurrence of a character in the line. Is there anything already existing? The alternative is to jump to the next specified ...
0
votes
1answer
26 views

Override a plugin to restore movement key?

I'm using the pencil plugin which remaps the jk movement buttons to go up/down by row (text is soft wrapped) rather than line, which is usually helpful. But at times I want to have the normal behavior ...
1
vote
1answer
47 views

How to have l and h at the boundary of the window shift only one column, when wrap is off?

How can I have h and l move the viewport only by one column when they go beyond the left and right borders when nowrap is active?
1
vote
2answers
115 views

Sync cursors of popup window and current window

I'm trying to sync the cursors movement of a popup window, and the current window. call range(50) \ ->map({_, i -> string(i)}) \ ->popup_create(#{ \ line: 1, \ col: 1, ...
30
votes
4answers
1k views

Why can ci" be outside of quoted area and ci( only works inside parentheses?

When using ci" the cursor does not have to reside in the double quoted area. |String somestring = "some text"; Assuming the pipe is the cursor position, ci" will make it jump to the quoted area. ...
2
votes
1answer
24 views

Substitute: previous match with confirm

If I do a replace like this: :%s/May/June/gc afterward I keep hitting y or n as needed. But sometimes it hit n on accident and need to go back. I read that you can use N for this purpose, but it ...
2
votes
1answer
1k views

VIM - How to select multiple lines that are not adjacent?

If you have the following text: line 1 line 2 line 3 You can hit CTRL+v on line 1 and hit j to select line 2. However, I want to select both line 1 and line 3, but not line 2. Is this possible?
1
vote
2answers
63 views

Any ways to sync the movement of the number column and another window?

I want to be able to control/sync the movement (scrolling) of the number column (usable with :set number) with another different window (which doesn't have :set number set). Any ways to do this?
5
votes
1answer
90 views

How often and when is foldexpr evaluated?

I want to toggle foldmethod between expr and manual because if we always set foldmethod=expr, then the cursor tends to move slowly in vim. I think that foldexpr is evaluated just after switching ...
3
votes
1answer
72 views

Cursor-movement after $ motion

I play the great game called VIM adventures (from which are the images bellow). The question is from the game, but is also reproducible in VIM so this is the place I ask. Assume you are in normal mode,...
4
votes
2answers
781 views

Why isn't this implemented by default in vim? (line by line Scroll) [closed]

Very often, my preferred way of navigating a file in vim is by "scrolling" line by line. By scrolling, I mean shifting the lines up/down while keeping the cursor on the same line and ...
1
vote
0answers
131 views

Can I use feedkeys() inside of a keyloop implemented by getchar()

I implemented a fuzzy filter, which accept a list argument, open a window with a scratch buffer whose content set to the list, then waiting for use input and do filtering. Here is why I ask this ...
2
votes
1answer
15 views

How to jump to the first character of the first line of the next/previous block of text?

I am aware of {and } to navigate between blocks of texts , however these jump to blank lines in between blocks of text. When there are several blank lines in between 2 blocks of text these do not ...

1
2 3 4 5 6