From 9720cf47f7af4f9202d6bdda6c7cb62f2fba5e22 Mon Sep 17 00:00:00 2001 From: PowerUser64 <blake@blakenorth.net> Date: Sun, 28 May 2023 19:29:20 -0700 Subject: [PATCH] nvim: add quarto-nvim --- .config/nvim/lua/blake/lsp.lua | 41 ++++++++------- .config/nvim/lua/blake/plugins.lua | 82 ++++++++++++++++++++---------- 2 files changed, 79 insertions(+), 44 deletions(-) diff --git a/.config/nvim/lua/blake/lsp.lua b/.config/nvim/lua/blake/lsp.lua index 245efb9..c6e692d 100644 --- a/.config/nvim/lua/blake/lsp.lua +++ b/.config/nvim/lua/blake/lsp.lua @@ -141,10 +141,12 @@ M.cmp = function() sources = { { name = 'nvim_lsp' }, { name = 'nvim_lua' }, + { name = 'otter' }, + { name = 'pandoc_references' }, { name = 'luasnip' }, { name = 'treesitter' }, { name = 'calc' }, - -- { name = 'spell' }, + { name = 'spell' }, { name = 'emoji' }, { name = 'buffer' }, { name = 'path' }, @@ -158,16 +160,18 @@ M.cmp = function() -- set a name for each source vim_item.kind = " " .. kind.kind vim_item.menu = ({ - path = "[path]", - emoji = "[emoji]", - nvim_lua = "[lua]", - nvim_lsp = "[lsp]", - treesitter = "[ts]", - calc = "[calc]", - spell = "[spell]", - cmdline = "[cmd]", - buffer = "[buf]", - luasnip = "[snip]", + path = "[path]", + emoji = "[emoji]", + nvim_lua = "[lua]", + nvim_lsp = "[lsp]", + treesitter = "[ts]", + calc = "[calc]", + spell = "[spell]", + cmdline = "[cmd]", + buffer = "[buf]", + luasnip = "[snip]", + pandoc_references = "[pandoc]", + otter = "[quarto]", })[entry.source.name] or "unknown type" return vim_item end, @@ -182,7 +186,7 @@ M.cmp = function() }, experimental = { ghost_text = true, - } + }, } -- Thanks to iwataka on github for this bit local search_config = { @@ -256,18 +260,19 @@ M.lspconfig = function() -- Use a loop to conveniently call 'setup' on multiple servers and -- map buffer local keybindings when the language server attaches local lsp_servers = { - -- 'lsp_name', - 'clangd', 'bashls', - 'rust_analyzer', - 'dockerls', - -- 'yamlls', - 'html', + 'clangd', 'cssls', + 'dockerls', 'eslint', + 'html', 'jsonls', 'kotlin_language_server', + 'marksman', 'nil_ls', + 'nil_ls', + 'rust_analyzer', + 'yamlls', } for _, lsp in pairs(lsp_servers) do nvim_lsp[lsp].setup { diff --git a/.config/nvim/lua/blake/plugins.lua b/.config/nvim/lua/blake/plugins.lua index fcbd479..db3a636 100644 --- a/.config/nvim/lua/blake/plugins.lua +++ b/.config/nvim/lua/blake/plugins.lua @@ -127,42 +127,24 @@ return require('packer').startup({function() end } } - use { -- rust-tools: make nvim a better rust environment - 'simrat39/rust-tools.nvim', - requires = { - 'mattn/webapi-vim', -- allow :RustPlay - }, - config = function () - local rt = require("rust-tools") - rt.setup({ - server = { - on_attach = function(_, bufnr) - -- Hover actions - vim.keymap.set("n", "K", rt.hover_actions.hover_actions, { buffer = bufnr }) - -- Code action groups - vim.keymap.set("n", "<Leader>a", rt.code_action_group.code_action_group, { buffer = bufnr }) - end, - }, - }) - end - } use { -- cmp: completion menu 'hrsh7th/nvim-cmp', config = function() require('blake.lsp').cmp() end, requires = { -- (mostly) nvim-cmp sources (not required by cmp, but reqired by my configuration) - 'onsails/lspkind-nvim', -- icons for entries of the completion menu, required by config - 'hrsh7th/cmp-path', - 'hrsh7th/cmp-nvim-lua', - 'hrsh7th/cmp-nvim-lsp', - 'saadparwaiz1/cmp_luasnip', - 'ray-x/cmp-treesitter', - 'hrsh7th/cmp-calc', 'f3fora/cmp-spell', 'hrsh7th/cmp-buffer', + 'hrsh7th/cmp-calc', 'hrsh7th/cmp-cmdline', 'hrsh7th/cmp-emoji', + 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/cmp-nvim-lua', + 'hrsh7th/cmp-path', + 'jc-doyle/cmp-pandoc-references', + 'onsails/lspkind-nvim', -- icons for entries of the completion menu, required by config + 'ray-x/cmp-treesitter', + 'saadparwaiz1/cmp_luasnip', }, } use { -- luasnip: snippits plugin @@ -376,6 +358,54 @@ return require('packer').startup({function() require('hop').setup { keys = 'etovxqpdygfblzhckisuran' } end } + ---- Language-specific packages + use { -- rust-tools: make nvim a better rust environment + 'simrat39/rust-tools.nvim', + requires = { + 'mattn/webapi-vim', -- allow :RustPlay + }, + config = function () + local rt = require("rust-tools") + rt.setup({ + server = { + on_attach = function(_, bufnr) + -- Hover actions + vim.keymap.set("n", "K", rt.hover_actions.hover_actions, { buffer = bufnr }) + -- Code action groups + vim.keymap.set("n", "<Leader>a", rt.code_action_group.code_action_group, { buffer = bufnr }) + end, + }, + }) + end + } + use { -- quarto-nvim: tools for writing with quarto + 'quarto-dev/quarto-nvim', + requires = { + 'jmbuhr/otter.nvim', -- execute code in a terminal + }, + config = function () + require'quarto'.setup({ + debug = false, + closePreviewOnExit = true, + lspFeatures = { + enabled = true, + languages = { 'bash' }, + chunks = 'curly', -- 'curly' or 'all' + diagnostics = { + enabled = true, + triggers = { "BufWritePost" } + }, + completion = { + enabled = true, + }, + }, + keymap = { + hover = 'K', + definition = 'gd', + }, + }) + end + } -- Conveniences use { -- sort motion: (gs)