73 votes
Accepted

Why is using arrow keys in normal mode considered bad practice?

Actually this is not a bad practice. A lot of people (including Vim's doc as @B Layer's answer shows) argue that you shall not use arrow keys because it makes your hands move from the home row (the ...
statox's user avatar
  • 49k
49 votes

How to disable arrow keys in vim?

In case you, or someone else reading this topic, just wants to disable the key movements without the text warning enter the following lines in .vimrc noremap <Up> <Nop> noremap <Down&...
Beyer's user avatar
  • 591
42 votes
Accepted

Delete until the right end of the current inner block

I would use d]) which means delete (d) to the next unmatched ')' (])). See :help ]).
ryuichiro's user avatar
  • 1,151
41 votes

Why is using arrow keys in normal mode considered bad practice?

I don't know if this is really relevant any more, but I'm an old-timer so here's a bit of history. In the old days, VT100 terminals had arrow keys, but pressing one transmitted an escape sequence ...
dwilliss's user avatar
  • 511
38 votes
Accepted

How to delete line above/below cursor, but not current line?

:-d cuts the line above the current line. :-5d cuts the 5th line above the current line (but moves the cursor). :-5,-d cuts the 5 lines above the current line. :+,+5d cuts the 5 lines below the ...
romainl's user avatar
  • 38.4k
32 votes
Accepted

How to disable arrow keys in vim?

You can install the hardmode plugin and in your .vimrc put in let g:HardMode_level = 'wannabe' let g:HardMode_hardmodeMsg = 'Don''t use this!' autocmd VimEnter,BufNewFile,BufReadPost * silent! call ...
Amadan's user avatar
  • 684
32 votes
Accepted

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

Maybe ctrld and ctrlu could be what you are looking for. By default they move half of the screen. From :h CTRL-D: Scroll window Downwards in the buffer. The number of lines comes from the '...
statox's user avatar
  • 49k
31 votes
Accepted

How to restore the position of the cursor after executing a normal command?

You should use getpos(): To save you position in a variable: let save_pos = getpos(".") getpos() takes as argument a mark, here "." represents the current position of your cursor. And to restore ...
statox's user avatar
  • 49k
31 votes
Accepted

How to replace inner text with yanked text

You can use vi"p when inside "". This can replace text in yank register, so it matters when you want to use original yanked text more than once. EDIT: Additional info from Octaviour comment regarding ...
grodzik's user avatar
  • 4,488
30 votes

Why is using arrow keys in normal mode considered bad practice?

While I agree with @statox that no one should be chastised, shunned, excommunicated, or tarred-and-feathered if they choose to use the arrow keys...use your software however you see fit...I wouldn't ...
B Layer's user avatar
  • 19.4k
26 votes
Accepted

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

You can use ctrlE to scroll down your file, when you are at the end of the file it will add "virtual" line so the last line of the file is not at the bottom of the windows. Additionally you can use ...
statox's user avatar
  • 49k
26 votes
Accepted

Go to column number?

Just type 80| -> :h | This is perfect for interactive mode. When scripting, there are other ways.
Luc Hermitte's user avatar
  • 16.9k
23 votes
Accepted

How to go to end/get out of the parenthesis of a line in vim?

I'm not 100% clear if this is what you're asking, but I think you might be looking for: ]) This jumps to the nearest enclosing ). So if your cursor was on the / in the below: (2 / (3 + 5) * 9) ^...
Rich's user avatar
  • 30.9k
22 votes
Accepted

How to quickly add content in a new line at end of file?

If file is already opened in normal mode Use: Go G goes to the end of the file o enters insert mode on a line below the current one If you are opening the file from the command line You can open ...
Alex's user avatar
  • 1,283
20 votes
Accepted

Vim HardMode Fine Grain Movements

These are just a few of the movements that vim is capable of, these should get you going for now. TL;DR Use Vim's built in help feature on navigation or better still usr_03.txt Search google for vim ...
Archangel33's user avatar
18 votes

After copying a visual selection, return to original location

A possible solution is to use jumps: Before yanking or visually selecting you can set a new jump which you'll be able to access after your cursor has moved. To do so use m`. Then after your cursor ...
statox's user avatar
  • 49k
17 votes
Accepted

What is the difference between j, CTRL-J, <NL> and CTRL-N in normal mode?

Interesting that you mentioned <CR>. <CR> or carriage return, technically used to mean go to the start of the line. <NL>, or newline aka line feed (usually called LF), was used to ...
muru's user avatar
  • 24.7k
17 votes
Accepted

How do I get back to the previous line after moving?

Use `` to jump back to the exact position you were in before you searched/jumped, or '' to jump back to the start of the line you were on before you searched/jumped. You can also use CTRL+O and CTRL+...
Simone Carletti's user avatar
16 votes

Why is using arrow keys in normal mode considered bad practice?

Other answers have said that the efficiency loss from moving your hands from the home row isn't that big a deal, and I mostly agree. However, what is a big deal is when you are learning vim, always ...
Karl Bielefeldt's user avatar
15 votes

Moving to an outer block

[% and ]% provided by matchit or match-up The answer by Mass suggesting [{ and ]} works perfectly for unmatched curly brackets but only for curly brackets. This should be considered as an advantage. ...
Hotschke's user avatar
  • 4,590
14 votes

After copying a visual selection, return to original location

You can avoid moving the cursor with: :'{,'}y See :help range, :help mark-motions, and :help :y.
romainl's user avatar
  • 38.4k
14 votes
Accepted

Move inside next quotes?

f" jumps to the next quote, and F" jumps to the previous one. 3f" jumps three more quotes, and so on. This seems enough to me. If the cursor is inside the quote, and you want to jump to the position ...
Violapterin's user avatar
13 votes

How to delete till the end of the previous line (i.e. to end of line above)?

Well, you can combine the "backward search" motion and the delete operator: d?$<Enter>
VanLaser's user avatar
  • 9,600
13 votes
Accepted

How to delete till the end of the previous line (i.e. to end of line above)?

Try d0kJx Deletes backwards to the beginning of the line, moves up, then joins the two lines and then removes the space in between the two joined lines. You don't have to leave normal mode with this....
Bryan Glazer's user avatar
13 votes
Accepted

Why does >3k move the cursor up when >3j does not move it down?

Yes, Vim automatically moves to the top most indented line. To see this, position the cursor in the middle of a paragraph and use >ap to indent the whole paragraph. Note that this is not specific ...
Lithis's user avatar
  • 1,020
12 votes

How do I jump to the location of my last edit?

Saving a character on the accepted answer: gi Will take the cursor to the exact point last edited and put you in insert mode, ready to continue typing. (It's also quicker to type!)
Noel Evans's user avatar
12 votes
Accepted

Mapping with motion

vim supports operator-mapping :h map-operator. What you need is an operatorfunc, and a mapping. for your needs, the followings codes work. Well it is just an example, you refine further. nmap <...
Kent's user avatar
  • 1,300
12 votes
Accepted

How to move cursor in a specific column

If you want to do it from the normal mode, just type: 15|. If you want to move to 15th column in 25th, type 25G15|. If you want to do it as a command you can type: :call cursor(25,15) but I think it ...
Thomas Baruchel's user avatar
12 votes
Accepted

Tag navigation using CTRL+] does not work with Non English keyboard on Windows

Say hello to knowledge fragmentation: https://stackoverflow.com/q/6932702/520162 This question was already asked and answered on StackOverflow. The key is to press CTRL and the key that is located ...
eckes's user avatar
  • 246
12 votes

After copying a visual selection, return to original location

My cursor is in the middle of a paragraph If you've just edited it, the simplest solution is to type g ; which will position your cursor on the last edit position. And if you haven't edited the ...
Al.G.'s user avatar
  • 357

Only top scored, non community-wiki answers of a minimum length are eligible