Pangoraw / Neige.jl

☃️ Neovim Evaluator for Julia
MIT License
8 stars 1 forks source link

Neige

Warning Neige is still highly experimental, use at your own risks!

Neige is a simple evaluator of Python/Julia code using tree-sitter to match expressions under the cursor and send them to a connected session. The experience is highly inspired by the awesome julia-vscode extension.

Screencast from 15-02-2023 14:18:16.webm

Usage

Install Neige as any neovim lua package using your favorite package manager and make sure to call require("neige").instantiate({}) at least once (required only for Julia).

Using paq-nvim

require "paq" {
    -- ...
    {'Pangoraw/Neige.jl', run = function()
        require("neige").instantiate({ popup = true })
    end};
    -- ...
}

Setup

One can change the settings for Neige using a call to neige.setup(config). The default settings are the following:

require("neige").setup({
    python_exe = "python",
    julia_exe = "julia",
    julia_opts = {
        threads = "auto",
        quiet = true,
    },
    julia_load_revise = false,
    icons = {
        failure = "✗",
        success = "✓",
        loading = "🗘",
    },
    hl = {
        failure = "DiagnosticError",
        success = "DiagnosticInfo",
        loading = "DiagnosticInfo",
    },
    split = "vnew",
    clear_on_start = false,
})

Running

After having installed Neige, a new Python/Julia REPL can be started using the :NeigeStart command which will split the newly created REPL in a new pane.

When the REPL is created, expressions can be sent to the REPL using the :NeigeEvalExpr command. It is recommended to map this command to the Shift + Enter bindings to mimic the vscode extension. The last two mappings for starting Neige and clearing the virtual texts are also recommended.

vim.keymap.set('n', '<s-cr>', [[:NeigeEvalExpr<CR>]], { noremap = true})
vim.keymap.set('v', '<s-cr>', [[:<C-U>NeigeEvalVisual<CR>]], { noremap = true})
vim.keymap.set('n', '<leader>ns', [[:NeigeStart<CR>]])
vim.keymap.set('n', '<leader>nc', [[:NeigeClearText<CR>]])

Dependencies

To have fun with Neige, you will need the following:

For using in Python scripts:

For using in Julia scripts:

TODOs

Acknowledgements