Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.
47 votes
Accepted

Navigation in insert mode

There are many options you have. One option, and IMO the sanest and easiest is to just stop disabling the arrow keys. I understand why many hardcore vimmers say things like You should never ever use ...
user avatar
  • 16.5k
34 votes
Accepted

Trying to move away from arrow keys in normal/insert/visual mode, but small text inserts are killing me!

I believe that the art of Vim has nothing to do with disallowing any tools available for you, but rather finding the best (i.e., most efficient) path to altering text. The truth is that sometimes the ...
user avatar
  • 706
18 votes

Navigation in insert mode

I like to use the Control key to turn the hjkl movement keys into "universal" movement keys. Here's the relevant bit of my .vimrc: " In insert or command mode, move normally by using Ctrl inoremap &...
user avatar
10 votes
Accepted

Jump to Next Number

Ctrl+A and Ctrl+X will both jump the cursor to the next number on the line. However, the former will increment the number and the latter will decrement it. You don't want to make any changes, so you ...
user avatar
  • 27.4k
10 votes
Accepted

move forward by a certain number of chars or bytes?

To go to the Nth byte in the file: use :go N, :Ngo, or Ngo (normal mode). To move N bytes ahead, you could use something like this :exe 'go' line2byte(line("."))+col(".")-1+N Unless you have ...
user avatar
  • 12.6k
9 votes
Accepted

Swap two shortcuts

Yes. You can change just about anything you want to change in Vim. Just do nnoremap <C-f> <C-b> nnoremap <C-b> <C-f> Add those two mappings in your vimrc file and you've ...
user avatar
9 votes

Trying to move away from arrow keys in normal/insert/visual mode, but small text inserts are killing me!

My solution is to use everything vim offers me: HJKL, /, FftT, {n}w/b/e, ^, $, %, [], ][, [{, and also arrow keys, control arrow keys, home, end, Pg Up and Down, the mouse... Arrow keys and hjkl are ...
user avatar
8 votes
Accepted

Brace { } navigation without opening folds

Thanks to @romainl for this answer on super user. I couldn't have written this without their help! You can use the foldopen option to determine which set of motions will or won't open a fold. From :h ...
user avatar
  • 16.5k
8 votes

Jump to Next Number

To summarize the comments and make this a full answer: The general search command is shortest: /\d<Enter>. You can then repeat the search with n / N, as usual. To skip to the next full number, ...
user avatar
  • 16.6k
8 votes
Accepted

How to navigate long lines like separate lines?

You can use the gj and gk commands to move the cursor to the character in the next or previous display lines, even when lines wrap. See :help gj and :help gk for details. If you would like to ...
user avatar
  • 9,773
7 votes
Accepted

Go forward to first alphabetic character

Based on DLMcMMayhem's hint, I found that following search will do what you need: /\A*\zs\a \A* searches for zero or more non-alphabetic characters (equivalent to [^A-Za-z]) \a searches for any ...
user avatar
  • 284
7 votes
Accepted

How to show the current location in a yaml hierarchy

The right way to do it would be to use an external program if the markup language presents a complex structure or particular edge cases, like the bunch of tools you can find for JSON. Though YAML ...
user avatar
  • 1,506
7 votes
Accepted

Show Outline of Code

This is possible with Tagbar plugin, which use ctags to generate the tags. Used in collaboration with Universal Ctags, it supports various langages.
user avatar
  • 363
7 votes

Navigation in insert mode

Hit esc then use hjkl and wWbB and any other navigations you would like to make. The whole point of hard mode is to get you to learn to navigate with more complex vim motions. Make small edits then ...
user avatar
7 votes

Navigation in insert mode

If you just need to modify a small amount of text or a word, you can use <Ctrl-O>h/j/k/l. <Ctrl-O> takes you back to Normal mode just for that command, and then drops you back into insert ...
user avatar
  • 825
7 votes

How to jump to the previous location in the same file?

FYI I wrote this before the question was updated to make it clear that OP wants to jump to the previous location repeatedly. Given that this answer still addresses the question asked in the subject ...
user avatar
  • 18.1k
6 votes

List of buffers in view pane

I would also add that in gVim you can get a very close approximation to this feature. If you click on the buffers menu item and then click the "tear off" (--✂-----) button. It opens up a little window ...
user avatar
  • 7,406
6 votes

List of buffers in view pane

You can use GVim on Windows so Vim is not really a valid reason for switching to Linux. You can display a list of buffers with :ls. For the last time: Read The Fantastic Manual.
user avatar
  • 32.6k
6 votes
Accepted

moving through the doc, caret staying centered

You're looking for :h 'scrolloff': 'scrolloff' 'so' number (default 0) global Minimal number of screen lines to keep above and below the cursor. So you can add something like ...
user avatar
  • 45.9k
6 votes

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

*CTRL-D* CTRL-D Scroll window Downwards in the buffer. The number of lines comes from the 'scroll' option (default: half a screen). <b>If [count] given, first ...
user avatar
  • 5,868
6 votes

Trying to move away from arrow keys in normal/insert/visual mode, but small text inserts are killing me!

In general I try to stay out of insert mode as much as is humanly possible. (A fact I alluded to in the comments.) Most of the time, for lots of small edits I make to nearby lines, I will endeavour to ...
user avatar
  • 27.4k
5 votes
Accepted

How do I jump to the next line with the same indent level?

I think that some plugins might do what you want: they create text objects based on the indentation and then let you navigate between these text objects. But installing a plugin just for that is not ...
user avatar
  • 45.9k
5 votes

Navigate to tag in a new tab if not already opened, like `tab drop`?

Put this in your vimrc: map <C-]> :TabExpand 1<CR> command -nargs=1 TabExpand call HandleTabTagExpand( <f-args> ) let s:commentchar = """ function HandleTabTagExpand(tagnumber) ...
user avatar
  • 426
5 votes
Accepted

Moving up and down wrapped lines

You can move up and down between the "display lines" of a wrapped line with the gj and gk normal mode commands. If you find this unintuitive, a fairly common mapping is to swap these with ...
user avatar
  • 27.4k
4 votes

Navigation in insert mode

If you want to move more than ONE or TWO positions... ...the best choice is to hit ESC, move around, and get back to insert mode again. There's no point on create mappings like <C-h> to move ...
user avatar
4 votes
Accepted

Is there a way to change the "current buffer"--the one that gets defined when I use "n" and "N"?

With :n you are going through the argument list. You can use :args to see where you are in the current argument list. You can use :first to start at the beginning and use :last to go to the last ...
user avatar
4 votes

moving through the doc, caret staying centered

You can also use CTRL-e and CTRL-y to move the view, while not moving the cursor. At the end of your file, you can use CTRL-e until the last line of the document is at the first line of the page.
user avatar
  • 1,253
4 votes
Accepted

Why are split and tab navigations distinct?

Tab navigation is one dimensional, so it has commands which mirror similar commands, :bn, :cp, etc. Window navigation is two dimensional, so it has commands that align with the two dimensional normal ...
user avatar
  • 27.4k
4 votes
Accepted

Fastest way to navigate various points in vim

I'd like to primarily challenge the premise of your question/challenge/race: What would be the fastest that someone could get to those four locations in vim? When you're editing text, you're not ...
user avatar
  • 25.5k
4 votes

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

Most likely the developer didn't feel that this feature is important enough to deserve a simple key. On the other hand it is possible to create mappings using 1<C-d> and 1<C-u> when you ...
user avatar
  • 8,520

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