work with multiple files in vim

When working with multi files in vim, there are several options.

Netrw

Was first trying to use the netrw which comes with vim installation. However it is not quite easy to use. :e. is to open the file explore, or :Exp, or : Vex, or :Sex.

NERDTree

Nerdtree is the de facto file explore. After the frustration with netrw, i decided to give it a a try and it has so many github stars for some reasons. Unlike a lot of custom config in netrw, most nerdtree config is out of box.

  • s to open a file in a file in a vertical spli
  • I to show hidden files in explorer
  • m to open menu with options to do CRUD.
  • Tabs also works nice with t open in new tab and gt or #NUMBERgt to navigate between them. and use ctrl + w to toggle focus.
  • ? to show the available shortcuts.

Vim plug

vim-plug is a new vim plugin management tool which seems to be better than others like vbundle. it allows lazy loading plugins which is awesome. The config is also easy, just add the desired plugin into .vimrc and run :PlugInstall. To remove plugin, delete the line in .vimrc and run :PluginClear.

super tab

super tab is nice plugin for word/code completion. it leverages the vim popup for completion and the index is also smart.

terminal in vim

if you have vim 8, then :term is built in. (`:echo has(‘terminal’)` will output “1”.). Same as tabs in NERDTree, use `ctrl+w` to navigate between terminal and other tabs.

in macos use brew install vim --override-system-vi to upgrade to vim 8.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s