Skip to content

Move some minimal nvim config to flix.nvim #210

@stormckey

Description

@stormckey

I have just created a simple nvim plugin https://github.com/stormckey/flix.nvim.

And move the most general part into the plugin. Things like how the user wants to refresh codelens or how to set up shortcuts is not included in the plugin.

If we adopt this way, the procedure to setup flix in neovim could be:

  • install neovim
  • install nvim-lspconfig
  • install flix.nvim
  • Add this minimal config:
-- Setup Code Lens Refesh
vim.api.nvim_create_autocmd({ "BufEnter", "CursorHold", "InsertLeave" }, {
	pattern = "<buffer>",
	callback = function()
		vim.lsp.codelens.refresh()
	end,
})

-- Setup Keybindings
local opts = { noremap = true, silent = true }
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, opts)
vim.keymap.set("n", "<leader>cl", vim.lsp.codelens.run, opts)
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts)
vim.keymap.set("n", "<leader>h", vim.lsp.buf.document_highlight, opts)
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
vim.keymap.set("n", "<leader>d", vim.diagnostic.open_float, opts)

-- Setup flix.nvim
require("flix").setup({
	flix_jar_path = "flix.jar", -- flix jar file path relative to the root of the workspace
	enable_codelens = true,
})

What do you think? The plugin is still at an early stage and it could be part of the flix project later. But now it just works fine for me. You can also test with this config :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions