Coder Social home page Coder Social logo

balajeerc / neovim-client Goto Github PK

View Code? Open in Web Editor NEW

This project forked from clojure-vim/neovim-client

0.0 2.0 0.0 4.85 MB

Neovim plugin client library for Clojure

License: Eclipse Public License 1.0

Clojure 96.91% Shell 1.19% Vim Script 1.90%

neovim-client's Introduction

neovim-client

A client library for creating Neovim plugins written in Clojure.

Repling Neovim

Dependencies

Usage

Repl

Launch Neovim, explicitly setting the NVIM_LISTEN_ADDRESS

NVIM_LISTEN_ADDRESS=127.0.0.1:7777 nvim

From the repository directory:

$> lein repl
user=> (def c (tcp-connection))
user=> (require '[neovim-client.1.api :as api])
user=> (api/command c ":echo 'Hello Neovim!'")
...

Alternatively, if you've got tmux installed, you can use run the script ./tmux-run-dev.sh, which will start Neovim, a repl, and execute similar setup code.

Examples

Included Sample Plugin

Installation

One way to install the sample plugin is by running ./deploy-local.sh script, included, which copies the sample plugin to ~/.vim/bundle, and then ensure Neovim's runtimepath is set correctly by adding set runtimepath^=~/.vim/bundle/sample-plugin to .vimrc.

Running

This plugin stays running, and maintains state. Additionally, it shows how plugins are actually servers, which Neovim can make requests to via rpcnotify().

:echo SamplePluginCount()

Socket Repl Plugin

A simple alternative to vim-fireplace. Send code in vim buffers to a built-in Clojure socket repl.

https://github.com/jebberjeb/clojure-socketrepl.nvim

Neovim API Versions (Levels)

Neovim's RPC API is versioned separately from Neovim itslef, using a monotonically increasing integer. The API's version is tracked using a value called api_level, which can be found by examining the output of :echo api_info().

Currently, levels 0 - 1 are supported.

In the future, this library can be updated to support a new level by:

  • Updating the API metadata $> nvim --api-info > resources/api-info.mp

  • Generating code from the metadata using neovim-client.parser/generate

Changes

Version 0.1.0

  • Generate code for api_level 0 - 1 from metadata generated using Neovim version 0.2.0

  • Hand-written functions moved to -ext namespaces

  • Added unit tests which use nvim --embed process

  • Support Unix Domain Sockets

  • Verify api_level available on connection

Future

Tighter Integration with Neovim

Neovim's strategy for remote plugins says that it's ok to create a remote plugins as "arbitrary programs that communicate directly with the high-level Nvim API and are called via [msgpack-rpc]". That's exactly what the included sample-plugin does (utilizing neovim-client).

However, it goes on to outline a better approach, utilizing a "plugin host". While neovim-client could potentially fill that role, considerably more work is needed.

Performance

Individual plugins can be distributed as jars using AOT compilation. Additionally, porting this client library to Clojurescript would facilitate a fast startup time, via Node.

License

Distributed under the same license as Neovim.

neovim-client's People

Contributors

jebberjeb avatar

Watchers

 avatar James Cloos avatar

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.