Compare commits
5 commits
treesitter
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 4e73cc78aa | |||
| e83b9e5cfa | |||
| 550f5d060b | |||
| 47c0d051f6 | |||
| ade2f0f598 |
4 changed files with 63 additions and 46 deletions
5
after/lsp/tinymist.lua
Normal file
5
after/lsp/tinymist.lua
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
return {
|
||||||
|
settings = {
|
||||||
|
exportPdf = "onType",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -7,14 +7,15 @@ return {
|
||||||
load = function()
|
load = function()
|
||||||
core.lsp.setup()
|
core.lsp.setup()
|
||||||
require("mason-lspconfig").setup {
|
require("mason-lspconfig").setup {
|
||||||
ensure_added = {
|
ensure_installed = {
|
||||||
"clangd",
|
"clangd",
|
||||||
"mesonlsp",
|
"mesonlsp",
|
||||||
"bashls",
|
"bashls",
|
||||||
"jdtls",
|
"jdtls",
|
||||||
"lua_ls",
|
"lua_ls",
|
||||||
"basedpyright",
|
"basedpyright",
|
||||||
"debugpy"
|
"zls",
|
||||||
|
"nil_ls"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,59 +1,59 @@
|
||||||
local map, auto = core.misc.map, core.misc.auto
|
local map = core.misc.map
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
{ "nvim-treesitter/nvim-treesitter",
|
{ "nvim-treesitter/nvim-treesitter",
|
||||||
branch = "main",
|
branch = "master",
|
||||||
config = function()
|
config = function()
|
||||||
vim.cmd("TSUpdate")
|
vim.cmd("TSUpdate")
|
||||||
end,
|
end,
|
||||||
load = function()
|
load = function()
|
||||||
local treesitter = require("nvim-treesitter")
|
require("nvim-treesitter.configs").setup {
|
||||||
treesitter.setup {}
|
-- good default parsers
|
||||||
treesitter.install({
|
ensure_installed = { "c", "lua", "vim", "vimdoc", "markdown",
|
||||||
"c", "lua", "vim", "vimdoc", "markdown",
|
"markdown_inline", "java", "bash", "css", "html", "luadoc",
|
||||||
"markdown_inline", "java", "bash", "css", "html", "luadoc",
|
"make", "zig"
|
||||||
"make", "zig"
|
},
|
||||||
}, {
|
|
||||||
force = false,
|
|
||||||
summary = false,
|
|
||||||
})
|
|
||||||
|
|
||||||
auto("FileType", {
|
-- indentation
|
||||||
callback = function(ev)
|
indent = {
|
||||||
if highlight(ev.buf) then
|
enable = true,
|
||||||
pcall(vim.treesitter.start)
|
|
||||||
vim.bo[ev.buf].syntax = "ON"
|
disable = function(lang, _)
|
||||||
|
-- disable indenting in php (it's more broken with than without)
|
||||||
|
return table.contains(({
|
||||||
|
"php"
|
||||||
|
}), lang)
|
||||||
end
|
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
|
||||||
end,
|
}
|
||||||
})
|
}
|
||||||
|
|
||||||
core.misc.map("n", "<leader><leader>t", function()
|
core.misc.map("n", "<leader><leader>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)
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
|
|
|
||||||
11
lua/snippets/markdown.lua
Normal file
11
lua/snippets/markdown.lua
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
dofile(core.snippets)
|
||||||
|
|
||||||
|
return {
|
||||||
|
s("[]", {
|
||||||
|
t("["),
|
||||||
|
i(1),
|
||||||
|
t("]("),
|
||||||
|
i(2),
|
||||||
|
t(")"),
|
||||||
|
}),
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue