Questions tagged [cursor-movement]

Moving the cursor another place in the buffer.

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

How can I restore the behavior where h and l stopped at the beginning and end of the line?

After quite some time of using Vim I wanted to switch to NeoVim and set it up with more IDE-like features. So I googled and took the first thing I found (LunarVim/nvim-basic-ide/), thinking I could ...
2 votes
2 answers
520 views

How do I enable Bash keyboard shortcuts while in Insert mode?

I like using the Bash shortcuts while at the command line to move around and edit text. A sample of some commands from the link can be seen below: Ctrl + a Go to the beginning of the line (Home) ...
2 votes
1 answer
36 views

How to "Set previous context mark"?

From the vim manual: m' or m` Set the previous context mark. This can be jumped to with the "''" or "``" command (does not move the cursor, this is ...
4 votes
1 answer
100 views

How to go to last change not made on the current screen?

I love g;, but often I find myself repeatedly doing g; until the screen changes. The reason for this is that I am often editing in two different places in the file. If I think ahead, I should set ...
1 vote
2 answers
105 views

How to move to the beginning of visual line or to move to the last non-whitespace character of visual line?

What are the commands to move to the very beginning and to move the last non-whitespace character of the current visual line? Do they exist at all? Commands for normal lines Commands for visual lines ...
0 votes
1 answer
24 views

Is the older behaviour (easier to break out of search term entry) of / searches still available?

I remember older vim installations (in 2.4.x/2.6.x era linux distributions) behaving differently with / searches, often you were able to almost instantly follow the search up with an edit or movement ...
2 votes
2 answers
236 views

} Jumps { between paragraphs - why they work so strange?

Paragraph 1. Paragraph 2. Paragraph 3. Paragraph 4. Here is how } and { currently work for me: Put the cursor on the P of the 2nd paragraph. Press }. The cursor will jump to the position between ...
2 votes
1 answer
97 views

Remap a key only when in final line of a file

I want to remap a key, but I want the mapping to be active only when I'm in the last line of my file. Is there a simple way to do this? I would also like to do a similar thing when I'm in the first ...
40 votes
7 answers
27k 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 ...
1 vote
1 answer
37 views

How to have w,e,b-based motions handle underscores without using iskeyword?

Using Neovim 0.6.1. I use a lot of snake_case_variable_names and have a frequent need to navigate within their individual components instead of treating these names as a single word. Right now, the ...
24 votes
6 answers
2k views

After copying a visual selection, return to original location

My cursor is in the middle of a paragraph when I decide suddenly I need to copy that paragraph: So I type vip to select the paragraph visually: Now I hit cmd+C to copy to clipboard (this may vary on ...
6 votes
4 answers
797 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 "...
1 vote
1 answer
267 views

Jump from tag-to-tag in xml?

I'm using emmet-vim which says that it can work in xml files but I can't seem to navigate between tags. Say I have this structure: <dependency> <groupId>com.google</groupId> &...
0 votes
2 answers
28 views

can I map multiple presses of <any key>?

I want to make more use of fF to navigate, but find the f to be clumsy. Eg. jump to "a" is fa. Instead, I'd like aaa to map to fa, bbbto map to fb etc. Is there an easy way to do this other ...
4 votes
2 answers
941 views

Keep Cursor In Current Position After Find-Replace

How does one keep the cursor in its place after a file-replace using :%s/find/replace/g ? I looked at restoring cursor position, but not quite what I was looking for, and I could jump back to previous ...
0 votes
1 answer
51 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
1 answer
194 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 :...
3 votes
1 answer
192 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
1 answer
21 views

How do I move the cursor feely past the EOLs?

I vaguely remember I've read about this option and also tried it out, but I can't remember the name... It allows using l to move past the EOL, even though $ still brings you to the EOL, not to the ...
2 votes
3 answers
55 views

How to remember and recall cursor position?

Imaging I'm editing some code, and I found a few words that I would like to paste at the current cursor position elsewhere in the file. I will go to them, yank them, but then how do I return back to ...
1 vote
1 answer
89 views

A multiple movement of the cursor

For example the code below, 1: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 2: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 3: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa The arrow key moves the cursor from one character to the left, ...
6 votes
3 answers
263 views

What prevents the cursor from moving to the first column on some help files?

I recently noticed that on some help files it is not possible to move the cursor to the very first column of some lines. To explain it clearly, here is a screenshot where I have done the following: ...
1 vote
1 answer
36 views

Ctrl+Arrows work differently in normal mode and in insert mode

For some reason, in my VIM there is a difference in behaviour of Ctrl+Arrow keys in normal mode and in insert mode. To demonstrate this, I edit the file which contents are: aaa.aaa,aaa/aaa!aaa@aaa#aaa$...
1 vote
1 answer
36 views

Unexpected behavior in edited vimrc: dropped out of insert mode when hitting empty line

sorry for the bad title. I could not think of how to better summarise the problem. I should also state, that I am fairly new to vim, so please be a bit considerate :). I made the following changes in ...
2 votes
3 answers
1k 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
3 answers
86 views

Why does `:m+1` not move two lines down when `:m-2` moves one line up?

In the help for move: :[range]m[ove] {address} *:m* *:mo* *:move* *E134* Move the lines given by [range] to below the line given ...
3 votes
3 answers
663 views

Why does "e" move you one character before the actual end of the word?

Maybe it was discussed many times (I strongly believe), but I could not formulate my question properly. So lets imagine we have this sequence of words: foo bar baz Applying 3e will move us onto: ...
1 vote
1 answer
78 views

Next paragraph - don't skip lines with white spaces

When using { and } to skip to the next paragraph, the behavior is unpredictable since I can't see white spaces. I have tried to show line endings to see which lines have spaces, but I don't like the ...
3 votes
2 answers
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 ...
6 votes
2 answers
2k views

Why is % part of a word?

I have come across this behaviour and the documentation does not make sense to me. Consider this sentence: I am 100% sure there is something I am missing. This is the next line. Pressing w takes me ...
0 votes
0 answers
20 views

How to prevent Esc+Home from jumping to line 3?

I have Linux boxes running a mix of Gentoo and Arch Linux with VIM version 8.2, and one CentOS box with VIM 7.4. When I use VIM in a GUI terminal most of them jump to the third line from the top of ...
4 votes
2 answers
4k 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. Or, select multiple ...
2 votes
2 answers
251 views

How to speed up cursor movement?

When I hold the key k to move cursor up, is it possible to speed up the cursor movement? I know that I can combine number with command (like: 20k) to move up many lines, but sometime I just prefer to ...
0 votes
2 answers
133 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 ...
3 votes
3 answers
3k views

Moving to the end of the last word on a line

There are commands to distinguish between the beginning of a line (0) and the beginning of the first word of the line (^), basically ignoring leading whitespace. But I can only find one way to move ...
22 votes
2 answers
10k views

How do I make Vim always display several lines after EOF?

In Vim, I don't like how when you reach end of file it puts the last line at the bottom of the screen. Is there anyway to make the last line be something like 10 lines above the bottom of the screen ...
0 votes
0 answers
41 views

Go to end of last pasted region

Sometimes `] works, but not after inserting some new text somewhere. How can I jump to the end (and/or start) of the last region of text I pasted with some variant of p? `] does not work here: vim --...
126 votes
3 answers
13k views

How do I navigate to topics in Vim's documentation?

In Vim's built-in help system, how do I… search for topics that I want help on? follow hyperlinks? browse around for related material?
2 votes
4 answers
345 views

How to move cursor up to nearest upward smaller level of indentation

Imagine my cursor is where the ^ is in this document: { "first": [ { "second": { "third": [ "fourth" ] } }, {...
1 vote
2 answers
89 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> ...
1 vote
1 answer
41 views

How to get H and L commands to work properly in command mode

In vim's command mode, when I type 'H' the cursor usually doesn't go all the way to the top of the window, and 'L' doesn't go all the way to the bottom. To investigate the problem, I created a 60-line ...
31 votes
4 answers
6k views

How do I deal with very long lines in text (500+ characters)?

For some text formats, line breaks matter. For example, I often use Vim to write MediaWiki documents, where you can't just put a linebreak anywhere (unlike Markdown). So I'm forced to write lines ...
12 votes
4 answers
4k 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. (...
13 votes
4 answers
4k views

Moving to an outer block

Does anybody know the command for moving to an outer block of brackets/parentheses? Lets say that my cursor is in the innermost bracket. I know that % moves to a matching bracket, but is there a ...
0 votes
1 answer
140 views

How do I undo a fold?

I noticed that when I fold some text with zf and then press u for undo it does not undo the fold but undoes the last text editing action. Is there a general-purpose undo command which also would undo ...
0 votes
0 answers
38 views

Is there a command to jump to the next line after the end of a fold?

If my cursor is on a fold, I'd like to jump down to the next line after the fold ends. Is there a quick way to do that, i.e. by specifying "end of fold" as a place to move to in some way?
-1 votes
3 answers
100 views

Is there a built-in method to jump to the next character after a tab character?

I am editing tab-delimited data in a plaintext file (that was originally a spreadsheet) and I'd like to quickly jump forward to the next entry, the character after the next "tab" character. ...
22 votes
5 answers
12k views

Scroll a quarter (25%) of the screen up or down

I often find scrolling a full page too disorienting, half a page too much, but a quarter page is just right. I currently do it just by holding down the arrow keys. How do I scroll 25% of the page ...
0 votes
2 answers
68 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
1 answer
166 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 ...

1
2 3 4 5 6