Sha256: 50e0dd0ef7646040a41368dab6cb4419b2612c5f99ae2df84e7894fb0f913569
Contents?: true
Size: 1.82 KB
Versions: 25
Compression:
Stored size: 1.82 KB
Contents
--- layout: post title: "Vim" permalink: /editors/vim/ keywords: editor, ide, ruby, picrate, vim, emacs, jedit --- ### Install vim You will probably need to install vim ```bash sudo apt-get install vim ``` Is an excellent choice for linux and mac users, it is lighweight (runs from the console) commands available from vim:- ```bash :!jruby % # will run the sketch ``` ### Live coding with Pry ### ```bash jgem install pry # or jruby -S gem install pry # or if you must use rvm or rbenv not recommended ``` Do `echo "Pry.config.editor = 'vim'" > ~/.pryrc` to set vim as the pry editor. Fire up pry using ```bash jruby -e "require 'pry'; binding.pry" ``` Or more conveniently create a shortcut by using `jpry` alias in your `.bashrc` or equivalent eg `.profile` debian linux:- ```bash alias jpry="jruby -e \"require 'pry'; binding.pry\"" ``` At the pry prompt:- ```ruby load 'my_sketch' ``` Creating `my_sketch` is a easy as `picrate -c my_sketch 300 300` To get full listing of sketch in pry enter `$` at the prompt, to edit the `draw` method at the prompt do:- ```bash edit -p MySketch#draw ``` On finished save and quit `:wq` (or `:wqa` to save all changed buffers) sketch will redraw reflecting changes, but you can repeat:- ```bash edit -p MySketch#draw ``` this allows you to edit your changes which are saved in a `.tmp` file. Read more about vim / emacs integration [here][pry-wiki] ### Other advantages of vim ### Also because vim is run from the console it is so easy to run old friends like `rubocop` or `reek` on your sketch code. If you are millenial and allergic to the command line install use an editor that supports ruby syntax, emacs is only for hardcore geeks. As yet I don't think the raspberrypi supports `atom` as an editor. [atom]:{{ site.github.url }}/atom/ [pry-wiki]:https://github.com/pry/pry/wiki/Editor-integration/
Version data entries
25 entries across 25 versions & 1 rubygems