performance stuff
This commit is contained in:
@ -33,7 +33,7 @@ return {
|
||||
"Subs",
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>t", "<cmd>TextCaseOpenTelescope<CR>", mode = { "n", "v" }, desc = "Telescope" },
|
||||
{ "<leader>tc", "<cmd>TextCaseOpenTelescope<CR>", mode = { "n", "v" }, desc = "Telescope" },
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -74,21 +74,6 @@ return {
|
||||
cmd = { "AerialToggle", "AerialOn" },
|
||||
keys = { { "<leader>so", ":AerialToggle<CR>", desc = "[S]symbols [O]utline" } },
|
||||
},
|
||||
{
|
||||
"olimorris/persisted.nvim",
|
||||
config = function()
|
||||
require("persisted").setup({})
|
||||
require("telescope").load_extension("persisted")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"iamcco/markdown-preview.nvim",
|
||||
build = "cd app && npm install",
|
||||
init = function()
|
||||
vim.g.mkdp_filetypes = { "markdown" }
|
||||
end,
|
||||
ft = { "markdown" },
|
||||
},
|
||||
{
|
||||
"andrewferrier/debugprint.nvim",
|
||||
opts = {},
|
||||
|
@ -41,6 +41,8 @@ return {
|
||||
vim.opt.completeopt = { "menu", "menuone", "noselect" }
|
||||
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
|
||||
local compare = cmp.config.compare
|
||||
|
||||
local conditionalSources = {}
|
||||
@ -55,6 +57,30 @@ return {
|
||||
|
||||
local lspkind = require("lspkind")
|
||||
lspkind.init()
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
callback = function(args)
|
||||
local max_filesize = 100 * 1024 -- 100 KB
|
||||
local fname = vim.api.nvim_buf_get_name(args.buf)
|
||||
local ok, stats = pcall(vim.loop.fs_stat, fname)
|
||||
if ok and stats and stats.size > max_filesize then
|
||||
vim.schedule(function()
|
||||
vim.notify(
|
||||
string.format(
|
||||
"Disabling nvim-cmp for buffer. File %s exceeds maximum configured size.",
|
||||
fname
|
||||
)
|
||||
)
|
||||
end)
|
||||
require("cmp").setup.buffer({
|
||||
enabled = false,
|
||||
})
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
cmp.setup.filetype("txt", {
|
||||
enabled = false,
|
||||
})
|
||||
|
||||
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline({ "/", "?" }, {
|
||||
@ -76,6 +102,14 @@ return {
|
||||
|
||||
cmp.setup({
|
||||
preselect = cmp.PreselectMode.None,
|
||||
performance = {
|
||||
-- debounce = 60,
|
||||
-- throttle = 30,
|
||||
fetching_timeout = 300,
|
||||
-- confirm_resolve_timeout = 80,
|
||||
-- async_budget = 1,
|
||||
-- max_view_entries = 200,
|
||||
},
|
||||
sources = cmp.config.sources(
|
||||
require("utils").TableConcat(conditionalSources, {
|
||||
-- { name = "nvim_lsp_signature_help", priority = 9 },
|
||||
@ -136,35 +170,40 @@ return {
|
||||
end,
|
||||
},
|
||||
|
||||
experimental = {
|
||||
native_menu = false,
|
||||
ghost_text = true,
|
||||
},
|
||||
mapping = {
|
||||
["<S-Up>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<S-Down>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-e>"] = cmp.mapping.close(),
|
||||
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
["<CR>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
if #cmp.get_entries() == 1 then
|
||||
cmp.confirm({ select = true })
|
||||
if luasnip.expandable() then
|
||||
luasnip.expand()
|
||||
else
|
||||
cmp.select_next_item()
|
||||
end
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
if #cmp.get_entries() == 1 then
|
||||
cmp.confirm({ select = true })
|
||||
cmp.confirm({
|
||||
select = true,
|
||||
})
|
||||
end
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.locally_jumpable(1) then
|
||||
luasnip.jump(1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function()
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.locally_jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
|
||||
|
@ -70,8 +70,18 @@ return {
|
||||
require("go").setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
-- Run gofmt + goimports on save
|
||||
|
||||
local format_sync_grp = vim.api.nvim_create_augroup("goimports", {})
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
pattern = "*.go",
|
||||
callback = function()
|
||||
require("go.format").goimports()
|
||||
end,
|
||||
group = format_sync_grp,
|
||||
})
|
||||
end,
|
||||
event = { "VeryLazy" },
|
||||
event = { "CmdlineEnter" },
|
||||
ft = { "go", "gomod" },
|
||||
build = ':lua require("go.install").update_all_sync()', -- if you need to install/update all binaries
|
||||
},
|
||||
@ -123,16 +133,6 @@ return {
|
||||
})
|
||||
vim.cmd([[autocmd FileType gdscript setlocal commentstring=#\ %s]])
|
||||
vim.cmd([[autocmd FileType gdscript setlocal autoindent noexpandtab tabstop=4 shiftwidth=4]])
|
||||
|
||||
-- Run gofmt + goimports on save
|
||||
local format_sync_grp = vim.api.nvim_create_augroup("goimports", {})
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
pattern = "*.go",
|
||||
callback = function()
|
||||
require("go.format").goimports()
|
||||
end,
|
||||
group = format_sync_grp,
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ return {
|
||||
"bashls",
|
||||
"dotls",
|
||||
"golangci_lint_ls",
|
||||
"gopls",
|
||||
}
|
||||
|
||||
if not use_google() then
|
||||
|
@ -49,14 +49,14 @@ return {
|
||||
return true
|
||||
end
|
||||
|
||||
local max_filesize = 200 * 1024 -- 200 KB
|
||||
local max_filesize = 100 * 1024 -- 100 KB
|
||||
local fname = vim.api.nvim_buf_get_name(buf)
|
||||
local ok, stats = pcall(vim.loop.fs_stat, fname)
|
||||
if ok and stats and stats.size > max_filesize then
|
||||
vim.schedule(function()
|
||||
vim.notify(
|
||||
string.format(
|
||||
"Disabling treesitter. File %s exceeds maximum configured size.",
|
||||
"Disabling treesitter for buffer. File %s exceeds maximum configured size.",
|
||||
fname
|
||||
)
|
||||
)
|
||||
|
@ -1,75 +0,0 @@
|
||||
return {
|
||||
"PrestonKnopp/tree-sitter-gdscript",
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter-context",
|
||||
config = function()
|
||||
require("treesitter-context").setup({
|
||||
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
|
||||
max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit.
|
||||
min_window_height = 0, -- Minimum editor window height to enable context. Values <= 0 mean no limit.
|
||||
line_numbers = true,
|
||||
multiline_threshold = 20, -- Maximum number of lines to show for a single context
|
||||
trim_scope = "outer", -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer'
|
||||
mode = "cursor", -- Line used to calculate context. Choices: 'cursor', 'topline'
|
||||
-- Separator between context and content. Should be a single character string, like '-'.
|
||||
-- When separator is set, the context will only show up when there are at least 2 lines above cursorline.
|
||||
separator = nil,
|
||||
zindex = 20, -- The Z-index of the context window
|
||||
on_attach = nil, -- (fun(buf: integer): boolean) return false to disable attaching
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
config = function()
|
||||
require("nvim-treesitter.configs").setup({
|
||||
-- A list of parser names, or "all" (the five listed parsers should always be installed)
|
||||
ensure_installed = "all",
|
||||
|
||||
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||
sync_install = false,
|
||||
|
||||
-- Automatically install missing parsers when entering buffer
|
||||
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
|
||||
auto_install = false,
|
||||
|
||||
indent = { enable = true },
|
||||
-- List of parsers to ignore installing (or "all")
|
||||
-- ignore_install = { "" },
|
||||
|
||||
---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
|
||||
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
|
||||
|
||||
highlight = {
|
||||
enable = true,
|
||||
|
||||
-- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
|
||||
-- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
|
||||
-- the name of the parser)
|
||||
-- list of language that will be disabled
|
||||
-- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files
|
||||
disable = function(lang, buf)
|
||||
--TODO write a custom Java treesitter parser for comments
|
||||
--@link
|
||||
--
|
||||
-- if lang == "java" then
|
||||
-- return true
|
||||
-- end
|
||||
|
||||
local max_filesize = 100 * 1024 -- 100 KB
|
||||
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
||||
if ok and stats and stats.size > max_filesize then
|
||||
return true
|
||||
end
|
||||
end,
|
||||
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
||||
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
|
||||
-- Using this option may slow down your editor, and you may see some duplicate highlights.
|
||||
-- Instead of true it can also be a list of languages
|
||||
additional_vim_regex_highlighting = { "java", "kotlin" },
|
||||
},
|
||||
})
|
||||
end,
|
||||
lazy = false,
|
||||
}
|
@ -30,22 +30,22 @@ return {
|
||||
end,
|
||||
lazy = false,
|
||||
},
|
||||
{
|
||||
"kevinhwang91/nvim-hlslens",
|
||||
config = function()
|
||||
require("hlslens").setup({
|
||||
nearest_only = true,
|
||||
build_position_cb = function(plist, _, _, _)
|
||||
require("scrollbar.handlers.search").handler.show(plist.start_pos)
|
||||
end,
|
||||
})
|
||||
|
||||
vim.cmd([[
|
||||
augroup scrollbar_search_hide
|
||||
autocmd!
|
||||
autocmd CmdlineLeave : lua require('scrollbar.handlers.search').handler.hide()
|
||||
augroup END
|
||||
]])
|
||||
end,
|
||||
},
|
||||
-- {
|
||||
-- "kevinhwang91/nvim-hlslens",
|
||||
-- config = function()
|
||||
-- require("hlslens").setup({
|
||||
-- nearest_only = true,
|
||||
-- build_position_cb = function(plist, _, _, _)
|
||||
-- require("scrollbar.handlers.search").handler.show(plist.start_pos)
|
||||
-- end,
|
||||
-- })
|
||||
--
|
||||
-- vim.cmd([[
|
||||
-- augroup scrollbar_search_hide
|
||||
-- autocmd!
|
||||
-- autocmd CmdlineLeave : lua require('scrollbar.handlers.search').handler.hide()
|
||||
-- augroup END
|
||||
-- ]])
|
||||
-- end,
|
||||
-- },
|
||||
}
|
||||
|
Reference in New Issue
Block a user