Ivan Tkalin

I’m a software engineer. I solve problems.

Calling GNOME/KDE default application from NERDTree

Sometimes it is really nice to be able to call system default application for file or directory from vim. For example open Document Reader for a pdf file or browse directory with images with Nautilus. I didn’t find working solution for NERDTree, which I use for file system navigation in vim, so I wrote simple plugin for it.

What it does, it simply creates new menu item e(x)ecute in NERDTree menu, which executes system default application for selected file or directory. It works on Linux only and should work for GNOME and KDE.


The installation is very simple. If you use pathogen to manage your plugins:

$ cd ~/.vim
$ git clone git://github.com/ivalkeen/nerdtree-execute.git bundle/nerdtree-execute

or if use git submodules with pathogen (like me):

$ cd ~/.vim
$ git submodule add git://github.com/ivalkeen/nerdtree-execute.git bundle/nerdtree-execute

If you don’t use pathogen, then just start using it, or

$ cd ~/.vim
$ git clone git://github.com/ivalkeen/nerdtree-execute.git


When navigating in NERDTree, select file or directory, press ’m’ key, and NERDTree menu will appear. Press ‘x’ then to execute system default application for selected file/directory, using this plugin. You can open your favourite image editor for images, pdf reader for pdfs etc.