Questions tagged [cursor-movement]
Moving the cursor another place in the buffer.
277
questions
0
votes
1
answer
19
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 ...
1
vote
1
answer
24
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 withing their individual components instead of treating these names as a single word.
Right now, the ...
2
votes
3
answers
51
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
87
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, ...
1
vote
1
answer
32
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
35
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 ...
1
vote
1
answer
76
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 ...
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 ...
2
votes
2
answers
107
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
0
answers
39
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 --...
2
votes
4
answers
342
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
1
answer
37
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 ...
0
votes
0
answers
33
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?
0
votes
1
answer
108
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 ...
-1
votes
3
answers
79
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.
...
0
votes
2
answers
93
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 ...
0
votes
2
answers
57
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
0
answers
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
1
answer
115
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
1
answer
139
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....
1
vote
1
answer
216
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
0
answers
25
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
1
answer
70
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
1
answer
62
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
1
answer
97
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
1
answer
39
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
0
answers
43
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.
...
2
votes
3
answers
960
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
2
answers
61
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
1
answer
52
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
1
answer
54
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
1
answer
464
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
2
answers
104
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
0
answers
94
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
1
answer
112
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 ...
3
votes
1
answer
46
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 ...
4
votes
1
answer
667
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
2
answers
83
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
1
answer
37
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
2
answers
86
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
1
answer
29
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
1
answer
63
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
1
answer
31
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 ...
4
votes
2
answers
3k
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 ...
1
vote
2
answers
163
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
2
answers
70
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?
7
votes
1
answer
119
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
1
answer
90
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
1
answer
202
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 ...