A simple plugin to make run Ruby code on Vim. Inspired by vim-ruby-run.
- Run only ruby code. So, the default keymap is freely available to another use by another buffers with another filetypes
- This plugin run script in four different ways:
Work in progress (see TODO).
Use your favorite plugin manager, or try dein.vim.
Install dein.vim, and add the following line to your ~/.vimrc
:
call dein#add('sinetoami/vim-rbrun')
And then execute the following command on to your Vim:
:call dein#install()
If you are not using a package manager, download manually the zip repo and extract the files to ~/.vim
:
$ cp vim-rbrun-master.zip ~/.vim
$ cd ~/.vim
$ unzip vim-rbrun-master.zip -d /destination/plugins/folder
$ rm vim-rbrun-master.zip
This section will contain a brief documentation.
let g:rbrun_strategy = "vimux"
There are two defined values for this variable: vimux
and basic
. The vimux
value will
force the command to run on a tmux
pane using VimuxRunCommand
function provided by the
vimux plugin. The basic
is enabled by default and run the command
with :!
on Neovim.
let g:rbrun_enable_mappings = 0
When this variable is set with 0
, disable default mappings (enabled by default with: 1
).
let g:rbrun_maps = { 'RunScript': '<A-e>' }
This variable receive a dictionary in a form of {'rbrun-command-aliases': 'map'}
.
- rbrun-command-aliases will receive one of a rbrun default command aliases
- map will receive a map that you want
By default, vim-rbrun define the following command aliases with one respective default map:
let g:rbrun_maps = {
\'RunScript': '<A-e>',
\'RunLine': '<C-x>',
\'RunCodeBlock': '<C-x>',
\'PasteOutputLine': '<C-A-x>',
\'PasteOutputBlock': '<C-A-x>'
}
If you want to change one of these maps, do something such the following line:
let g:rbrun_maps = { 'PasteOutputLine': '<leader>rbl' }
Set this will just change the map that corresponds with PasteOutputLine
aliases. This will paste the output of the line under the cursor using <leader>rbl
shortcut.
<Plug>RbRunScript
will run the current file<Plug>RbRunLine
will run the line under the cursor<Plug>RbRunPasteOutputLine
will paste output of the line under the cursor<Plug>RbRunCodeBlock
will run a piece of selected code block<Plug>RbRunPasteOutputBlock
will paste output of the selected code block
- Do paste output of all current script
Do you like this plugin? Come on: