All Projects → rhysd → Wandbox Vim

rhysd / Wandbox Vim

Wandbox plugin for vimmers. http://melpon.org/wandbox/

Projects that are alternatives of or similar to Wandbox Vim

Vim Translate
A tiny translate-shell wrapper for Vim
Stars: ✭ 70 (-27.84%)
Mutual labels:  vim-plugin
Vim Plugin Viewdoc
Vim plugin: flexible viewer for any documentation
Stars: ✭ 79 (-18.56%)
Mutual labels:  vim-plugin
Vim Which Key
🌷 Vim plugin that shows keybindings in popup
Stars: ✭ 1,310 (+1250.52%)
Mutual labels:  vim-plugin
Fzf Filemru
File MRU with fzf.vim
Stars: ✭ 76 (-21.65%)
Mutual labels:  vim-plugin
Vim Airline Tomato
Pomodoro Technique
Stars: ✭ 79 (-18.56%)
Mutual labels:  vim-plugin
Learn Vim
无废话极简版Vim学习笔记!文章按主题分拆为多个章节,并尽量控制每节的信息量;通过文字色彩和字体,将命令、快捷键突出显示;在每节结尾,提供一个命令列表,以便回顾文中介绍的重要命令。如果这些文章能对喜欢Vim的朋友有所益处,我将不胜荣幸。
Stars: ✭ 83 (-14.43%)
Mutual labels:  vim-plugin
Shirotelin
shirotelin is Ultimate standard light colorscheme for Vim and Neovim!
Stars: ✭ 69 (-28.87%)
Mutual labels:  vim-plugin
Inline edit.vim
Edit code that's embedded within other code
Stars: ✭ 94 (-3.09%)
Mutual labels:  vim-plugin
Vista.vim
🌵 Viewer & Finder for LSP symbols and tags
Stars: ✭ 1,218 (+1155.67%)
Mutual labels:  vim-plugin
Vim Haskell Indent
If the plugin does not work for some syntax, feel free to report to the issue tracker!
Stars: ✭ 90 (-7.22%)
Mutual labels:  vim-plugin
Vim Litecorrect
Lightweight auto-correction for Vim
Stars: ✭ 77 (-20.62%)
Mutual labels:  vim-plugin
Fzf Mru.vim
Vim plugin that is using fzf.vim to display your most recently used files.
Stars: ✭ 79 (-18.56%)
Mutual labels:  vim-plugin
Todoist.nvim
A todoist extension for neovim
Stars: ✭ 84 (-13.4%)
Mutual labels:  vim-plugin
Vim Pencil
Rethinking Vim as a tool for writing
Stars: ✭ 1,186 (+1122.68%)
Mutual labels:  vim-plugin
Rainbow
Rainbow Parentheses Improved, shorter code, no level limit, smooth and fast, powerful configuration.
Stars: ✭ 1,324 (+1264.95%)
Mutual labels:  vim-plugin
Tcomment vim
An extensible & universal comment vim-plugin that also handles embedded filetypes
Stars: ✭ 1,162 (+1097.94%)
Mutual labels:  vim-plugin
Incsearch Easymotion.vim
Stars: ✭ 82 (-15.46%)
Mutual labels:  vim-plugin
Vim Table Mode
VIM Table Mode for instant table creation.
Stars: ✭ 1,341 (+1282.47%)
Mutual labels:  vim-plugin
Asyncrun.vim
🚀 Run Async Shell Commands in Vim 8.0 / NeoVim and Output to the Quickfix Window !!
Stars: ✭ 1,332 (+1273.2%)
Mutual labels:  vim-plugin
Vim Rfc
📓 Query RFC database and download RFCs from within Vim.
Stars: ✭ 88 (-9.28%)
Mutual labels:  vim-plugin

Wandbox for vimmers

This is a Vim plugin to use Wandbox 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.

screenshot

What is Wandbox?

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 is here.

Usage

:[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 like gcc-head, clang-head, gcc-4.8.2, clang-3.3... Default value is gcc-head for C++. See autoload/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 like warning, c++1y, boost-1.55... This value must be comma-separated and no space is allowed like warning,c++1y,boost-1.55. Default value is warning,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 or wget command and vimproc 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.

Example

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 with vim-quickrun, wandbox runner for quickrun is available.

:QuickRun -runner wandbox

Installation

Use modern plugin manager like neobundle.vim or vundle.

Though it is NOT 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.git
cd wandbox-vim
cp -R autoload/* ~/.vim/autoload/
cp -R plugin/* ~/.vim/plugin/

Customization

Variables

You can set the default compiler and default options for each filetype by g:wandbox#default_compiler and g:wandbox#default_options.

" Set default compilers for each filetype
if ! exists('g:wandbox#default_compiler')
    let g:wandbox#default_compiler = {}
endif
let g: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 string
if ! exists('g:wandbox#default_options')
    let g:wandbox#default_options = {}
endif
let g:wandbox#default_options = {
\   'cpp' : 'warning,optimize,boost-1.55',
\   'haskell' : [
\     'haskell-warning',
\     'haskell-optimize',
\   ],
\ }

" Set extra options for compilers if you need
let g:wandbox#default_extra_options = {
\   'clang-head' : '-O3 -Werror',
\ }

Mappings

If you want to execute :Wandbox quickly, you can add mappings to :Wandbox like below.

" For all filetypes, use default compiler and options
noremap <Leader>wb :Wandbox<CR>
" For specific filetypes, specify compilers to use
augroup wandbox-settings
    autocmd!
    autocmd FileType cpp noremap <buffer><Leader>ww :Wandbox --compiler=gcc-head,clang-head<CR>
    autocmd FileType cpp noremap <buffer><Leader>wg :Wandbox --compiler=gcc-head<CR>
    autocmd FileType cpp noremap <buffer><Leader>wc :Wandbox --compiler=clang-head<CR>
augroup END

(Maybe) To Do

  • 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

Libraries wandbox-vim Using

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

References

  • Wandbox

https://wandbox.org/

  • Wandbox API

https://github.com/melpon/wandbox/blob/master/kennel2/API.rst

License

Copyright (c) 2013 rhysd

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included 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 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].