checkpoint: treesitter changes
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
require("helpers").set_tab(2)
|
||||||
@@ -62,6 +62,11 @@ silent_map("n", "<Down>", "gj")
|
|||||||
silent_map("n", "<Home>", "g<Home>")
|
silent_map("n", "<Home>", "g<Home>")
|
||||||
silent_map("n", "<End>", "g<End>")
|
silent_map("n", "<End>", "g<End>")
|
||||||
|
|
||||||
|
silent_map("v", "<Up>", "gk")
|
||||||
|
silent_map("v", "<Down>", "gj")
|
||||||
|
silent_map("v", "<Home>", "g<Home>")
|
||||||
|
silent_map("v", "<End>", "g<End>")
|
||||||
|
|
||||||
silent_map("i", "<Up>", "<C-o>gk")
|
silent_map("i", "<Up>", "<C-o>gk")
|
||||||
silent_map("i", "<Down>", "<C-o>gj")
|
silent_map("i", "<Down>", "<C-o>gj")
|
||||||
silent_map("i", "<Home>", "<C-o>g<Home>")
|
silent_map("i", "<Home>", "<C-o>g<Home>")
|
||||||
|
|||||||
+26
-4
@@ -165,19 +165,35 @@ function M.lualine()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function M.nvim_treesitter()
|
function M.nvim_treesitter()
|
||||||
local ts_visual_disable = { "typescript", "tsx", "html", "javascript" }
|
local highlight_disable = {
|
||||||
|
typescript = true,
|
||||||
|
tsx = true,
|
||||||
|
html = true,
|
||||||
|
javascript = true,
|
||||||
|
cpp = true,
|
||||||
|
}
|
||||||
|
local rainbow_disable = vim.tbl_extend("force", highlight_disable, { svelte = true })
|
||||||
|
|
||||||
|
local too_many_lines = function(bufnr)
|
||||||
|
return vim.api.nvim_buf_line_count(bufnr) > 5000
|
||||||
|
end
|
||||||
|
|
||||||
require("nvim-treesitter.configs").setup({
|
require("nvim-treesitter.configs").setup({
|
||||||
ensure_installed = "all",
|
ensure_installed = "all",
|
||||||
highlight = {
|
highlight = {
|
||||||
enable = true,
|
enable = true,
|
||||||
disable = ts_visual_disable,
|
disable = function(lang, bufnr)
|
||||||
|
return highlight_disable[lang] or too_many_lines(bufnr)
|
||||||
|
end,
|
||||||
},
|
},
|
||||||
rainbow = {
|
rainbow = {
|
||||||
enable = true,
|
enable = true,
|
||||||
disable = vim.tbl_extend("force", ts_visual_disable, { [5] = "svelte" }),
|
disable = function(lang, bufnr)
|
||||||
|
return rainbow_disable[lang] or too_many_lines(bufnr)
|
||||||
|
end,
|
||||||
extended_mode = true, -- Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean
|
extended_mode = true, -- Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean
|
||||||
max_file_lines = nil, -- Do not enable for files with more than n lines, int
|
max_file_lines = nil, -- Do not enable for files with more than n lines, int
|
||||||
-- colors = {}, -- table of hex strings
|
--colors = {}, -- table of hex strings
|
||||||
--termcolors = {},
|
--termcolors = {},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -274,6 +290,8 @@ function M.nvim_lsp_installer()
|
|||||||
htmldjango = "html",
|
htmldjango = "html",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
elseif server.name == "ccls" then
|
||||||
|
opts.capabilities.offsetEncoding = { "utf-32" }
|
||||||
end
|
end
|
||||||
|
|
||||||
server:setup(opts)
|
server:setup(opts)
|
||||||
@@ -336,6 +354,10 @@ function M.null_ls()
|
|||||||
sources = sources,
|
sources = sources,
|
||||||
on_attach = config.on_attach,
|
on_attach = config.on_attach,
|
||||||
root_dir = config.root_dir,
|
root_dir = config.root_dir,
|
||||||
|
-- removed error "warning: multiple different client offset_encodings detected for buffer, this is not supported yet"
|
||||||
|
--on_init = function(client, _)
|
||||||
|
-- client.offset_encoding = "utf-32"
|
||||||
|
--end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user