quarto config

This commit is contained in:
Andrei Stoica 2024-03-18 15:11:23 -04:00
parent 446ec92655
commit d509b8a159
3 changed files with 96 additions and 36 deletions

View File

@ -14,6 +14,7 @@ local servers = {
"rust_analyzer", "rust_analyzer",
"pyright", "pyright",
"grammarly", "grammarly",
"marksman",
} }
for _, lsp in ipairs(servers) do for _, lsp in ipairs(servers) do
@ -29,5 +30,3 @@ lspconfig["clangd"].setup({
offsetEncoding = { "utf-16" }, offsetEncoding = { "utf-16" },
}, },
}) })
--
-- lspconfig.pyright.setup { blabla}

View File

@ -2,17 +2,28 @@ local M = {}
M.treesitter = { M.treesitter = {
ensure_installed = { ensure_installed = {
"vim",
"lua",
"html",
"css",
"javascript",
"typescript", "typescript",
"python", "python",
"tsx", "tsx",
"c", "c",
"javascript",
"json",
"lua",
"luadoc",
"luap",
"markdown", "markdown",
"markdown_inline", "markdown_inline",
"query",
"regex",
"vim",
"vimdoc",
"bash",
"html",
"css",
"javascript",
"yaml",
"julia",
"r",
}, },
indent = { indent = {
enable = true, enable = true,
@ -41,7 +52,6 @@ M.mason = {
"jedi_language_server", "jedi_language_server",
"docker_compose_language_service", "docker_compose_language_service",
"dockerls", "dockerls",
}, },
@ -63,8 +73,8 @@ M.nvimtree = {
}, },
} }
M.cmp = function (_, opts) M.cmp = function(_, opts)
local cmp = require "cmp" local cmp = require("cmp")
opts.experimental = { opts.experimental = {
ghost_text = true, ghost_text = true,
} }
@ -73,20 +83,20 @@ M.cmp = function (_, opts)
{ name = "luasnip" }, { name = "luasnip" },
{ name = "nvim_lua" }, { name = "nvim_lua" },
{ name = "path" }, { name = "path" },
{ name = "buffer", keyword_length = 5}, { name = "buffer", keyword_length = 5 },
}) })
opts.mapping = cmp.config.mapping { opts.mapping = cmp.config.mapping({
["<C-p>"] = cmp.mapping.select_prev_item(), ["<C-p>"] = cmp.mapping.select_prev_item(),
["<C-n>"] = cmp.mapping.select_next_item(), ["<C-n>"] = cmp.mapping.select_next_item(),
["<C-d>"] = cmp.mapping.scroll_docs(-4), ["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4), ["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(), ["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.close(), ["<C-e>"] = cmp.mapping.close(),
["<C-y>"] = cmp.mapping.confirm { ["<C-y>"] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Insert, behavior = cmp.ConfirmBehavior.Insert,
select = true, select = true,
}, }),
["<Tab>"] = cmp.mapping(function(fallback) ["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.select_next_item() cmp.select_next_item()
@ -111,10 +121,8 @@ M.cmp = function (_, opts)
"i", "i",
"s", "s",
}), }),
} })
return opts return opts
end end
return M return M

View File

@ -47,6 +47,22 @@ local plugins = {
require("plugins.configs.lspconfig") require("plugins.configs.lspconfig")
require("custom.configs.lspconfig") require("custom.configs.lspconfig")
end, -- Override to setup mason-lspconfig end, -- Override to setup mason-lspconfig
opts = {
---@type lspconfig.options
servers = {
pyright = {},
r_language_server = {},
julials = {},
marksman = {
-- also needs:
-- $home/.config/marksman/config.toml :
-- [core]
-- markdown.file_extensions = ["md", "markdown", "qmd"]
filetypes = { "markdown", "quarto" },
root_dir = require("lspconfig.util").root_pattern(".git", ".marksman.toml", "_quarto.yml"),
},
},
},
}, },
-- override plugin configs -- override plugin configs
{ {
@ -113,25 +129,26 @@ local plugins = {
lazy = false, lazy = false,
}, },
{ {
"epwalsh/obsidian.nvim", "epwalsh/obsidian.nvim",
version = "*", -- recommended, use latest release instead of latest commit version = "*", -- recommended, use latest release instead of latest commit
lazy = true, lazy = true,
ft = "markdown", ft = "markdown",
-- ft = { -- ft = {
-- "BufReadPre ~/Notes/**.md", -- "BufReadPre ~/Notes/**.md",
-- "BufNewFile ~/Notes/**.md", -- "BufNewFile ~/Notes/**.md",
-- }, -- },
dependencies = { "nvim-lua/plenary.nvim" }, dependencies = { "nvim-lua/plenary.nvim" },
opts = { opts = {
workspaces = { workspaces = {
{ name = "second-brain", path = "~/second-brain" }, { name = "second-brain", path = "~/second-brain" },
}, },
new_notes_location = "notes_subdir", new_notes_location = "notes_subdir",
daily_notes = { folder = "notes/dailies" }, daily_notes = { folder = "notes/dailies" },
}, },
}, },
-- Disable nvchad plugins
-- Disable nvchad plugins
{ {
"folke/todo-comments.nvim", "folke/todo-comments.nvim",
dependencies = { "nvim-lua/plenary.nvim" }, dependencies = { "nvim-lua/plenary.nvim" },
@ -142,7 +159,43 @@ local plugins = {
-- refer to the configuration section below -- refer to the configuration section below
}, },
}, },
{
"quarto-dev/quarto-nvim",
opts = {
lspFeatures = {
languages = { "r", "python", "julia", "bash", "html", "lua" },
},
},
ft = "quarto",
keys = {
{ "<leader>qa", ":QuartoActivate<cr>", desc = "quarto activate" },
{ "<leader>qp", ":lua require'quarto'.quartoPreview()<cr>", desc = "quarto preview" },
{ "<leader>qq", ":lua require'quarto'.quartoClosePreview()<cr>", desc = "quarto close" },
{ "<leader>qh", ":QuartoHelp ", desc = "quarto help" },
{ "<leader>qe", ":lua require'otter'.export()<cr>", desc = "quarto export" },
{ "<leader>qE", ":lua require'otter'.export(true)<cr>", desc = "quarto export overwrite" },
{ "<leader>qrr", ":QuartoSendAbove<cr>", desc = "quarto run to cursor" },
{ "<leader>qra", ":QuartoSendAll<cr>", desc = "quarto run all" },
{ "<leader><cr>", ":SlimeSend<cr>", desc = "send code chunk" },
{ "<c-cr>", ":SlimeSend<cr>", desc = "send code chunk" },
{ "<c-cr>", "<esc>:SlimeSend<cr>i", mode = "i", desc = "send code chunk" },
{ "<c-cr>", "<Plug>SlimeRegionSend<cr>", mode = "v", desc = "send code chunk" },
{ "<cr>", "<Plug>SlimeRegionSend<cr>", mode = "v", desc = "send code chunk" },
{ "<leader>ctr", ":split term://R<cr>", desc = "terminal: R" },
{ "<leader>cti", ":split term://ipython<cr>", desc = "terminal: ipython" },
{ "<leader>ctp", ":split term://python<cr>", desc = "terminal: python" },
{ "<leader>ctj", ":split term://julia<cr>", desc = "terminal: julia" },
},
},
{
"jmbuhr/otter.nvim",
opts = {
buffers = {
set_filetype = true,
},
},
},
-- Disable nvchad plugins -- Disable nvchad plugins
{ {