Questions tagged [navigation]

For questions about how to traverse through files, directories, and tabs inside of Vi/Vim.

Filter by
Sorted by
Tagged with
39
votes
5answers
31k views

Navigation in insert mode

I finally decided to ditch the arrow keys for navigation in favor of hjkl. I used the Vim hardmode plugin to disable the arrow keys. I got used to navigation pretty fast, but it turns out that ...
16
votes
8answers
3k views

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

I've disabled my arrow keys, and am finally getting used to hjkl (for the longest time I'd always hit j and k the wrong way around - just seemed more natural for some reason). In normal mode I'm fine ...
9
votes
3answers
932 views

How to show the current location in a yaml hierarchy

When working with larger or rather deeply nested yaml files (Hi Rails), it happens quickly that I loose sight of where I am with regards to the indentation hierarchy of the file. A very simple ...
6
votes
2answers
2k views

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

I have a space formatted (yaml) file like the following: en: templates: template: "VERYLONGTEXTHEREWITHHUNDREDSOFLINES" destination: "I want to jump here" other: stuff ...
6
votes
1answer
711 views

Brace { } navigation without opening folds

I use {/} a lot for navigating around, but when I do this I never intend to open a fold and jump to blank lines within the fold. How can I nremap { and } to skip over folds?
5
votes
2answers
2k views

Go forward to first alphabetic character

Is there a way to go forward to the first letter, maybe using f other than specifying the letter itself? In other words I want to skip over whitespace, symbols and digits. The reason I ask is that I ...
5
votes
1answer
3k views

move forward by a certain number of chars or bytes?

Sometimes I need to move to a particular byte offset or move to the nth unicode rune in a file (utf-8). Does vim expose a way to move to an absolute byte/char offset or to move the cursor forward a ...
5
votes
2answers
142 views

To pageup and pagedown without reserved lines

When I scroll a whole page up by ctrl-f, and down by ctrl-b, vim reserves 2 lines, and repeats them both in the previous GUI window and the present one. But I expect it not to repeat lines, because ...
4
votes
2answers
809 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 ...
4
votes
2answers
874 views

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

I mean like CTRL-O (repeatedly) but limited to the current file only. Sometimes I check stuff in another file(say using goto definition). And it loads it into the same window. Still, I want to focus ...
4
votes
1answer
769 views

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

What I expect from "tab-tag" navigation is the following behaviour: when need to jump to a tag: if the corresponding file is already opened in a window, navigate to it if it is not, open the buffer ...
4
votes
1answer
811 views

How to tag jump in new tab, if target file not in active tabs, else switch to exists tab?

I use the mapping below: nnoremap <silent><C-]> <C-w><C-]><C-w>T But it will open duplicate file in multiple tabs. I have two questions: Has vim built-in functions ...
4
votes
2answers
405 views

Equivalent to tmux CTRL+B z in vim?

In tmux if you have alot of panes open, you can press CTRL+B, z to zoom into that terminal pane. Is there a way to do the same thing in vim, to zoom into / out of the selected pane?
4
votes
0answers
47 views

Intermittently cannot switch from Vim terminal to other panes

I've looked at quite a few other posts and haven't found a similar problem. I've recently begun using WSL and Vim and love it. Most of the time, it works great and I use CTRL-W-h/j/k/l to navigate ...
3
votes
2answers
2k views

Jump to Next Number

Is there a command in Vim to move the cursor to the next number? I know I can do f2 to find the number 2 in the same line, but I'm looking for a more general number-jumping command.
3
votes
1answer
686 views

How to navigate long lines like separate lines?

When I have a very long line in vim it will be shown on the screen as multiple lines, like this: line no. | content | 100 | this is a very ...
3
votes
2answers
4k views

Show Outline of Code

Is there a way, built-in or with a plugin, to get an outline of my code in Vim? In Eclipse, there is a panel that shows an outline of the code in the file, showing a breakdown of the classes and ...
3
votes
2answers
113 views

how to jump to start of tag

I might have some text like the following: <foo>something very important</foo> 1 2 ^ 3 4 If the cursor is inside the tag, for example on the m character, what is ...
3
votes
1answer
50 views

Skip to next batch of search results (or find next non-match)?

So you search /needle, and end up trapped in a haystack of result lines. Is there a quick way to skip to the first non-matching line (and then the next batch of results)? E.g. I'm viewing the results ...
3
votes
1answer
71 views

ctags vs GNU id-tools?

I stumbled upon mkid tools in tips.txt and tried it out (on C code). In terms of navigating to definitions, I thought it was identical to using ctags except for the fact that the ID file (generated by ...
3
votes
1answer
153 views

How to treat underscores as whitespace when skipping to the next word? [duplicate]

Let's consider an example where the cursor is at the beginning of the text one_two three. Underscores are treated as part of the word, so w moves right to the first letter of three. With set ...
3
votes
1answer
271 views

How do you page through the jump list?

With the :jumps command, you can display the list of jump locations to aid navigation. That is you can use CTRL_O and CTRL_I to jump backwards and forwards respectively. However, my jump lists appear ...
2
votes
1answer
2k views

Swap two shortcuts

I'm very new to vim and found bindings Ctrl-F for page down and Ctrl-B for page up kind of inconvenient. I intuitively try to page up with Ctrl-F and page down with Ctrl-B because F is higher than B. ...
2
votes
1answer
74 views

How to move to top/bottom of region delimited by consecutive blank lines

I have two commands for somewhat emulating the Emacs command narrow-to-defun. I have two commands that move to the top/bottom of the current paragraph nnoremap <silent> <leader>gt mp{...
2
votes
1answer
209 views

To split long paragraph to next window

Now, I am starting to use vim to edit "normal text", that is, other than programming code. Thus, a "line" is really a paragraph, and is usually "long". In the very end of the current GUI window, ...
2
votes
1answer
87 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
1k views

Is it possible to clear the tag stack without jumping anywhere?

Vim keeps a stack of tags (displayable with :tags) that the user jumps to and from, similar to the jump list (displayable with :jumps). The jump list can be cleared with the :clearjumps command. This ...
1
vote
2answers
2k views

List of buffers in view pane

I must be turning a corner because I keep thinking of moving my text drafts off my Windows machine and onto my Linux box to get the convenience of editing them in Vim instead of Notepad++. One thing ...
1
vote
3answers
111 views

moving through the doc, caret staying centered

I move around using the arrows ←↓↑→, never really got used to the hjkl thing. I know I'm supposed to use the hjkl thing. When hitting ↓, it reaches a point where the caret is on the lower side of the ...
1
vote
3answers
194 views

Fastest way to navigate various points in vim

Is it possible for vim navigation to be as quick as a normal point-and-click navigation? For example, I've taken the following example here where I've created four points that need to be clicked: ...
1
vote
2answers
47 views

Can I navigate backwards by word (not WORD) in command-line mode?

If I'm in command-line mode in vim, and I have the current command line entered (cursor position shown with |): :somecommand somefilename.txt| I'd like to navigate backwards so that the cursor is ...
1
vote
2answers
51 views

Go back to previous position when coming out of quickfix

When I navigate out of the quickfix list, the split I get put back in is not the same as the one I left. For example: vim -u NONE :copen open quickfix list ^w w leave quickfix list :vsplit open a ...
1
vote
1answer
39 views

Why are split and tab navigations distinct?

Known: <Ctrl>w then any of hjkl. Known: :tab_<CR> where _ is either rlpn. Why is there not a <Ctrl> navigation for tabs nor a : for splits? Why do the navigation commands differ ...
1
vote
2answers
338 views

Move cursor to old position after scrolling

I often want to edit text in say line 200 of a file, but while doing this I need to look at say line 100, so I scroll to line 100. Is there a way to quickly jump back to line 200 after scrolling? Is ...
1
vote
2answers
95 views

Incremental search: is it possible to push 'Esc` without scrolling back?

My problem on this gif: I am in one place, searching for meta, I do not want to loose my current search highlighting (yes I know that I can restore it later in / menu). I found what I need - without ...
1
vote
1answer
113 views

configure vim to process argv and understand filename:linenumber

Does vim expose an api for manipulating argv before the "main program" looks at it? I want to be able to use the syntax: $ vim /path/to/my/file:100 and have it mean the same thing as $ vim +100 /...
1
vote
1answer
83 views

Add current position to the jump list the first time <C-u> or <C-d> is pressed

I'm often using <C-u> and <C-d> to quickly navigate around in my code (I don't like using { and } since they're hard to type on my layout). One thing that annoys me is that <C-u> and ...
1
vote
1answer
18 views

Quickly go to the end of "syntax highlighted" element

I am using syntax highlighting to help with writing LaTeX documents in vim. My documents involve a lot of brackets, and it is easy to do a trivial mistake and end-up with something which doesn't ...
1
vote
1answer
112 views

creating a menu for navigation in file

while coding in vim I use often special comment to denote section of the file. For example in C it is //;; some title 1 //;; some title 2 I have also configured a shortcut to print with a global ...
1
vote
1answer
296 views

Move to next keyword in vim?

I want to map W to jump to the next keyword of the language or jump to the next interestingly syntax highlighted word eg: For the following snippet SELECT * FROM Fruits WHERE Fruits.name = 'Apple'...
1
vote
1answer
80 views

Explore command not working in Terminal normal mode

In vim, I open a terminal using :term and enter the normal mode using <C-w> <N>. Then, :Explore does not open the vim's file navigation view, but creates a another split window of the ...
1
vote
1answer
72 views

navigate between current and previous tab or split

Is it possible to navigate between two previously used tabs and/or splits? I understand why buffers are best to use, and that I can use :b# to achieve what I want, but I have wondered if this was ...
1
vote
2answers
99 views

Read-only mode in Vim while using cscope?

I am traversing through a C code in Vim using cscope. Sometimes while traversing, some key gets pressed or mouse gets right-clicked and the Vim enters in insert mode, and it creates a mess to undo the ...
1
vote
3answers
678 views

Move to first word of paragraph in vim with { and }

Since Vim considers paragraphs as lines/sentences separated by blank lines the paragraph movement with { and } feels little weird to me as it takes you to the next blank line and you always have to ...
1
vote
1answer
426 views

changes command only display current file change history

The :changes command listed the change history of current file. However when I work with multiple buffers, I want to list changes to all the buffers I opened in current vim-server, like the behavior ...
1
vote
1answer
124 views

how to skip commented lines when navigating?

When navigating in normal mode by j or k, I want to skip commented lines. Is it possible? Is there a vimscript snippet for that?
1
vote
1answer
66 views

Stop curly braces navigation from leaving marks

When using curly braces navigation, {, }, to move between paragraph, overwrites the "last jump" mark (the one accessible via ''). I would find it more useful if it left this mark untouched. Is there ...
1
vote
1answer
79 views

How to search for vue components with vim's gf?

I want to go to a vue component file. Vue component filenames are written in PascalCase: ExampleComponent.vue In html (or in my case blade.php) the ExampleComponent.vue is instantiated by <example-...
1
vote
0answers
40 views

How to make Vim not be a line editor

Vim is famously (or infamously) a child of line-based editing. For many cases this is acceptable. But I wish to use it primarily as an academic tool with large amounts of text. I want the experience ...
1
vote
0answers
123 views

Code tour plugin

I was wondering if you know any helpful vim or neovim package/ way to show and explain your codebase to new people. The best way I managed to find up until now is https://marketplace.visualstudio.com/...