metakirby5 / codi.vim

:notebook_with_decorative_cover: The interactive scratchpad for hackers.
MIT License
3k stars 83 forks source link
instant interpreter repl vim

codi.vim Gitter Buy Me a Coffee at ko-fi.com

The interactive scratchpad for hackers.

Codi demo.

Using Codi as a Python scratchpad through the shell wrapper

Codi expand demo.

Using :CodiExpand on a javascript object

Codi is an interactive scratchpad for hackers, with a similar interface to Numi. It opens a pane synchronized to your main buffer which displays the results of evaluating each line as you type (with NeoVim or Vim with +job and +channel, asynchronously). It's extensible to nearly any language that provides a REPL (interactive interpreter)!

Languages with built-in support: Python, JavaScript, CoffeeScript, Haskell, PureScript, Ruby, OCaml, R, Clojure/ClojureScript, PHP, Lua, C++, Julia, Elm, Elixir, TypeScript, Mathjs, Haxe

Pull requests for new language support welcome!

Note: without async support, evaluation will trigger on cursor hold rather than text change.

For more information, check out the documentation.

Installation

Use your favorite package manager (vim-plug, Vundle, pathogen.vim), or add this directory to your Vim runtime path.

For example, if you're using vim-plug, add the following line to ~/.vimrc:

Plug 'metakirby5/codi.vim'

Dependencies

Each interpreter also depends on its REPL. These are loaded on-demand. For example, if you only want to use the Python Codi interpreter, you will not need ghci.

Default interpreter dependencies:

Usage

Shell wrapper

A nice way to use Codi is through a shell wrapper that you can stick in your ~/.bashrc:

# Codi
# Usage: codi [filetype] [filename]
codi() {
  local syntax="${1:-python}"
  shift
  vim -c \
    "let g:startify_disable_at_vimenter = 1 |\
    set bt=nofile ls=0 noru nonu nornu |\
    hi ColorColumn ctermbg=NONE |\
    hi VertSplit ctermbg=NONE |\
    hi NonText ctermfg=0 |\
    Codi $syntax" "$@"
}

Options

The below options can also be set on a per-interpreter basis via g:codi#interpreters:

Autocommands

FAQ

Thanks to