diff --git a/after/lsp/tinymist.lua b/after/lsp/tinymist.lua new file mode 100644 index 0000000..6220be5 --- /dev/null +++ b/after/lsp/tinymist.lua @@ -0,0 +1,5 @@ +return { + settings = { + exportPdf = "onType", + } +} diff --git a/lua/conf/plugins/lsp.lua b/lua/conf/plugins/lsp.lua index 128d1f1..0d9f4c0 100644 --- a/lua/conf/plugins/lsp.lua +++ b/lua/conf/plugins/lsp.lua @@ -7,14 +7,15 @@ return { load = function() core.lsp.setup() require("mason-lspconfig").setup { - ensure_added = { + ensure_installed = { "clangd", "mesonlsp", "bashls", "jdtls", "lua_ls", "basedpyright", - "debugpy" + "zls", + "nil_ls" } } end diff --git a/lua/conf/plugins/treesitter.lua b/lua/conf/plugins/treesitter.lua index 17588f6..30d31a5 100644 --- a/lua/conf/plugins/treesitter.lua +++ b/lua/conf/plugins/treesitter.lua @@ -1,59 +1,59 @@ -local map, auto = core.misc.map, core.misc.auto - -local function highlight(buf) - local lang = vim.bo[buf].ft - if table.contains({ "diff", "tex" }, lang) then - return false - end - - -- disable in big files - local ok, stats = pcall(vim.uv.fs_stat, - vim.api.nvim_buf_get_name(buf)) - if ok and stats and stats.size > (1024 * 100 * 10) --[[1MB]] then - return false - end - - return true -end - -local function indent(buf) - local lang = vim.bo[buf].ft - -- disable indenting in php (it's more broken with than without) - return not table.contains({ "php" }, lang) -end +local map = core.misc.map return { { "nvim-treesitter/nvim-treesitter", - branch = "main", + branch = "master", config = function() vim.cmd("TSUpdate") end, load = function() - local treesitter = require("nvim-treesitter") - treesitter.setup {} - treesitter.install({ - "c", "lua", "vim", "vimdoc", "markdown", - "markdown_inline", "java", "bash", "css", "html", "luadoc", - "make", "zig" - }, { - force = false, - summary = false, - }) + require("nvim-treesitter.configs").setup { + -- good default parsers + ensure_installed = { "c", "lua", "vim", "vimdoc", "markdown", + "markdown_inline", "java", "bash", "css", "html", "luadoc", + "make", "zig" + }, - auto("FileType", { - callback = function(ev) - if highlight(ev.buf) then - pcall(vim.treesitter.start) - vim.bo[ev.buf].syntax = "ON" + -- indentation + indent = { + enable = true, + + disable = function(lang, _) + -- disable indenting in php (it's more broken with than without) + return table.contains(({ + "php" + }), lang) end - if indent(ev.buf) then - vim.bo[ev.buf].indentexpr = "v:lua.require('nvim-treesitter').indentexpr()" + }, + + -- enable highlighting + highlight = { + enable = true, + -- use vim highlighting in addition to treesitter + additional_vim_regex_highlighting = true, + + disable = function(lang, buf) + -- disable in some files where vim's builtin highlighting is better + if table.contains(({ + "diff", "tex" + }), lang) then + return true + end + + -- disable in big files + local ok, stats = pcall(vim.uv.fs_stat, + vim.api.nvim_buf_get_name(buf)) + if ok and stats and stats.size > (1024 * 100 * 10) --[[1MB]] then + return true + end end - end, - }) + } + } core.misc.map("n", "t", function() - treesitter.install { vim.bo[0].ft } + pcall(vim.cmd.TSInstall, vim.api.nvim_get_option_value("ft", { + buf = vim.api.nvim_get_current_buf() + })) end) end }, diff --git a/lua/snippets/markdown.lua b/lua/snippets/markdown.lua new file mode 100644 index 0000000..77edb4a --- /dev/null +++ b/lua/snippets/markdown.lua @@ -0,0 +1,11 @@ +dofile(core.snippets) + +return { + s("[]", { + t("["), + i(1), + t("]("), + i(2), + t(")"), + }), +}