fix: improve nvim performance

This commit is contained in:
Fabio Lenherr 2023-02-21 19:54:42 +01:00
parent 670014885b
commit fdcb340766
7 changed files with 115 additions and 173 deletions

View file

@ -9,6 +9,7 @@ monitor=,highrr,1920x0,1
input { input {
kb_file=/home/dashie/.config/keymap.xkb #us with dead_diaeresis on shift + ' to get ä ö ü kb_file=/home/dashie/.config/keymap.xkb #us with dead_diaeresis on shift + ' to get ä ö ü
repeat_delay=200 repeat_delay=200
repeat_rate=35
natural_scroll=false natural_scroll=false
follow_mouse=1 follow_mouse=1
force_no_accel=true force_no_accel=true

View file

@ -1,6 +1,6 @@
vim.g.loaded_netrw = 1 vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1 vim.g.loaded_netrwPlugin = 1
--
require("settings.plugins") require("settings.plugins")
require("settings.options") require("settings.options")
require("settings.cmp") require("settings.cmp")
@ -19,18 +19,19 @@ require("settings.telescope")
require("settings.vimtex") require("settings.vimtex")
require("settings.keymaps") require("settings.keymaps")
require("settings.barbar") require("settings.barbar")
--
-- simple plugins that don't make sense to put in a seperate file, would clutter too much -- -- simple plugins that don't make sense to put in a seperate file, would clutter too much
require("gitsigns").setup() -- -- require("gitsigns").setup()
require("feline").setup() require("feline").setup()
require("impatient").enable_profile() require("impatient").enable_profile()
require('Comment').setup() require('Comment').setup()
require("toggleterm").setup({ require("toggleterm").setup({
autochdir = true, autochdir = true,
}) })
require('leap').add_default_mappings() require('leap').add_default_mappings()
require("nvim-highlight-colors").setup { require("nvim-highlight-colors").setup {
render = 'background', -- or 'foreground' or 'first_column' render = 'background', -- or 'foreground' or 'first_column'
enable_named_colors = true, enable_named_colors = true,
enable_tailwind = true, enable_tailwind = true,
} }
-- require('neoscroll').setup()

View file

@ -3,72 +3,9 @@ if not status_ok then
return return
end end
vim.g.indent_blankline_buftype_exclude = { "terminal", "nofile" } vim.opt.list = true
vim.g.indent_blankline_filetype_exclude = { require("indent_blankline").setup {
"help", space_char_blankline = " ",
"startify", show_current_context = true,
"dashboard", show_current_context_start = true,
"packer",
"neogitstatus",
"NvimTree",
"Trouble",
} }
vim.g.indentLine_enabled = 1
-- vim.g.indent_blankline_char = "│"
vim.g.indent_blankline_char = ""
-- vim.g.indent_blankline_char = "▎"
vim.g.indent_blankline_show_trailing_blankline_indent = false
vim.g.indent_blankline_show_first_indent_level = true
vim.g.indent_blankline_use_treesitter = true
vim.g.indent_blankline_show_current_context = true
vim.g.indent_blankline_context_patterns = {
"class",
"return",
"function",
"def",
"method",
"^if",
"^else",
"^else if",
"^elif",
"^while",
"jsx_element",
"^for",
"^object",
"^table",
"block",
"arguments",
"if_statement",
"else_clause",
"jsx_element",
"jsx_self_closing_element",
"try_statement",
"catch_clause",
"import_statement",
"operation_type",
}
-- HACK: work-around for https://github.com/lukas-reineke/indent-blankline.nvim/issues/59
vim.wo.colorcolumn = "99999"
-- vim.cmd [[highlight IndentBlanklineIndent1 guifg=#E06C75 gui=nocombine]]
-- vim.cmd [[highlight IndentBlanklineIndent2 guifg=#E5C07B gui=nocombine]]
-- vim.cmd [[highlight IndentBlanklineIndent3 guifg=#98C379 gui=nocombine]]
-- vim.cmd [[highlight IndentBlanklineIndent4 guifg=#56B6C2 gui=nocombine]]
-- vim.cmd [[highlight IndentBlanklineIndent5 guifg=#61AFEF gui=nocombine]]
-- vim.cmd [[highlight IndentBlanklineIndent6 guifg=#C678DD gui=nocombine]]
-- vim.opt.list = true
-- vim.opt.listchars:append "space:⋅"
-- vim.opt.listchars:append "space:"
-- vim.opt.listchars:append "eol:↴"
indent_blankline.setup({
show_end_of_line = true,
space_char_blankline = " ",
show_current_context = true,
show_current_context_start = true,
-- char_highlight_list = {
-- "IndentBlanklineIndent1",
-- "IndentBlanklineIndent2",
-- "IndentBlanklineIndent3",
-- },
})

View file

@ -1,109 +1,113 @@
local status_ok, _ = pcall(require, "lspconfig") local status_ok, _ = pcall(require, "lspconfig")
if not status_ok then if not status_ok then
return return
end end
require("mason").setup({ require("mason").setup({
ui = { ui = {
icons = { icons = {
package_installed = "", package_installed = "",
package_pending = "", package_pending = "",
package_uninstalled = "", package_uninstalled = "",
}, },
}, },
}) })
require("mason-lspconfig").setup({ require("mason-lspconfig").setup({
ensure_installed = { ensure_installed = {
"cssls", -- css "cssls", -- css
"html", -- html "html", -- html
"clangd", -- cpp / c "clangd", -- cpp / c
"lua_ls", -- lua "lua_ls", -- lua
"pyright", -- python "pyright", -- python
"cmake", -- cmake "cmake", -- cmake
"bashls", -- shell "bashls", -- shell
"ansiblels", -- ansible "ansiblels", -- ansible
"marksman", -- markdown "marksman", -- markdown
"asm_lsp", -- assembly "asm_lsp", -- assembly
"tsserver", -- js and ts "tsserver", -- js and ts
"ltex", -- latex "ltex", -- latex
"jdtls", -- jafuck "jdtls", -- jafuck
"gopls", -- yet another gargabe collector "gopls", -- yet another gargabe collector
"sqls", -- sql "sqls", -- sql
"taplo", -- toml "taplo", -- toml
"lemminx", -- xml "lemminx", -- xml
"yamlls", -- yaml "yamlls", -- yaml
"bashls", -- shell "bashls", -- shell
}, },
automatic_installation = true, automatic_installation = true,
}) })
local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()) local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
capabilities.textDocument.completion.completionItem.snippetSupport = true capabilities.textDocument.completion.completionItem.snippetSupport = true
-- LSP -- LSP
-- require("lsp-format").setup {} require("lsp-inlayhints").setup {}
require("lsp-inlayhints").setup()
local on_attach = function(client, bufnr) local on_attach = function(client, bufnr)
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc") vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
local optslsp = { noremap = false, silent = true, buffer = bufnr } local optslsp = { noremap = false, silent = true, buffer = bufnr }
-- require("lsp-format").on_attach(client) -- require("lsp-format").on_attach(client)
require("lsp-inlayhints").on_attach(client, bufnr) require("lsp-inlayhints").on_attach(client, bufnr)
end end
require("rust-tools").setup({ require("rust-tools").setup({
server = { server = {
standalone = false, standalone = false,
root_dir = require('lspconfig').util.find_git_ancestor, root_dir = require('lspconfig').util.find_git_ancestor,
loadOutputiDirs = false, loadOutputiDirs = false,
} },
tools = {
inlay_hints = {
auto = false
}
}
}) })
require("mason-lspconfig").setup_handlers({ require("mason-lspconfig").setup_handlers({
function(server_name) -- default handler (optional) function(server_name) -- default handler (optional)
require("lspconfig")[server_name].setup({ require("lspconfig")[server_name].setup({
capabilities = capabilities, capabilities = capabilities,
on_attach = on_attach, on_attach = on_attach,
vim.lsp.diagnostic.on_publish_diagnostics, { vim.lsp.diagnostic.on_publish_diagnostics, {
-- Disable virtual_text -- Disable virtual_text
virtual_text = true, virtual_text = true,
} }
}) })
end, end,
['tsserver'] = function() ['tsserver'] = function()
require('lspconfig').tsserver.setup { require('lspconfig').tsserver.setup {
settings = { settings = {
typescript = { typescript = {
inlayHints = { inlayHints = {
includeInlayParameterNameHints = 'all', includeInlayParameterNameHints = 'all',
includeInlayParameterNameHintsWhenArgumentMatchesName = false, includeInlayParameterNameHintsWhenArgumentMatchesName = true,
includeInlayFunctionParameterTypeHints = true, includeInlayFunctionParameterTypeHints = true,
includeInlayVariableTypeHints = true, includeInlayVariableTypeHints = true,
includeInlayPropertyDeclarationTypeHints = true, includeInlayPropertyDeclarationTypeHints = true,
includeInlayFunctionLikeReturnTypeHints = true, includeInlayFunctionLikeReturnTypeHints = true,
includeInlayEnumMemberValueHints = true, includeInlayEnumMemberValueHints = true,
} }
}, },
javascript = { javascript = {
inlayHints = { inlayHints = {
includeInlayParameterNameHints = 'all', includeInlayParameterNameHints = 'all',
includeInlayParameterNameHintsWhenArgumentMatchesName = false, includeInlayParameterNameHintsWhenArgumentMatchesName = true,
includeInlayFunctionParameterTypeHints = true, includeInlayFunctionParameterTypeHints = true,
includeInlayVariableTypeHints = true, includeInlayVariableTypeHints = true,
includeInlayPropertyDeclarationTypeHints = true, includeInlayPropertyDeclarationTypeHints = true,
includeInlayFunctionLikeReturnTypeHints = true, includeInlayFunctionLikeReturnTypeHints = true,
includeInlayEnumMemberValueHints = true, includeInlayEnumMemberValueHints = true,
} }
} }
}, },
capabilities = capabilities, capabilities = capabilities,
on_attach = on_attach, on_attach = on_attach,
vim.lsp.diagnostic.on_publish_diagnostics, { vim.lsp.diagnostic.on_publish_diagnostics, {
virtual_text = true, virtual_text = true,
} }
} }
end, end,
}) })

View file

@ -242,13 +242,10 @@ vim.api.nvim_create_autocmd("BufEnter", {
local function open_nvim_tree(data) local function open_nvim_tree(data)
-- buffer is a [No Name]
local no_name = data.file == "" and vim.bo[data.buf].buftype == ""
-- buffer is a directory -- buffer is a directory
local directory = vim.fn.isdirectory(data.file) == 1 local directory = vim.fn.isdirectory(data.file) == 1
if not no_name and not directory then if not directory then
return return
end end

View file

@ -14,7 +14,7 @@ local options = {
timeoutlen = 200, -- time to wait for a mapped sequence to complete (in milliseconds) timeoutlen = 200, -- time to wait for a mapped sequence to complete (in milliseconds)
undofile = true, -- enable persistent undoi updatetime = 300, -- faster completion (4000ms default) undofile = true, -- enable persistent undoi updatetime = 300, -- faster completion (4000ms default)
writebackup = false, -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited writebackup = false, -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited
expandtab = true, -- convert tabs to spaces -- expandtab = true, -- convert tabs to spaces
shiftwidth = 2, -- the number of spaces inserted for each indentation shiftwidth = 2, -- the number of spaces inserted for each indentation
tabstop = 2, -- insert 2 spaces for a tab tabstop = 2, -- insert 2 spaces for a tab
scrolloff = 8, scrolloff = 8,
@ -25,6 +25,7 @@ local options = {
mousemodel = "popup_setpos", mousemodel = "popup_setpos",
shell = "/usr/bin/zsh", shell = "/usr/bin/zsh",
autochdir = true, autochdir = true,
lazyredraw = true,
} }
vim.g.mkdp_browser = '/usr/bin/firefox' vim.g.mkdp_browser = '/usr/bin/firefox'

View file

@ -55,5 +55,6 @@ Plug('lvimuser/lsp-inlayhints.nvim') -- inlay hints
Plug('preservim/tagbar') -- tags on the right Plug('preservim/tagbar') -- tags on the right
Plug('ggandor/leap.nvim') -- special movement Plug('ggandor/leap.nvim') -- special movement
Plug('brenoprata10/nvim-highlight-colors') -- colors Plug('brenoprata10/nvim-highlight-colors') -- colors
Plug('karb94/neoscroll.nvim')
vim.call("plug#end") vim.call("plug#end")