Calling GNOME/KDE default application from NERDTree

Feb 3, 2012No Comments

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.

Installation

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

Usage

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.

vim

Ivan Tkalin

I'm Ivan Tkalin, a professional software developer, located in Berlin, Germany.

Currently I'm interested in everything related to Ruby, JavaScript, PostgreSQL, HTML/CSS, Linux, Git and Vim.

If you want to contact me, please send me an email

Feel free to follow me on twitter and github