Code Monkey home page Code Monkey logo

nvim_rocks's Introduction

nvim_rocks ๐Ÿค˜

Install luarock packages for Neovim's built-in Lua interpreter.

Important Note

Functionality of this plugin has been added to https://github.com/wbthomason/packer.nvim. You will not need this plugin when you are using packer.nvim.

Installation

I use hererock to set up a luajit local enviroment. Adapt if you use a different pip binary or you want to use a different luarocks version (latest was not working for me).

If using Lazy.nvim

return {
  {
    "theHamsta/nvim_rocks",
    event = "VeryLazy",
    build = "./build.bash",
    opts = {
      -- Add here the packages you want to make sure that they are installed
      ensure_installed = { "uuid" }
    },
    config = function(_, opts)
      require('nvim_rocks').setup(opts)
    end,
  },
}

or for vim-plug

    Plug 'theHamsta/nvim_rocks', {'do': './build.bash'}

I am currently using the latest nightly of Neovim.

Usage

local nvim_rocks = require'nvim_rocks'

-- Force installation of rock
nvim_rocks.install('30log')

-- Ensure that certain rocks are installed
nvim_rocks.ensure_installed('lua-cjson')
nvim_rocks.ensure_installed({'lua-cjson', 'stdlib'})
nvim_rocks.ensure_installed('fun') -- nice functional programming for LuaJIT!

-- require stuff from binary rock
local cjson = require "cjson"
local cjson2 = cjson.new()
local cjson_safe = require "cjson.safe"

print(vim.inspect(cjson_safe))

-- List installed rocks with version numbers
print(vim.inspect(nvim_rocks.list()))

-- List installed rocks as strings
local simple = true
print(vim.inspect(nvim_rocks.list(simple)))

-- Remove rock
nvim_rocks.remove('lua-cjson')

There's also three commands for install/uninstall and listing the installed packages:

  • NvimRocksInstall <package>
  • NvimRocksRemove <package>
  • NvimRocksList

Alternatives

If you want to install just pure Lua packages you might also install them manually:

    Plug 'Yonaba/30log', {'do': 'mkdir -p lua && cp *.lua lua'}
    Plug 'lua-stdlib/lua-stdlib', {'do': 'cp -r lib lua'}

Now https://github.com/wbthomason/packer.nvim has luarocks support

nvim_rocks's People

Contributors

thehamsta avatar haruleekim avatar pepijnkrijnsen 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.