- Notifications
You must be signed in to change notification settings - Fork9
Wandbox plugin for vimmers.http://melpon.org/wandbox/
rhysd/wandbox-vim
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This is a Vim plugin to useWandbox in Vim.You can compile and execute the current buffer with one or more compilers and display the results in Vim without any registration.Now, Wandbox can execute C, C++, C#, D, Ruby, Python, Python3, PHP, Lua, Perl, Haskell, Erlang, Bash and SQL codes.
Wandbox is a new and cool social compilation service mainly for C++ers.You can use various versions of compilers and famous libraries.In addition, Wandbox provides some other languages like Ruby, Python, Haskell, D and so on.Wandbox has been created by @melpon and @kikairoya. Repository page ishere.
:[range]Wandbox [--compiler={compiler}] [--options={options}] [--compiler-options={options}] [--file={file}] [--runtime-options] [--stdin] [--stdin-file={stdin-file}]
If[range]
is omitted, whole buffer would be selected.
[--compiler={compiler}]
specifies a compiler likegcc-head
,clang-head
,gcc-4.8.2
,clang-3.3
... Default value isgcc-head
for C++. Seeautoload/wandbox.vim
to know default values of each filetype. You can set multiple compilers with comma-separated string like'gcc-head,clang-head'
.
[--options={options}]
specifies options for compilation likewarning
,c++1y
,boost-1.55
... This value must be comma-separated and no space is allowed likewarning,c++1y,boost-1.55
. Default value iswarning,gnu++1y,boost-1.55
for C++, 'haskell-warning' for Haskell, '' for others. If multiple compilers are set, you can set each options for the compilers with colon-separated string like'warning,c++11:warning,c++0x'
. When you set single options like'warning,c++11'
even if multiple compilers are set, all compilers uses the same option you set.
[--compiler-options={options}]
directly specifies compiler options like-Wall
,-std=c++17
,-O2
... This value must be separated by backslash comma (',') and no space is allowed like-Wall\,-std=c++17\,-O2
. If multiple compilers are set, you can set each options for the compilers with backslash-colon-separated string like-Wall\,-std=c++11\:-Wall\,-std=c++17
. When you set single options even if multiple compilers are set, all compilers uses the same option you set.
[--file={file}]
specifies the file to execute. If it is omitted, a current buffer will be executed.
[--runtime-options]
specifies arguments for the program at runtime. You can input the arguments.
[--stdin]
specifies stdin. You can input the arguments, or use global variable like--stdin=g:stdin
.
[--stdin-file]
specifies file which will be used as stdin.
Files included with relative paths in a source are expand automatically.To send requests asynchronously,curl
orwget
command andvimproc are required. Otherwise, requests are sent synchronously and they will block Vim.
The compile time messages (warnings, errors) are output to a quickfix window and the program output messages are output to a message window.
Execute the buffer with default compiler and options.
:Wandbox
Execute the buffer with clang and gcc at the same time.
:Wandbox --compiler=clang-head,gcc-head
When you want to know about options,
:WandboxOptionList
If you want to search incrementally,unite.vim is a good choice.
:Unite output:WandboxOptionList
Below is an example for heavy use.
:Wandbox --compiler=clang-3.3 --options=boost-1.55,c++1y,warning,optimize,sprout
If you want to use wandbox withvim-quickrun,wandbox
runner for quickrun is available.
:QuickRun -runner wandbox
Use modern plugin manager likeneobundle.vim orvundle.
Though it isNOT recommended, you can install manually by copying the files in this repository into your Vim script directory which is usually~/.vim/
, or$HOME/vimfiles
on Windows.
git clone https://github.com/rhysd/wandbox-vim.gitcd wandbox-vimcp -R autoload/*~/.vim/autoload/cp -R plugin/*~/.vim/plugin/
You can set the default compiler and default options for each filetype byg:wandbox#default_compiler
andg:wandbox#default_options
.
" Set default compilers for each filetypeif !exists('g:wandbox#default_compiler')letg:wandbox#default_compiler= {}endifletg:wandbox#default_compiler= {\'cpp' :'clang-head',\'ruby' :'ruby-1.9.3-p0',\}" Set default options for each filetype. Type of value is string or list of stringif !exists('g:wandbox#default_options')letg:wandbox#default_options= {}endifletg:wandbox#default_options= {\'cpp' :'warning,optimize,boost-1.55',\'haskell' : [\'haskell-warning',\'haskell-optimize',\ ],\}" Set extra options for compilers if you needletg:wandbox#default_extra_options= {\'clang-head' :'-O3 -Werror',\}
If you want to execute:Wandbox
quickly, you can add mappings to:Wandbox
like below.
" For all filetypes, use default compiler and optionsnoremap<Leader>wb :Wandbox<CR>" For specific filetypes, specify compilers to useaugroupwandbox-settingsautocmd!autocmdFileTypecppnoremap<buffer><Leader>ww :Wandbox --compiler=gcc-head,clang-head<CR>autocmdFileTypecppnoremap<buffer><Leader>wg :Wandbox --compiler=gcc-head<CR>autocmdFileTypecppnoremap<buffer><Leader>wc :Wandbox --compiler=clang-head<CR>augroupEND
- Better command interface
- Unite interface for compiler options
- Unite interface for compilers
- Persistent caching for options which would be used in quickrun type generation and unite interface
doc/wandbox.txt
- Execute remote Gist code
- No plugin is allowed to have no test
- Make an option list prettier
- Separate default setting and user setting
- Output error and warning to location-list
- Retry if request is timed out
wandbox-vim is standing on the shoulders of below libraries (you don't need to install below by your hand).
- Vital.Web.HTTP
- Vital.Web.JSON
- Vital.OptionParser
- Vital.Data.List
- Vital.Prelude
- vim-prettyprint
- Wandbox
- Wandbox API
https://github.com/melpon/wandbox/blob/master/kennel2/API.rst
Copyright (c) 2013 rhysd
Permission is hereby granted, free of charge, to any person obtaininga copy of this software and associated documentation files (the"Software"), to deal in the Software without restriction, includingwithout limitation the rights to use, copy, modify, merge, publish,distribute, sublicense, and/or sell copies of the Software, and topermit persons to whom the Software is furnished to do so, subject tothe following conditions:The above copyright notice and this permission notice shall beincluded in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OFMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANYCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THESOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.