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,9 +19,9 @@ 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()
@ -34,3 +34,4 @@ require("nvim-highlight-colors").setup {
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",
"startify",
"dashboard",
"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 = " ", space_char_blankline = " ",
show_current_context = true, show_current_context = true,
show_current_context_start = true, show_current_context_start = true,
-- char_highlight_list = { }
-- "IndentBlanklineIndent1",
-- "IndentBlanklineIndent2",
-- "IndentBlanklineIndent3",
-- },
})

View file

@ -42,8 +42,7 @@ local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protoc
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 }
@ -56,6 +55,11 @@ require("rust-tools").setup({
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
}
} }
}) })
@ -77,7 +81,7 @@ require("mason-lspconfig").setup_handlers({
typescript = { typescript = {
inlayHints = { inlayHints = {
includeInlayParameterNameHints = 'all', includeInlayParameterNameHints = 'all',
includeInlayParameterNameHintsWhenArgumentMatchesName = false, includeInlayParameterNameHintsWhenArgumentMatchesName = true,
includeInlayFunctionParameterTypeHints = true, includeInlayFunctionParameterTypeHints = true,
includeInlayVariableTypeHints = true, includeInlayVariableTypeHints = true,
includeInlayPropertyDeclarationTypeHints = true, includeInlayPropertyDeclarationTypeHints = true,
@ -88,7 +92,7 @@ require("mason-lspconfig").setup_handlers({
javascript = { javascript = {
inlayHints = { inlayHints = {
includeInlayParameterNameHints = 'all', includeInlayParameterNameHints = 'all',
includeInlayParameterNameHintsWhenArgumentMatchesName = false, includeInlayParameterNameHintsWhenArgumentMatchesName = true,
includeInlayFunctionParameterTypeHints = true, includeInlayFunctionParameterTypeHints = true,
includeInlayVariableTypeHints = true, includeInlayVariableTypeHints = true,
includeInlayPropertyDeclarationTypeHints = true, includeInlayPropertyDeclarationTypeHints = true,

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")