Blog Tags: 

Vim smartopen plugin adds Vim support for CDPATH

Overview

Ever since I discovered CDPATH last year I've been thinking wouldn't it be great if Vim could access files using CDPATH without having to chdir anywhere first. In other words, why can't Vim understand that it has to look for tklbam/restore.py in the CDPATH instead of telling me that it doesn't exist in the current working directory?

I started experimenting with Vim hooks and eventually figured out how to implement this as a generic mechanism that defines a more useful way for Vim to access the filesystem.

Blog Tags: 

Introduction to Vim

Table of contents

Blog Tags: 

Vim file exploration tips

Find filename patterns

Using Vim's built-in file explorer, it's possible to find specific filenames by pattern. For example:

# :Ex is short for :Explore

# search all subdirectories
:Ex */Makefile
:Ex */*.c

# search recursively
:Ex **/Makefile
:Ex **/*.c
:Ex **/*tpl*

This will take you straight to the first match. If you want the next match after that:

<Shift-DownArrow>

And back: