The vim-pathaction Vim plugin provides an interface for executing .pathaction.yaml rules directly from Vim through the pathaction cli, a flexible tool for running commands on files and directories.
Think of pathaction like a Makefile for any file or directory in the filesystem. It uses a .pathaction.yaml file to figure out which command to run, and you can even use Jinja2 templating to make those commands dynamic. You can also use tags to define multiple actions for the exact same file type, like setting up one tag to run a script, and another to debug it.
This tool is for software developers who manage multiple projects across diverse ecosystems and want to eliminate the cognitive load of switching between different build tools, environment configurations, and deployment methods. Just run one single command on any file and trust that it gets handled correctly.
If this package helps your workflow, please show your support by ⭐ starring pathaction.el on GitHub to help more software developers discover its benefits.
Usage
Keybindings
Below are two examples of key bindings (<leader>ee to execute the “main” tag and <leader>ei to execute the “install” tag):
nnoremap <leader>ee :call pathaction#run("main")<CR>
nnoremap <leader>ei :call pathaction#run("install")<CR>
nnoremap <leader>ed :call pathaction#run("debug")<CR>
Allow the directory explicitly
By default, pathaction does not read rule-set files such as .pathaction.yaml from arbitrary directories. The target directory must be explicitly permitted.
For example, to allow Pathaction to load .pathaction.yaml rules from ~/projects and its subdirectories, run the following command:
pathaction --allow-dir ~/projects
Author and license
Copyright (C) 2021-2026 James Cherti.
Distributed under terms of the MIT license.
Installation
Installation with Vim’s built-in package manager (Vim 8 and above)
mkdir -p ~/.vim/pack/jamescherti/start
cd ~/.vim/pack/jamescherti/start
git clone --depth 1 https://github.com/jamescherti/vim-pathaction
vim -u NONE -c "helptags vim-pathaction/doc" -c q
Installation with a third-party plugin manager
You can also install this Vim plugin with any third-party plugin manager such as Pathogen or Vundle.
Links
- vim-pathaction, a Vim plugin that allows executing the
pathactioncommand-line tool directly from Vim. - The
pathactioncommand-line tool (requirement): pathaction cli - For Emacs users: pathaction.el, an Emacs package that allows executing the
pathactioncommand-line tool directly from Emacs.
Related posts:
- pathaction.el: An Emacs package for executing pathaction rules, the universal Makefile for the entire filesystem
- ultisnips-mode.el: An Emacs major mode for editing Ultisnips snippet files (*.snippets files)
- bash-stdops – A collection of Bash helper scripts that facilitate operations
- Master the HJKL navigation with the Vim plugin Hjklmode, which can help breaking the habit of moving the right hand away from the home row
- Vim: Edit all the files in the current directory of a Git repository in new tabs (git ls-files)
- Vim: Enhance Vim tabs (file name only, file status, and the ability to rename tabs)
- Vim script: Replace the home directory with a tilde ~
- A Vim plugin for persisting and restoring Vim editing sessions
- Vim theme: tomorrow-night-deepblue, a refreshing color scheme with a deep blue background
- A Vim function that returns all monospaced fonts (UNIX / Linux only)
- Vim: Tango color scheme for Vim’s built-in Terminal
- Vim: Open documentation in a new tab for the word under the cursor (Vim help, Python, man pages, Markdown, Ansible…)
- How to make Vim edit/diff files from outside of Vim? (e.g. from a shell like Bash, Zsh, Fish..)
- Vim: Quickly replace the word that is under the cursor
- Set up Vim to use Fasd for quickly jumping to directories
- Lightvim – The Efficient Minimal Vim/Neovim Configuration
- Configure XFCE 4 programmatically with the help of watch-xfce-xfconf
- Pathaction, a universal Makefile for your entire filesystem: Run rule-driven commands on any file or directory
- Gentoo Linux: Printer driver for the Brother QL-1110NWB
- Python: Tab completion against a list of strings (readline)