Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pbrisbin/vim-runfile
Uniform run command for interpreted files
https://github.com/pbrisbin/vim-runfile
Last synced: about 2 months ago
JSON representation
Uniform run command for interpreted files
- Host: GitHub
- URL: https://github.com/pbrisbin/vim-runfile
- Owner: pbrisbin
- Created: 2012-05-14T22:11:21.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2015-10-20T15:33:54.000Z (about 9 years ago)
- Last Synced: 2024-10-09T09:45:11.859Z (3 months ago)
- Language: VimL
- Size: 136 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# runfile
I was sick of adding a bunch of `r` mappings to "run" the
various executable or interpretable file types I work in. Why not a
single function that auto-magically runs the correct command using some
simple rules based on the file name and type?It should do the Right Thing most of the time and I should be able to
easily customize and override in `.vimrc`.## Installation
Use [pathogen][].
```
$ cd .vim/bundle
$ git clone https://github.com/pbrisbin/vim-runfile
```[pathogen]: https://github.com/tpope/vim-pathogen
## Usage
```vim
:Run
```## Default Rules
```
If file is executable... Then :Run means...
!%If the filetype matches... Then :Run means...
cram !cram %
cucumber !cucumber %
go !go run %
haskell !runhaskell %
html !$BROWSER %
python !python %
ruby !ruby -Ilib %
sh !/bin/sh %
vim source %
```
## ExtendingIf the maps `g:runfile_by_name` or `g:runfile_by_type` exist, they are
merged into the default rules when the plugin first loads.### Example
```vim
let g:runfile_by_name = {
\ 'config.ru': '!rackup %',
\ }let g:runfile_by_type = {
\ 'markdown': '!markdown2pdf %',
\ 'html' : '%!tidy',
\ }
```## Notes
1. Right now, the pattern in `_by_name` is matched against the filename,
not the full path. I might change that if it seems limiting.2. The filename pattern is regex, not glob.
3. The command part of the mapping can be any vim command, it need not
execute anything.4. The rules are tried in key-alphabetical order, not definition order as you
might expect or want. This is because of vim, not by design.