How to effectively navigate through files in vim?
Asked Answered
A

6

5

When you are using vim, is there a way to have a GUI-style navigation panel to open files in the your source code directory?

Something that's somewhat similar to the Sublime Text GUI sidebar? Picture below describing what I mean:

sublime text file directory sidebar

Altheta answered 27/1, 2020 at 21:42 Comment(2)
Hi, a lot of people have asked questions about file navigation with Vim. Your version of this question makes me think you might want to look at Nerdtree. Did you see this post on Vim file navigation? #54164?Bloodmobile
Was hoping there might be a more visual representation of the file directoryAltheta
C
6

I use NERDTree, which provides a sidebar for file selection. Next to that you are also able to do file operations like moving them or creating new ones.

If you want each file to be accompanied by an icon that reflects what extension it is, you can also install vim-devicons. But then you should also install one of the nerd-fonts and set it as the font for your terminal.

Cesaria answered 28/1, 2020 at 12:22 Comment(1)
No problem, happy VIMing! :)Cesaria
J
8

Builtin: use netrw’s command :Explore.

Jonniejonny answered 28/1, 2020 at 19:5 Comment(0)
C
6

I use NERDTree, which provides a sidebar for file selection. Next to that you are also able to do file operations like moving them or creating new ones.

If you want each file to be accompanied by an icon that reflects what extension it is, you can also install vim-devicons. But then you should also install one of the nerd-fonts and set it as the font for your terminal.

Cesaria answered 28/1, 2020 at 12:22 Comment(1)
No problem, happy VIMing! :)Cesaria
D
5

My way to handle this is :30vs. . "30" sets the width of the sidebar, "vs" splits your screen vertically and "." is for your current directory. With p your can preview the files.

Dirge answered 29/1, 2020 at 19:29 Comment(0)
A
2

Nerdtree, devicons and nerdtree-git are doing a really nice job together.

NerdTree is just an window on the left side and I can simply switch to it with <ctrl>+w h.

That's how it looks with my config. Vim with nerdtree, devicons and nerdtree git. And some other plugins

Just in case you want to get a config to start: You can take mine

Allier answered 28/1, 2020 at 21:8 Comment(0)
U
1
  1. press Esc button for canceling all modes(INPUT mode for example)

  2. Ctrl + x for activating completion mode

  3. Ctrl + f for watching files

If you all did right you should see the following

enter image description here

Unpeople answered 27/1, 2020 at 22:20 Comment(0)
T
1

With Neovim-qt you have :GuiTreeviewToggle which does exactly this: show GUI treeview control for the current subdirectory tree.

With GVim you cannot.

Tumular answered 28/1, 2020 at 10:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.