Questions tagged [cursor-movement]

Moving the cursor another place in the buffer.

Filter by
Sorted by
Tagged with
1
vote
1answer
64 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
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
39 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
24 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
122 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?
0
votes
2answers
39 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
26 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 ...
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
227 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 ...
0
votes
2answers
58 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 ...
0
votes
0answers
53 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 ...
2
votes
1answer
72 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 ...
2
votes
1answer
40 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 ...
2
votes
1answer
146 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
43 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 ...
-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 ...
1
vote
1answer
50 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> ...
0
votes
1answer
25 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
44 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?
2
votes
1answer
22 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
861 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
107 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, ...
1
vote
2answers
61 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
89 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
67 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,...
2
votes
1answer
120 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
14 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
vote
1answer
41 views

Typing d in insert mode briefly moves cursor backwards

In Vim, when I'm in Insert mode and hit d, the cursor moves back one spot for a second, then jumps back to behind the letter just typed. This is quite distracting when typing texts. It looks like Vim ...
0
votes
1answer
106 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 :...
1
vote
1answer
33 views

Is there a way to use a relative address that doesn't go over the edges of the file?

I'm using the following commands to move a line of text up and down in the file. :move +1<CR> :move -2<CR> However, these commands don't work on the edges of the file. If I try to move ...
1
vote
1answer
26 views

How do I, in a macro, yank a word which might be just one letter long?

I am writing a macro a part of which is supposed to extract verse numbers from a string such as 11.1, standing for "verse one in canto eleven". I search /11\.\zs. The cursor now is in the right place. ...
0
votes
2answers
216 views

Why do I have to press the caret button twice to go to the beginning of the line?

When I press the caret button in normal mode, vim first prints a caret at the cursor position. Only with the second press of the caret button does the cursor actually move to the beginning of the line....
2
votes
1answer
52 views

Put cursor at arbitrary line and column

Normal, insert, and visual modes restrict cursor movements to locations occupied by some characters. They don't allow moving to the right from the end of line and down beyond end of file. For example:...
1
vote
1answer
187 views

How to move past a closing parenthesis in insert mode

so I've been learning vim the past few weeks and am having trouble with defining functions and the such. e.g. every time I define I function in python I write: typing in insert mode: def foo<...
4
votes
2answers
768 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 ...
3
votes
1answer
589 views

Go to Nth character in the file?

:goto goes to Nth byte of the file. I am looking for a way to go to Nth character. Given that Vim supports all kinds of multi-byte encodings, it would be odd if it did not exist, but I can't find one.
0
votes
1answer
27 views

Is the pattern .\{-}\> equivalent to the move command e?

What is the appropriate way to make a pattern that matches up until the point where the move command e would have moved to? Consider this text: texttext%0s: cookie after performing /%<CR>ve the ...
1
vote
2answers
312 views

Advance to next (multi)characters on a line

To advance to the next/previous character match on a line I can do: f <char> However, I find myself wanting to match against two characters on that line, for example, something like: f =' Is ...
3
votes
2answers
327 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 ...
1
vote
1answer
224 views

How to move the cursor out of the terminal

I'm now using Vim 8 and its new feature: :term. Well, it's great but I don't know how to move the cursor out of the terminal without the mouse. In Vim 7, we can type <C-w><C-h>, <C-w&...
1
vote
1answer
53 views

Does Vim keep track of screen views?

In vim, one could describe the "state" as the position of the cursor, the position of the screen view (ratio of screen viewable above cursor vs below), and the values of all latent variables and file ...
0
votes
2answers
48 views

Paste at cursor instead of below

If I start with this file: https://example.com <> and press ddp, I expect to get this: <https://example.com> but instead I get this: <> https://example.com What am I doing ...
1
vote
2answers
545 views

Pressing Enter removes indentation

If I have a file a.js like this: let a1 = [ ]; and I press Enter at the end of the first line, a Tab is inserted. I do not want this, so I added a setting: filetype indent off but then if I have ...
2
votes
0answers
43 views

Remove 'jumps' when moving to last and first line in Vim [duplicate]

I have the display option set to lastline so that the last line is shown even if all it doesn't fit on the window. When moving down visual lines with gj to the last line that is only partially visible,...
2
votes
1answer
120 views

How to search & replace the word under cursor without changing position?

This question is related to Do a forward slash search but don't have vim immediately jump to the string? but is not a dup. I recently updated my Linux box (clicked on the "install updates" button ...
4
votes
1answer
29 views

Cursor Movement in y8k vs y8j [duplicate]

Why does y8j not move the cursor but y8k does move it up? What .vimrc entry would prevent yanking upwards moving the cursor?
2
votes
2answers
86 views

Jump to a specific line without moving the cursor horizontally

Consider you are editing the left table in Vim. Your cursor (■) is at Line 14, Column 12. Where you are now Move the cursor 11 +-------+-----+ 11 +-------+-----+ 12 | Name | Age | ...

1
2 3 4 5 6