-
Notifications
You must be signed in to change notification settings - Fork 0
README
This plugin can...
- Run an entire buffer
- Run a specific selection
- Watch for changes and run buffer
One needs to specify the shell command needed to run the buffer. The plugin will prompt for a shell command when its missing and can also save the shell command for future use.
There are primarily two modes. Run and Live.
The default run mode mapping is <Leader>r
(<Leader>
is backslash by default.)
The results window height adjusts according to its content.
Live mode runs a specified shell command for the contents of the current buffer when certain events are triggered. The default events are leaving Insert mode and writing the current buffer.
Live mode is triggered by the plugin command :WatchBuffer
Other than the 2 installation steps, this plugin requires no additional configuration to get started. In the above example when
<Leader>r
or:WatchBuffer
is run, the plugin will ask for the shell command to associate with the current buffer
Each buffer can have its own results window and its own separate shell command.
For a more permanent usage, one can use the ftplugin folder or an autocommand.
Vim detects the file type and reads the appropriate file from the ftplugin directory. For example, to add a coffeescript mapping for run_live:
" ~/.vim/ftplugin/coffee.vim
let b:run_live_command = 'coffee'
autocmd! FileType coffee let b:run_live_command = 'coffee'
This plugin also provides a way to save user entered shell command for future use.
let g:run_live_remember_entered_command = 1
This plugin is sourced using Vim's autoload feature. Hence it takes no toll on Vim start up time(which is minimal anyways).
If you don't have a preferred installation method, I recommend using Vundle
With Vundle, you may simply add Bundle 'notalex/vim-run-live' to your .vimrc and run
:BundleInstall