From 4d886e7e6d356e3c99d1adabdd656ecff1487574 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Mon, 4 Dec 2023 09:28:22 +0100 Subject: [PATCH] nvim: Add experimental nushell lsp and treesitter HACK Added support for nushell lsp (not yet available to automatically install through mason integration) and for nushell treesitter (VERY manual installation as of right now). Will work for testing out the shell and its nvim integration but definitely has to be integrated better in the future. --- nvim/.config/nvim/lua/plugins/config/lsp.lua | 1 + nvim/.config/nvim/lua/plugins/treesitter.lua | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/nvim/.config/nvim/lua/plugins/config/lsp.lua b/nvim/.config/nvim/lua/plugins/config/lsp.lua index 0670395..d46c0e0 100644 --- a/nvim/.config/nvim/lua/plugins/config/lsp.lua +++ b/nvim/.config/nvim/lua/plugins/config/lsp.lua @@ -137,6 +137,7 @@ lsp.setup({ }) local lspconfig = require("lspconfig") +lspconfig.nushell.setup({}) local python_path -- ensure python virtualenv is determined automatically on lsp start diff --git a/nvim/.config/nvim/lua/plugins/treesitter.lua b/nvim/.config/nvim/lua/plugins/treesitter.lua index 5db83dc..73953db 100644 --- a/nvim/.config/nvim/lua/plugins/treesitter.lua +++ b/nvim/.config/nvim/lua/plugins/treesitter.lua @@ -39,6 +39,20 @@ return { enable = true, enable_autocmd = false, -- since we run it as a hook from the mini.comment plugin }) + + -- treesitter parser for nushell. To fully get e.g. syntax highlight + -- working you need a highlight file too. For now I installed manually, see: + -- https://github.com/nushell/tree-sitter-nu/blob/main/installation/neovim.md + local parser_config = require("nvim-treesitter.parsers").get_parser_configs() + parser_config.nu = { + install_info = { + url = "https://github.com/nushell/tree-sitter-nu", + files = { "src/parser.c" }, + branch = "main", + }, + filetype = "nu", + } + end, event = "BufReadPost", cmd = {