Coder Social home page Coder Social logo

guile-repl.nvim's Introduction

Guile-REPL.nvim - The GNU Guile REPL for Nvim

Warning

This plugin is deprecated in favour of REPL.nvim, which does everything Guile-REPL.nvim does, but in a more general way, and it supports any programming language. This project should be considered abandoned.

Guile-REPL.nvim wraps around Nvim's built-in terminal emulator to create a REPL buffer for GNU Guile. While not as perfect as a native REPL buffer, it is functional and gets the job done.

Getting started

Installation

You need a working copy of GNU Guile first. Install this plugin like you would any other Nvim plugin. You can set the Guile binary by setting the variable guile-repl['binary']. See the configuration section below for more information or read the documentation.

Starting a REPL

A new REPL window is created by running the :Guile command. You can use the same arguments you can also use with your Guile binary. Example:

" Add the current working directory to the load path
:Guile -l my-file.scm

" Evaluate an expression and exit (escape the space after 'display')
:Guile -c '(display\ "Hello from Guile")'

By default the working directory is added to the load path by passing the -L . argument to the binary. See below for how to set the default arguments. The :Guile command also accepts the usual modifiers like :vert:

" Open the REPL in a vertical split
:vert Guile -l my-file.scm

Configuration

REPL settings

All REPL configuration is held within the g:guile_repl dictionary. You can read the documentation for details; here is what the default configuration looks like:

let g:guile_repl = {'binary': 'guile', 'args': ['-L', '.'], 'syntax': 'scheme'}

To override the defaults create a new g:guile_repl in your init.vim file containing only options you want to change. Guile-REPL.nvim is smart enough to fill in the rest.

" Turn off syntax highlighting only
let g:guile_repl = {'syntax': ''}

After Nvim has loaded you can the dictionary entries. If you wanted to turn syntax highlighting back on after starting up Nvim you would execute

" Globally turn syntax highlighting back on
:let g:guile_repl['syntax'] = 'scheme'

You can also specify settings local to the current tab/window/buffer by using a local dictionary:

" Turn off syntax highlighting for this tab only
let t:guile_repl = {'syntax': ''}

Local dictionaries can be created at any time.

Key mappings

A new operator is available for sending text from the current buffer to the REPL. You will have to remap the keys for the new operator:

" Send the text of a motion to the REPL
nmap <leader>rs  <Plug>(GuileReplSend)
" Send the current line to the REPL
nmap <leader>rss <Plug>(GuileReplSendLine)
nmap <leader>rs_ <Plug>(GuileReplSendLine)
" Send the selected text to the REPL
vmap <leader>rs  <Plug>(GuileReplSend)

With these mappings you could position your cursor inside an s-expression, press <leader>rsa) and your expression would be sent over to the REPL with its parentheses.

Shortcomings

Since Guile-REPL.nvim is implemented on top of Nvim's terminal emulator it is also bound to the same interface. You cannot use Vim's commands to edit text, you instead have to enter terminal mode (insert mode for the terminal) to modify text.

Syntax highlighting uses Vim's Scheme highlighting, but this might not always be adequate. Highlighting the prompt or the backtrace as if it was regular Scheme code is wrong.

License

Guile-REPL.nvim is release under the terms of the MIT license. See the LICENSE.rst file for details.

guile-repl.nvim's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.