nvim: add quarto-nvim

This commit is contained in:
PowerUser64 2023-05-28 19:29:20 -07:00
parent 5612d97dc4
commit 9720cf47f7
2 changed files with 79 additions and 44 deletions

View file

@ -141,10 +141,12 @@ M.cmp = function()
sources = { sources = {
{ name = 'nvim_lsp' }, { name = 'nvim_lsp' },
{ name = 'nvim_lua' }, { name = 'nvim_lua' },
{ name = 'otter' },
{ name = 'pandoc_references' },
{ name = 'luasnip' }, { name = 'luasnip' },
{ name = 'treesitter' }, { name = 'treesitter' },
{ name = 'calc' }, { name = 'calc' },
-- { name = 'spell' }, { name = 'spell' },
{ name = 'emoji' }, { name = 'emoji' },
{ name = 'buffer' }, { name = 'buffer' },
{ name = 'path' }, { name = 'path' },
@ -158,16 +160,18 @@ M.cmp = function()
-- set a name for each source -- set a name for each source
vim_item.kind = " " .. kind.kind vim_item.kind = " " .. kind.kind
vim_item.menu = ({ vim_item.menu = ({
path = "[path]", path = "[path]",
emoji = "[emoji]", emoji = "[emoji]",
nvim_lua = "[lua]", nvim_lua = "[lua]",
nvim_lsp = "[lsp]", nvim_lsp = "[lsp]",
treesitter = "[ts]", treesitter = "[ts]",
calc = "[calc]", calc = "[calc]",
spell = "[spell]", spell = "[spell]",
cmdline = "[cmd]", cmdline = "[cmd]",
buffer = "[buf]", buffer = "[buf]",
luasnip = "[snip]", luasnip = "[snip]",
pandoc_references = "[pandoc]",
otter = "[quarto]",
})[entry.source.name] or "unknown type" })[entry.source.name] or "unknown type"
return vim_item return vim_item
end, end,
@ -182,7 +186,7 @@ M.cmp = function()
}, },
experimental = { experimental = {
ghost_text = true, ghost_text = true,
} },
} }
-- Thanks to iwataka on github for this bit -- Thanks to iwataka on github for this bit
local search_config = { local search_config = {
@ -256,18 +260,19 @@ M.lspconfig = function()
-- Use a loop to conveniently call 'setup' on multiple servers and -- Use a loop to conveniently call 'setup' on multiple servers and
-- map buffer local keybindings when the language server attaches -- map buffer local keybindings when the language server attaches
local lsp_servers = { local lsp_servers = {
-- 'lsp_name',
'clangd',
'bashls', 'bashls',
'rust_analyzer', 'clangd',
'dockerls',
-- 'yamlls',
'html',
'cssls', 'cssls',
'dockerls',
'eslint', 'eslint',
'html',
'jsonls', 'jsonls',
'kotlin_language_server', 'kotlin_language_server',
'marksman',
'nil_ls', 'nil_ls',
'nil_ls',
'rust_analyzer',
'yamlls',
} }
for _, lsp in pairs(lsp_servers) do for _, lsp in pairs(lsp_servers) do
nvim_lsp[lsp].setup { nvim_lsp[lsp].setup {

View file

@ -127,42 +127,24 @@ return require('packer').startup({function()
end 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 use { -- cmp: completion menu
'hrsh7th/nvim-cmp', 'hrsh7th/nvim-cmp',
config = function() config = function()
require('blake.lsp').cmp() require('blake.lsp').cmp()
end, end,
requires = { -- (mostly) nvim-cmp sources (not required by cmp, but reqired by my configuration) 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', 'f3fora/cmp-spell',
'hrsh7th/cmp-buffer', 'hrsh7th/cmp-buffer',
'hrsh7th/cmp-calc',
'hrsh7th/cmp-cmdline', 'hrsh7th/cmp-cmdline',
'hrsh7th/cmp-emoji', '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 use { -- luasnip: snippits plugin
@ -376,6 +358,54 @@ return require('packer').startup({function()
require('hop').setup { keys = 'etovxqpdygfblzhckisuran' } require('hop').setup { keys = 'etovxqpdygfblzhckisuran' }
end 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 -- Conveniences
use { -- sort motion: (gs) use { -- sort motion: (gs)