From afd642e36763a7bc445827a465fa25310dbd468d Mon Sep 17 00:00:00 2001 From: Andre Schaf Date: Tue, 10 Jun 2025 14:32:54 +0200 Subject: [PATCH 01/10] switch neotree for oil --- lua/plugin/neo-tree.lua | 12 ------------ lua/plugin/oil.lua | 8 ++++++++ lua/plugins.lua | 24 ++++++++++++++---------- lua/remap.lua | 3 +-- lua/set.lua | 13 +++++++++++++ 5 files changed, 36 insertions(+), 24 deletions(-) delete mode 100644 lua/plugin/neo-tree.lua create mode 100644 lua/plugin/oil.lua diff --git a/lua/plugin/neo-tree.lua b/lua/plugin/neo-tree.lua deleted file mode 100644 index 8719510..0000000 --- a/lua/plugin/neo-tree.lua +++ /dev/null @@ -1,12 +0,0 @@ -local neotree = require("neo-tree") - -neotree.setup({ - buffers = { - follow_current_file = { - enabled = true, - }, - }, - window = { - position = "right", - }, -}) diff --git a/lua/plugin/oil.lua b/lua/plugin/oil.lua new file mode 100644 index 0000000..b7e43fe --- /dev/null +++ b/lua/plugin/oil.lua @@ -0,0 +1,8 @@ +require("oil").setup { + view_options = { + -- Show files and directories that start with "." + show_hidden = true, + + } +} + diff --git a/lua/plugins.lua b/lua/plugins.lua index 8bd1445..c6b8579 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -45,7 +45,11 @@ require("lazy").setup({ -- formatter { 'stevearc/conform.nvim', - opts = {}, + opts = { + formatters_by_ft = { + htmlangular = { "prettier" }, + }, + }, }, -- Autocompletion { 'hrsh7th/nvim-cmp' }, -- Required @@ -56,14 +60,15 @@ require("lazy").setup({ } }, { - "nvim-neo-tree/neo-tree.nvim", - branch = "v3.x", - dependencies = { - "nvim-lua/plenary.nvim", - "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended - "MunifTanjim/nui.nvim", - }, - lazy = true, + 'stevearc/oil.nvim', + ---@module 'oil' + ---@type oil.SetupOpts + opts = {}, + -- Optional dependencies + dependencies = { { "echasnovski/mini.icons", opts = {} } }, + -- dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if you prefer nvim-web-devicons + -- Lazy loading is not recommended because it is very tricky to make it work correctly in all situations. + lazy = false, }, { "ThePrimeagen/harpoon", @@ -83,7 +88,6 @@ require("lazy").setup({ ft = { "markdown" }, build = function() vim.fn["mkdp#util#install"]() end, }, - { 'github/copilot.vim' }, { 'mhinz/vim-startify' }, }, opts) diff --git a/lua/remap.lua b/lua/remap.lua index 7b9ae2e..f65c9a1 100644 --- a/lua/remap.lua +++ b/lua/remap.lua @@ -1,5 +1,4 @@ -vim.keymap.set("n", ";;", ":Neotree toggle") -vim.keymap.set("n", "kk", ":Neotree reveal") +vim.keymap.set("n", "kk", "Oil", { desc = "Open parent directory" }) -- jk to escape vim.keymap.set("i", "jk", "") diff --git a/lua/set.lua b/lua/set.lua index 2da4ab7..4f4aacc 100644 --- a/lua/set.lua +++ b/lua/set.lua @@ -32,3 +32,16 @@ vim.opt.updatetime = 50 -- use system clipboard vim.opt.clipboard = "unnamedplus" + +vim.g.clipboard = { + name = "win32yank-wsl", + copy = { + ["+"] = "win32yank.exe -i --crlf", + ["*"] = "win32yank.exe -i --crlf" + }, + paste = { + ["+"] = "win32yank.exe -o --crlf", + ["*"] = "win32yank.exe -o --crlf" + }, + cache_enable = 0, +} From 455fdbeca50bec38046bcf4a0d1dd01998280a91 Mon Sep 17 00:00:00 2001 From: Andre Schaf Date: Tue, 10 Jun 2025 18:34:27 +0200 Subject: [PATCH 02/10] added roslyn --- lua/plugin/mason.lua | 6 ++++++ lua/plugins.lua | 27 ++++++++++++++++++--------- 2 files changed, 24 insertions(+), 9 deletions(-) create mode 100644 lua/plugin/mason.lua diff --git a/lua/plugin/mason.lua b/lua/plugin/mason.lua new file mode 100644 index 0000000..12d8f1f --- /dev/null +++ b/lua/plugin/mason.lua @@ -0,0 +1,6 @@ +require("mason").setup({ + registries = { + "github:mason-org/mason-registry", + "github:Crashdummyy/mason-registry", + }, +}) diff --git a/lua/plugins.lua b/lua/plugins.lua index c6b8579..6b16a08 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -60,15 +60,24 @@ require("lazy").setup({ } }, { - 'stevearc/oil.nvim', - ---@module 'oil' - ---@type oil.SetupOpts - opts = {}, - -- Optional dependencies - dependencies = { { "echasnovski/mini.icons", opts = {} } }, - -- dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if you prefer nvim-web-devicons - -- Lazy loading is not recommended because it is very tricky to make it work correctly in all situations. - lazy = false, + "seblyng/roslyn.nvim", + ft = "cs", + -- @module 'roslyn.config' + -- @type RoslynNvimConfig + opts = { + -- your configuration comes here; leave empty for default settings + }, + }, + { + 'stevearc/oil.nvim', + ---@module 'oil' + ---@type oil.SetupOpts + opts = {}, + -- Optional dependencies + dependencies = { { "echasnovski/mini.icons", opts = {} } }, + -- dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if you prefer nvim-web-devicons + -- Lazy loading is not recommended because it is very tricky to make it work correctly in all situations. + lazy = false, }, { "ThePrimeagen/harpoon", From cc53010b2ec8e9dd4a69dd8fa6134a02eedf942b Mon Sep 17 00:00:00 2001 From: Andre Schaf Date: Thu, 12 Jun 2025 12:01:00 +0200 Subject: [PATCH 03/10] add memory limit to angular node lsp process --- lua/lspconf/angular.lua | 58 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/lua/lspconf/angular.lua b/lua/lspconf/angular.lua index fb86039..193d635 100644 --- a/lua/lspconf/angular.lua +++ b/lua/lspconf/angular.lua @@ -1,8 +1,63 @@ local lspconfig = require 'lspconfig' +local configs = require 'lspconfig.configs' + +-- Angular requires a node_modules directory to probe for @angular/language-service and typescript +-- in order to use your projects configured versions. +-- This defaults to the vim cwd, but will get overwritten by the resolved root of the file. +local function get_probe_dir(root_dir) + local project_root = vim.fs.dirname(vim.fs.find('node_modules', { path = root_dir, upward = true })[1]) + + return project_root and (project_root .. '/node_modules') or '' +end + +local function get_angular_core_version(root_dir) + local project_root = vim.fs.dirname(vim.fs.find('node_modules', { path = root_dir, upward = true })[1]) + + if not project_root then + return '' + end + + local package_json = project_root .. '/package.json' + if not vim.uv.fs_stat(package_json) then + return '' + end + + local contents = io.open(package_json):read '*a' + local json = vim.json.decode(contents) + if not json.dependencies then + return '' + end + + local angular_core_version = json.dependencies['@angular/core'] + + angular_core_version = angular_core_version and angular_core_version:match('%d+%.%d+%.%d+') + + return angular_core_version +end + +local default_probe_dir = get_probe_dir(vim.fn.getcwd()) +local default_angular_core_version = get_angular_core_version(vim.fn.getcwd()) + +local cmd = { + 'node', + '--max-old-space-size=8192', + vim.fn.exepath('ngserver'), + '--stdio', + '--tsProbeLocations', + default_probe_dir, + '--ngProbeLocations', + default_probe_dir, + '--angularCoreVersion', + default_angular_core_version, +} lspconfig.angularls.setup({ + cmd = cmd, + on_new_config = function(new_config,new_root_dir) + new_config.cmd = cmd + end, on_attach = function() - for _, server in ipairs(vim.lsp.buf_get_clients()) do + for _, server in ipairs(vim.lsp.get_clients()) do if server.name == "tsserver" then local tsserver = vim.lsp.get_client_by_id(server.id) tsserver.server_capabilities.renameProvider = false @@ -10,3 +65,4 @@ lspconfig.angularls.setup({ end end }) + From 633ef6a9cb6427943b35821e9ce391355d8a6d2a Mon Sep 17 00:00:00 2001 From: Andre Schaf Date: Wed, 2 Jul 2025 14:45:21 +0200 Subject: [PATCH 04/10] lsp snacks and avante --- lua/lsp.lua | 97 +++++------------------ lua/lspconf.lua | 44 +++++++++++ lua/lspconf/angular.lua | 9 ++- lua/lspconf/csharp.lua | 104 ++++-------------------- lua/lspconf/lua.lua | 58 +++++++------- lua/plugin/avante.lua | 12 +++ lua/plugin/cmp.lua | 25 ++++++ lua/plugin/formatter.lua | 12 +-- lua/plugin/snacks.lua | 10 +++ lua/plugin/telescope.lua | 69 ---------------- lua/plugins.lua | 165 +++++++++++++++++++++++++++------------ lua/remap.lua | 5 +- lua/set.lua | 4 +- 13 files changed, 283 insertions(+), 331 deletions(-) create mode 100644 lua/lspconf.lua create mode 100644 lua/plugin/avante.lua create mode 100644 lua/plugin/cmp.lua create mode 100644 lua/plugin/snacks.lua delete mode 100644 lua/plugin/telescope.lua diff --git a/lua/lsp.lua b/lua/lsp.lua index 0d4fea6..9c4850e 100644 --- a/lua/lsp.lua +++ b/lua/lsp.lua @@ -1,91 +1,32 @@ -local lsp = require('lsp-zero').preset({}) -local lspconfig = require('lspconfig') local loaded_configs = require('lspconfig.configs') -local conform = require('conform') - -local on_attach = function(_, bufnr) - local opts = { buffer = bufnr, remap = false, } - -- Global mappings. - -- See `:help vim.diagnostic.*` for documentation on any of the below functions - vim.keymap.set('n', 'e', vim.diagnostic.open_float) - vim.keymap.set('n', '[d', vim.diagnostic.goto_prev) - vim.keymap.set('n', ']d', vim.diagnostic.goto_next) - vim.keymap.set('n', 'q', vim.diagnostic.setloclist) - vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts) - vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts) - vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts) - vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts) - vim.keymap.set('n', '', vim.lsp.buf.signature_help, opts) - vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, opts) - vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, opts) - vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, opts) - vim.keymap.set('n', 'rn', vim.lsp.buf.rename, opts) - vim.keymap.set('n', 'wl', function() - print(vim.inspect(vim.lsp.buf.list_workspace_folders())) - end, opts) - vim.keymap.set({ 'n', 'v' }, 'ca', vim.lsp.buf.code_action, opts) - vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts) - - vim.keymap.set('n', 'f', function() - vim.lsp.buf.format { async = true } - end, opts) - - vim.keymap.set('n', 'L', ':EslintFixAll') - - vim.keymap.set('n', 'F', function() - conform.format() - end, opts) -end - -local function get_config() - local capabilities = vim.lsp.protocol.make_client_capabilities() - capabilities.textDocument.completion.completionItem.snippetSupport = true - - return { - capabilities = capabilities, - } -end +local lspconfig = require('lspconfig') +local my_config = require('lspconf') local function load_custom_configs() - local config_files = vim.split(vim.fn.globpath(vim.fn.stdpath('config') .. '/lua/lspconf', '*.lua', true), '\n') + local config_files = vim.split(vim.fn.globpath(vim.fn.stdpath('config') .. '/lua/lspconf', '*.lua', true), '\n') - for _, f in ipairs(config_files) do - local name = vim.fn.fnamemodify(f, ':t:r') - require('lspconf.' .. name) - end + for _, f in ipairs(config_files) do + local name = vim.fn.fnamemodify(f, ':t:r') + require('lspconf.' .. name) + end end local function setup_default_configs() - local available_servers = require('mason-lspconfig').get_installed_servers() - local config = get_config() + local available_servers = require('mason-lspconfig').get_installed_servers() + local config = my_config + local excluded = { angularls = true, roslyn = true } - for _, server in pairs(available_servers) do - if not loaded_configs[server] then - lspconfig[server].setup(config) + for _, server in pairs(available_servers) do + if loaded_configs[server] or excluded[server] then + goto continue + end + + lspconfig[server].setup(config) + vim.lsp.config(server, config) + + ::continue:: end - end end load_custom_configs() setup_default_configs() - -lsp.on_attach(on_attach) -lsp.setup() - --- You need to setup `cmp` after lsp-zero -local cmp = require('cmp') -local cmp_action = require('lsp-zero').cmp_action() - -cmp.setup({ - mapping = { - -- `Enter` key to confirm completion - [''] = cmp.mapping.confirm({ select = false }), - - -- Ctrl+Space to trigger completion menu - [''] = cmp.mapping.complete(), - - -- Navigate between snippet placeholder - [''] = cmp_action.luasnip_jump_forward(), - [''] = cmp_action.luasnip_jump_backward(), - } -}) diff --git a/lua/lspconf.lua b/lua/lspconf.lua new file mode 100644 index 0000000..6edd57a --- /dev/null +++ b/lua/lspconf.lua @@ -0,0 +1,44 @@ +local conform = require("conform") + +local on_attach = function(_, bufnr) + local opts = { buffer = bufnr, remap = false } + + -- Global mappings. + -- See `:help vim.diagnostic.*` for documentation on any of the below functions + vim.keymap.set("n", "e", vim.diagnostic.open_float) + vim.keymap.set("n", "[d", vim.diagnostic.goto_prev) + vim.keymap.set("n", "]d", vim.diagnostic.goto_next) + vim.keymap.set("n", "q", vim.diagnostic.setloclist) + vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts) + vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) + vim.keymap.set("n", "K", vim.lsp.buf.hover, opts) + vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts) + vim.keymap.set("n", "", vim.lsp.buf.signature_help, opts) + vim.keymap.set("n", "wa", vim.lsp.buf.add_workspace_folder, opts) + vim.keymap.set("n", "wr", vim.lsp.buf.remove_workspace_folder, opts) + vim.keymap.set("n", "D", vim.lsp.buf.type_definition, opts) + vim.keymap.set("n", "rn", vim.lsp.buf.rename, opts) + vim.keymap.set("n", "wl", function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, opts) + vim.keymap.set({ "n", "v" }, "ca", vim.lsp.buf.code_action, opts) + vim.keymap.set("n", "gr", vim.lsp.buf.references, opts) + + vim.keymap.set('n', 'F', function() + vim.lsp.buf.format { async = true } + end, opts) + + vim.keymap.set("n", "f", function() + conform.format({ bufnr = bufnr }) + end, opts) + + vim.keymap.set("i", "", vim.lsp.completion.get, { desc = "trigger autocompletion" }) +end + +local capabilities = vim.lsp.protocol.make_client_capabilities() +capabilities.textDocument.completion.completionItem.snippetSupport = true + +return { + on_attach = on_attach, + capabilities = capabilities, +} diff --git a/lua/lspconf/angular.lua b/lua/lspconf/angular.lua index 193d635..1015999 100644 --- a/lua/lspconf/angular.lua +++ b/lua/lspconf/angular.lua @@ -1,5 +1,4 @@ local lspconfig = require 'lspconfig' -local configs = require 'lspconfig.configs' -- Angular requires a node_modules directory to probe for @angular/language-service and typescript -- in order to use your projects configured versions. @@ -51,18 +50,20 @@ local cmd = { default_angular_core_version, } -lspconfig.angularls.setup({ +local config = { cmd = cmd, on_new_config = function(new_config,new_root_dir) new_config.cmd = cmd end, on_attach = function() for _, server in ipairs(vim.lsp.get_clients()) do - if server.name == "tsserver" then + if server.name == "ts_ls" then local tsserver = vim.lsp.get_client_by_id(server.id) tsserver.server_capabilities.renameProvider = false end end end -}) +} + +lspconfig.angularls.setup(config) diff --git a/lua/lspconf/csharp.lua b/lua/lspconf/csharp.lua index a47be71..92183d9 100644 --- a/lua/lspconf/csharp.lua +++ b/lua/lspconf/csharp.lua @@ -1,92 +1,16 @@ -local util = require 'lspconfig.util' -local configs = require 'lspconfig.configs' +local my_config = require('lspconf') -configs.omnisharp = { - default_config = { - cmd = { "dotnet", - "C:\\Users\\andre.schaf\\.vscode\\extensions\\ms-dotnettools.csharp-2.13.10-win32-x64\\.roslyn\\Microsoft.CodeAnalysis.LanguageServer.dll" - -- "C:\\dev\\tools\\omni\\OmniSharp.Roslyn.dll" - -- "/path/to/omnisharp/OmniSharp.dll" }, +vim.lsp.config("roslyn", { + on_attach = my_config.on_attach, + capabilities = my_config.capabilities, + settings = { + ["csharp|inlay_hints"] = { + csharp_enable_inlay_hints_for_implicit_object_creation = true, + csharp_enable_inlay_hints_for_implicit_variable_types = true, + }, + ["csharp|code_lens"] = { + + dotnet_enable_references_code_lens = true, + }, }, - - filetypes = { 'cs' }, - root_dir = util.root_pattern('*.sln', '*.csproj', 'omnisharp.json', 'function.json'), - enable_editorconfig_support = true, - - -- If true, MSBuild project system will only load projects for files that - -- were opened in the editor. This setting is useful for big C# codebases - -- and allows for faster initialization of code navigation features only - -- for projects that are relevant to code that is being edited. With this - -- setting enabled OmniSharp may load fewer projects and may thus display - -- incomplete reference lists for symbols. - enable_ms_build_load_projects_on_demand = false, - - -- Enables support for roslyn analyzers, code fixes and rulesets. - enable_roslyn_analyzers = false, - - -- Specifies whether 'using' directives should be grouped and sorted during - -- document formatting. - organize_imports_on_format = false, - - -- Enables support for showing unimported types and unimported extension - -- methods in completion lists. When committed, the appropriate using - -- directive will be added at the top of the current file. This option can - -- have a negative impact on initial completion responsiveness, - -- particularly for the first few completion sessions after opening a - -- solution. - enable_import_completion = false, - - -- Specifies whether to include preview versions of the .NET SDK when - -- determining which version to use for project loading. - sdk_include_prereleases = true, - - -- Only run analyzers against open files when 'enableRoslynAnalyzers' is - -- true - analyze_open_documents_only = false, - on_new_config = function(new_config, _) - -- Get the initially configured value of `cmd` - new_config.cmd = { unpack(new_config.cmd or {}) } - - -- Append hard-coded command arguments - table.insert(new_config.cmd, '-z') -- https://github.com/OmniSharp/omnisharp-vscode/pull/4300 - vim.list_extend(new_config.cmd, { '--hostPID', tostring(vim.fn.getpid()) }) - table.insert(new_config.cmd, 'DotNet:enablePackageRestore=false') - vim.list_extend(new_config.cmd, { '--encoding', 'utf-8' }) - table.insert(new_config.cmd, '--languageserver') - - -- Append configuration-dependent command arguments - if new_config.enable_editorconfig_support then - table.insert(new_config.cmd, 'FormattingOptions:EnableEditorConfigSupport=true') - end - - if new_config.organize_imports_on_format then - table.insert(new_config.cmd, 'FormattingOptions:OrganizeImports=true') - end - - if new_config.enable_ms_build_load_projects_on_demand then - table.insert(new_config.cmd, 'MsBuild:LoadProjectsOnDemand=true') - end - - if new_config.enable_roslyn_analyzers then - table.insert(new_config.cmd, 'RoslynExtensionsOptions:EnableAnalyzersSupport=true') - end - - if new_config.enable_import_completion then - table.insert(new_config.cmd, 'RoslynExtensionsOptions:EnableImportCompletion=true') - end - - if new_config.sdk_include_prereleases then - table.insert(new_config.cmd, 'Sdk:IncludePrereleases=true') - end - - if new_config.analyze_open_documents_only then - table.insert(new_config.cmd, 'RoslynExtensionsOptions:AnalyzeOpenDocumentsOnly=true') - end - - -- Disable the handling of multiple workspaces in a single instance - new_config.capabilities = vim.deepcopy(new_config.capabilities) - new_config.capabilities.workspace.workspaceFolders = false -- https://github.com/OmniSharp/omnisharp-roslyn/issues/909 - end, - init_options = {}, - } -} +}) diff --git a/lua/lspconf/lua.lua b/lua/lspconf/lua.lua index 85b350c..51a883e 100644 --- a/lua/lspconf/lua.lua +++ b/lua/lspconf/lua.lua @@ -1,29 +1,31 @@ -local lspconfig = require('lspconfig') +local lspconfig = require("lspconfig") +local my_conf = require("lspconf") -lspconfig.lua_ls.setup { - settings = { - Lua = { - runtime = { - -- Tell the language server which version of Lua you're using - -- (most likely LuaJIT in the case of Neovim) - version = 'LuaJIT', - }, - diagnostics = { - -- Get the language server to recognize the `vim` global - globals = { - 'vim', - 'require', - 'opt', - }, - }, - workspace = { - -- Make the server aware of Neovim runtime files - library = vim.api.nvim_get_runtime_file("", true), - }, - -- Do not send telemetry data containing a randomized but unique identifier - telemetry = { - enable = false, - }, - }, - }, -} +lspconfig.lua_ls.setup({ + on_attach = my_conf.on_attach, + settings = { + Lua = { + runtime = { + -- Tell the language server which version of Lua you're using + -- (most likely LuaJIT in the case of Neovim) + version = "LuaJIT", + }, + diagnostics = { + -- Get the language server to recognize the `vim` global + globals = { + "vim", + "require", + "opt", + }, + }, + workspace = { + -- Make the server aware of Neovim runtime files + library = vim.api.nvim_get_runtime_file("", true), + }, + -- Do not send telemetry data containing a randomized but unique identifier + telemetry = { + enable = false, + }, + }, + }, +}) diff --git a/lua/plugin/avante.lua b/lua/plugin/avante.lua new file mode 100644 index 0000000..1e1d779 --- /dev/null +++ b/lua/plugin/avante.lua @@ -0,0 +1,12 @@ +require('avante').setup({ +provider = 'copilot', + providers = { + copilot = { + model = "claude-3.7-sonnet", + timeout = 30000, -- Timeout in milliseconds + }, + }, + selector = { + exclude_auto_select = { "oil" }, + }, +}) diff --git a/lua/plugin/cmp.lua b/lua/plugin/cmp.lua new file mode 100644 index 0000000..c2cc6db --- /dev/null +++ b/lua/plugin/cmp.lua @@ -0,0 +1,25 @@ +local cmp = require("cmp") + +cmp.setup({ + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) -- For `luasnip` users. + end, + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + }), + + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "luasnip" }, -- For luasnip users. + }, { + { name = "buffer" }, + }), +}) diff --git a/lua/plugin/formatter.lua b/lua/plugin/formatter.lua index 48f5e6d..cfe2674 100644 --- a/lua/plugin/formatter.lua +++ b/lua/plugin/formatter.lua @@ -1,10 +1,10 @@ local formatter = require("conform") formatter.setup({ - formatters_by_ft = { - lua = { "stylua" }, - -- Use a sub-list to run only the first available formatter - javascript = { { "prettierd", "prettier" } }, - typescript = { { "prettier" } }, - }, + formatters_by_ft = { + lua = { "stylua" }, + -- Use a sub-list to run only the first available formatter + javascript = { "prettierd", "prettier" }, + typescript = { "prettier" }, + }, }) diff --git a/lua/plugin/snacks.lua b/lua/plugin/snacks.lua new file mode 100644 index 0000000..6e24f0d --- /dev/null +++ b/lua/plugin/snacks.lua @@ -0,0 +1,10 @@ +local Snacks = require('snacks') + +-- Picker +vim.keymap.set('n', 'ff', function() Snacks.picker.smart() end, {}) +vim.keymap.set('n', 'fg', function() Snacks.picker.grep() end, {}) +vim.keymap.set('n', 'jj', function() Snacks.picker.buffers() end, {}) +vim.keymap.set('n', 'fh', function() Snacks.picker.comand_history() end, {}) + +-- LazyGit +vim.keymap.set("n", "gg", function() Snacks.lazygit() end, {}) diff --git a/lua/plugin/telescope.lua b/lua/plugin/telescope.lua deleted file mode 100644 index 0b00d89..0000000 --- a/lua/plugin/telescope.lua +++ /dev/null @@ -1,69 +0,0 @@ -local telescope = require('telescope') -local builtin = require('telescope.builtin') - -telescope.setup({ - defaults = { - vimgrep_arguments = { - "rg", - "-L", - "--color=never", - "--no-heading", - "--with-filename", - "--line-number", - "--column", - "--smart-case", - }, - prompt_prefix = "  ", - selection_caret = " ", - entry_prefix = " ", - initial_mode = "insert", - selection_strategy = "reset", - sorting_strategy = "ascending", - layout_strategy = "horizontal", - layout_config = { - horizontal = { - prompt_position = "top", - preview_width = 0.55, - results_width = 0.8, - }, - vertical = { - mirror = false, - }, - width = 0.87, - height = 0.80, - preview_cutoff = 120, - }, - file_sorter = require("telescope.sorters").get_fuzzy_file, - file_ignore_patterns = { "node_modules", ".git", ".angular" }, - generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter, - path_display = { "truncate" }, - winblend = 0, - border = {}, - borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, - color_devicons = true, - set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil, - file_previewer = require("telescope.previewers").vim_buffer_cat.new, - grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new, - qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new, - -- Developer configurations: Not meant for general override - buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker, - mappings = { - n = { ["q"] = require("telescope.actions").close }, - }, - }, - - extensions_list = { "themes", "terms", "fzf" }, - extensions = { - fzf = { - fuzzy = true, - override_generic_sorter = true, - override_file_sorter = true, - case_mode = "smart_case", - }, - }, -}) - -vim.keymap.set('n', 'ff', builtin.find_files, {}) -vim.keymap.set('n', 'fg', builtin.live_grep, {}) -vim.keymap.set('n', 'jj', builtin.buffers, {}) -vim.keymap.set('n', 'fh', builtin.help_tags, {}) diff --git a/lua/plugins.lua b/lua/plugins.lua index 6b16a08..6a2cb36 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -14,69 +14,61 @@ end vim.opt.rtp:prepend(lazypath) require("lazy").setup({ - { - 'nvim-telescope/telescope.nvim', - tag = '0.1.2', - dependencies = { 'nvim-lua/plenary.nvim' } - }, - -- themes { 'gruvbox-community/gruvbox' }, - -- gitsigns { 'lewis6991/gitsigns.nvim' }, - -- tpope commentary { 'tpope/vim-commentary' }, - + { + "folke/snacks.nvim", + priority = 1000, + lazy = false, + opts = { + -- bigfile = { enabled = true }, + -- dashboard = { enabled = true }, + -- explorer = { enabled = true }, + -- animate = { enabled = true }, + explorer = { enabled = true }, + indent = { enabled = true }, + input = { enabled = true }, + picker = { enabled = true }, + -- notifier = { enabled = true }, + -- quickfile = { enabled = true }, + -- scope = { enabled = true }, + scroll = { enabled = true }, + statuscolumn = { enabled = true }, + -- words = { enabled = true }, + lazygit = { enabled = true }, + }, + }, { "nvim-treesitter/nvim-treesitter", build = ":TSUpdate" }, - { - 'VonHeikemen/lsp-zero.nvim', - branch = 'v2.x', - dependencies = { - -- LSP Support - { 'neovim/nvim-lspconfig' }, -- Required - { -- Optional - 'williamboman/mason.nvim', - build = function() - pcall(vim.cmd, 'MasonUpdate') - end, - }, - { 'williamboman/mason-lspconfig.nvim' }, -- Optional - -- formatter - { - 'stevearc/conform.nvim', - opts = { - formatters_by_ft = { - htmlangular = { "prettier" }, - }, - }, - }, - -- Autocompletion - { 'hrsh7th/nvim-cmp' }, -- Required - { 'hrsh7th/cmp-nvim-lsp' }, -- Required - { 'L3MON4D3/LuaSnip' }, -- Required - { 'nvim-cmp' }, - -- { 'rcarriga/nvim-dap-ui', dependencies = { 'mfussenegger/nvim-dap' } }, - } + { 'neovim/nvim-lspconfig' }, -- Required + { -- Optional + 'williamboman/mason.nvim', + build = function() + pcall(vim.cmd, 'MasonUpdate') + end, }, + { 'williamboman/mason-lspconfig.nvim' }, -- Optional + { + 'stevearc/conform.nvim', + }, + -- Autocompletion + { 'hrsh7th/nvim-cmp' }, -- Required + { 'hrsh7th/cmp-nvim-lsp' }, -- Required + { 'L3MON4D3/LuaSnip' }, -- Required + -- roslyn { "seblyng/roslyn.nvim", ft = "cs", - -- @module 'roslyn.config' - -- @type RoslynNvimConfig opts = { -- your configuration comes here; leave empty for default settings }, }, { 'stevearc/oil.nvim', - ---@module 'oil' - ---@type oil.SetupOpts opts = {}, - -- Optional dependencies dependencies = { { "echasnovski/mini.icons", opts = {} } }, - -- dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if you prefer nvim-web-devicons - -- Lazy loading is not recommended because it is very tricky to make it work correctly in all situations. lazy = false, }, { @@ -84,13 +76,6 @@ require("lazy").setup({ branch = "harpoon2", dependencies = { "nvim-lua/plenary.nvim" } }, - { - "kdheepak/lazygit.nvim", - -- optional for floating window border decoration - dependencies = { - "nvim-lua/plenary.nvim", - }, - }, { "iamcco/markdown-preview.nvim", cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, @@ -98,6 +83,82 @@ require("lazy").setup({ build = function() vim.fn["mkdp#util#install"]() end, }, { 'mhinz/vim-startify' }, + { + 'kristijanhusak/vim-dadbod-ui', + dependencies = { + { 'tpope/vim-dadbod', lazy = true }, + { 'kristijanhusak/vim-dadbod-completion', ft = { 'sql', 'mysql', 'plsql' }, lazy = true }, + }, + cmd = { + 'DBUI', + 'DBUIToggle', + 'DBUIAddConnection', + 'DBUIFindBuffer', + }, + init = function() + -- Your DBUI configuration + vim.g.db_ui_use_nerd_fonts = 1 + end, + }, + { + "yetone/avante.nvim", + -- if you want to build from source then do `make BUILD_FROM_SOURCE=true` + -- ⚠️ must add this setting! ! ! + build = function() + -- conditionally use the correct build system for the current OS + if vim.fn.has("win32") == 1 then + return "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" + else + return "make" + end + + end, + event = "VeryLazy", + version = false, -- Never set this value to "*"! Never! + + dependencies = { + "nvim-lua/plenary.nvim", + "MunifTanjim/nui.nvim", + + --- The below dependencies are optional, + + "echasnovski/mini.pick", -- for file_selector provider mini.pick + "nvim-telescope/telescope.nvim", -- for file_selector provider telescope + "hrsh7th/nvim-cmp", -- autocompletion for avante commands and mentions + "ibhagwan/fzf-lua", -- for file_selector provider fzf + "stevearc/dressing.nvim", -- for input provider dressing + "folke/snacks.nvim", -- for input provider snacks + "nvim-tree/nvim-web-devicons", -- or echasnovski/mini.icons + "zbirenbaum/copilot.lua", -- for providers='copilot' + { + -- support for image pasting + "HakonHarnes/img-clip.nvim", + event = "VeryLazy", + opts = { + -- recommended settings + default = { + + embed_image_as_base64 = false, + prompt_for_file_name = false, + drag_and_drop = { + insert_mode = true, + }, + -- required for Windows users + use_absolute_path = true, + }, + + }, + }, + { + -- Make sure to set this up properly if you have lazy=true + 'MeanderingProgrammer/render-markdown.nvim', + opts = { + file_types = { "markdown", "Avante" }, + }, + ft = { "markdown", "Avante" }, + }, + }, + } }, opts) diff --git a/lua/remap.lua b/lua/remap.lua index f65c9a1..dd1c1aa 100644 --- a/lua/remap.lua +++ b/lua/remap.lua @@ -22,5 +22,6 @@ vim.keymap.set("n", "", ":bp") vim.keymap.set("n", "t2", ":set expandtab shiftwidth=2 softtabstop=2") vim.keymap.set("n", "t4", ":set expandtab shiftwidth=4 softtabstop=4") vim.keymap.set("n", "t", ":set noexpandtab shiftwidth=4 softtabstop=4") --- LazyGit -vim.keymap.set("n", "gg", ":LazyGit") + +vim.keymap.set("n", "gt", ":wincmd s :wincmd T") +vim.keymap.set("n", "tc", ":tabc") diff --git a/lua/set.lua b/lua/set.lua index 4f4aacc..cf691ec 100644 --- a/lua/set.lua +++ b/lua/set.lua @@ -11,11 +11,11 @@ vim.opt.smartindent = true vim.opt.wrap = false vim.opt.list = true +vim.opt.laststatus = 3 vim.opt.swapfile = false vim.opt.backup = false --- vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir" vim.opt.undofile = true vim.opt.hlsearch = true @@ -25,7 +25,7 @@ vim.opt.smartcase = true vim.opt.termguicolors = true -vim.opt.scrolloff = 8 +vim.opt.scrolloff = 10 vim.opt.signcolumn = "yes" vim.opt.updatetime = 50 From d99e522f94e8589ab47c23f0f2aa8ca844fa637a Mon Sep 17 00:00:00 2001 From: Andre Schaf Date: Mon, 6 Oct 2025 14:43:17 +0200 Subject: [PATCH 05/10] applied plugins / replaced avante --- lua/plugin/avante.lua | 12 -- lua/plugin/code-companion.lua | 10 ++ lua/plugins.lua | 261 ++++++++++++++-------------------- 3 files changed, 116 insertions(+), 167 deletions(-) delete mode 100644 lua/plugin/avante.lua create mode 100644 lua/plugin/code-companion.lua diff --git a/lua/plugin/avante.lua b/lua/plugin/avante.lua deleted file mode 100644 index 1e1d779..0000000 --- a/lua/plugin/avante.lua +++ /dev/null @@ -1,12 +0,0 @@ -require('avante').setup({ -provider = 'copilot', - providers = { - copilot = { - model = "claude-3.7-sonnet", - timeout = 30000, -- Timeout in milliseconds - }, - }, - selector = { - exclude_auto_select = { "oil" }, - }, -}) diff --git a/lua/plugin/code-companion.lua b/lua/plugin/code-companion.lua new file mode 100644 index 0000000..6e524a7 --- /dev/null +++ b/lua/plugin/code-companion.lua @@ -0,0 +1,10 @@ +require("codecompanion").setup({ + strategies = { + chat = { + adapter = { + name = "copilot", + model = "claude-3.7-sonnet", + }, + }, + }, +}) diff --git a/lua/plugins.lua b/lua/plugins.lua index 6a2cb36..2518cc6 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -1,170 +1,121 @@ local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then - vim.fn.system({ - "git", - "clone", - "--filter=blob:none", - "https://github.com/folke/lazy.nvim.git", - "--branch=stable", -- latest stable release - lazypath, - }) + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) end vim.opt.rtp:prepend(lazypath) require("lazy").setup({ - { 'gruvbox-community/gruvbox' }, - { 'lewis6991/gitsigns.nvim' }, - { 'tpope/vim-commentary' }, + { "gruvbox-community/gruvbox" }, + { "lewis6991/gitsigns.nvim" }, + { "tpope/vim-commentary" }, + { "tpope/vim-surround" }, + { + "folke/snacks.nvim", + priority = 1000, + lazy = false, + opts = { + -- bigfile = { enabled = true }, + -- dashboard = { enabled = true }, + -- explorer = { enabled = true }, + -- animate = { enabled = true }, + explorer = { enabled = true }, + indent = { enabled = true }, + input = { enabled = true }, + picker = { enabled = true }, + -- notifier = { enabled = true }, + -- quickfile = { enabled = true }, + -- scope = { enabled = true }, + scroll = { enabled = true }, + statuscolumn = { enabled = true }, + -- words = { enabled = true }, + lazygit = { enabled = true }, + }, + }, + { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + }, + { "neovim/nvim-lspconfig" }, -- Required + { -- Optional + "williamboman/mason.nvim", + build = function() + pcall(vim.cmd, "MasonUpdate") + end, + }, + { "williamboman/mason-lspconfig.nvim" }, -- Optional + { + "stevearc/conform.nvim", + }, + -- Autocompletion + { "hrsh7th/nvim-cmp" }, -- Required + { "hrsh7th/cmp-nvim-lsp" }, -- Required + { "L3MON4D3/LuaSnip" }, -- Required + -- roslyn + { + "seblyng/roslyn.nvim", + ft = "cs", + opts = { + -- your configuration comes here; leave empty for default settings + }, + }, + { + "stevearc/oil.nvim", + opts = {}, + dependencies = { { "echasnovski/mini.icons", opts = {} } }, + lazy = false, + }, + { + "ThePrimeagen/harpoon", + branch = "harpoon2", + dependencies = { "nvim-lua/plenary.nvim" }, + }, + { + "iamcco/markdown-preview.nvim", + cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, + ft = { "markdown" }, + build = function() + vim.fn["mkdp#util#install"]() + end, + }, + { "mhinz/vim-startify" }, + { + "kristijanhusak/vim-dadbod-ui", + dependencies = { + { "tpope/vim-dadbod", lazy = true }, + { "kristijanhusak/vim-dadbod-completion", ft = { "sql", "mysql", "plsql" }, lazy = true }, + }, + cmd = { + "DBUI", + "DBUIToggle", + "DBUIAddConnection", + "DBUIFindBuffer", + }, + init = function() + -- Your DBUI configuration + vim.g.db_ui_use_nerd_fonts = 1 + end, + }, { - "folke/snacks.nvim", - priority = 1000, - lazy = false, - opts = { - -- bigfile = { enabled = true }, - -- dashboard = { enabled = true }, - -- explorer = { enabled = true }, - -- animate = { enabled = true }, - explorer = { enabled = true }, - indent = { enabled = true }, - input = { enabled = true }, - picker = { enabled = true }, - -- notifier = { enabled = true }, - -- quickfile = { enabled = true }, - -- scope = { enabled = true }, - scroll = { enabled = true }, - statuscolumn = { enabled = true }, - -- words = { enabled = true }, - lazygit = { enabled = true }, - }, + "olimorris/codecompanion.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-treesitter/nvim-treesitter", + } }, - { - "nvim-treesitter/nvim-treesitter", build = ":TSUpdate" - }, - { 'neovim/nvim-lspconfig' }, -- Required - { -- Optional - 'williamboman/mason.nvim', - build = function() - pcall(vim.cmd, 'MasonUpdate') - end, - }, - { 'williamboman/mason-lspconfig.nvim' }, -- Optional - { - 'stevearc/conform.nvim', - }, - -- Autocompletion - { 'hrsh7th/nvim-cmp' }, -- Required - { 'hrsh7th/cmp-nvim-lsp' }, -- Required - { 'L3MON4D3/LuaSnip' }, -- Required - -- roslyn - { - "seblyng/roslyn.nvim", - ft = "cs", - opts = { - -- your configuration comes here; leave empty for default settings - }, - }, - { - 'stevearc/oil.nvim', - opts = {}, - dependencies = { { "echasnovski/mini.icons", opts = {} } }, - lazy = false, - }, - { - "ThePrimeagen/harpoon", - branch = "harpoon2", - dependencies = { "nvim-lua/plenary.nvim" } - }, - { - "iamcco/markdown-preview.nvim", - cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, - ft = { "markdown" }, - build = function() vim.fn["mkdp#util#install"]() end, - }, - { 'mhinz/vim-startify' }, - { - 'kristijanhusak/vim-dadbod-ui', - dependencies = { - { 'tpope/vim-dadbod', lazy = true }, - { 'kristijanhusak/vim-dadbod-completion', ft = { 'sql', 'mysql', 'plsql' }, lazy = true }, - }, - cmd = { - 'DBUI', - 'DBUIToggle', - 'DBUIAddConnection', - 'DBUIFindBuffer', - }, - init = function() - -- Your DBUI configuration - vim.g.db_ui_use_nerd_fonts = 1 - end, - }, - { - "yetone/avante.nvim", - -- if you want to build from source then do `make BUILD_FROM_SOURCE=true` - -- ⚠️ must add this setting! ! ! - build = function() - -- conditionally use the correct build system for the current OS - if vim.fn.has("win32") == 1 then - return "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" - else - return "make" - end - - end, - event = "VeryLazy", - version = false, -- Never set this value to "*"! Never! - - dependencies = { - "nvim-lua/plenary.nvim", - "MunifTanjim/nui.nvim", - - --- The below dependencies are optional, - - "echasnovski/mini.pick", -- for file_selector provider mini.pick - "nvim-telescope/telescope.nvim", -- for file_selector provider telescope - "hrsh7th/nvim-cmp", -- autocompletion for avante commands and mentions - "ibhagwan/fzf-lua", -- for file_selector provider fzf - "stevearc/dressing.nvim", -- for input provider dressing - "folke/snacks.nvim", -- for input provider snacks - "nvim-tree/nvim-web-devicons", -- or echasnovski/mini.icons - "zbirenbaum/copilot.lua", -- for providers='copilot' - { - -- support for image pasting - "HakonHarnes/img-clip.nvim", - event = "VeryLazy", - opts = { - -- recommended settings - default = { - - embed_image_as_base64 = false, - prompt_for_file_name = false, - drag_and_drop = { - insert_mode = true, - }, - -- required for Windows users - use_absolute_path = true, - }, - - }, - }, - { - -- Make sure to set this up properly if you have lazy=true - 'MeanderingProgrammer/render-markdown.nvim', - opts = { - file_types = { "markdown", "Avante" }, - }, - ft = { "markdown", "Avante" }, - }, - }, - } }, opts) - -local files = vim.split(vim.fn.globpath(vim.fn.stdpath('config') .. '/lua/plugin', '*.lua', true), '\n') +local files = vim.split(vim.fn.globpath(vim.fn.stdpath("config") .. "/lua/plugin", "*.lua", true), "\n") for _, f in ipairs(files) do - local name = vim.fn.fnamemodify(f, ':t:r') - require('plugin.' .. name) + local name = vim.fn.fnamemodify(f, ":t:r") + require("plugin." .. name) end From eb4a4d734437d04c3ad0903b39020fa079351ae2 Mon Sep 17 00:00:00 2001 From: Andre Schaf Date: Mon, 6 Oct 2025 14:43:29 +0200 Subject: [PATCH 06/10] applied format keybind --- lua/lspconf.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/lspconf.lua b/lua/lspconf.lua index 6edd57a..65434d8 100644 --- a/lua/lspconf.lua +++ b/lua/lspconf.lua @@ -24,8 +24,8 @@ local on_attach = function(_, bufnr) vim.keymap.set({ "n", "v" }, "ca", vim.lsp.buf.code_action, opts) vim.keymap.set("n", "gr", vim.lsp.buf.references, opts) - vim.keymap.set('n', 'F', function() - vim.lsp.buf.format { async = true } + vim.keymap.set("n", "F", function() + vim.lsp.buf.format({ async = true }) end, opts) vim.keymap.set("n", "f", function() From afcf5f92e7a4e0320c08839267f5c5ec9fa36dbb Mon Sep 17 00:00:00 2001 From: Andre Schaf Date: Mon, 6 Oct 2025 14:43:39 +0200 Subject: [PATCH 07/10] added additional keybindings --- lua/remap.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lua/remap.lua b/lua/remap.lua index dd1c1aa..9a98430 100644 --- a/lua/remap.lua +++ b/lua/remap.lua @@ -23,5 +23,9 @@ vim.keymap.set("n", "t2", ":set expandtab shiftwidth=2 softtabsto vim.keymap.set("n", "t4", ":set expandtab shiftwidth=4 softtabstop=4") vim.keymap.set("n", "t", ":set noexpandtab shiftwidth=4 softtabstop=4") -vim.keymap.set("n", "gt", ":wincmd s :wincmd T") -vim.keymap.set("n", "tc", ":tabc") +vim.keymap.set("n", "gt", ":wincmd s :wincmd T") +vim.keymap.set("n", "tc", ":tabc") + +-- copy current file path +vim.keymap.set("n", "cp", ":let @+ = expand('%')") + From ad2f7805d16b82bcf8d44a27818b8ba1cf15cbcd Mon Sep 17 00:00:00 2001 From: Andre Schaf Date: Mon, 27 Oct 2025 15:01:25 +0100 Subject: [PATCH 08/10] applied code companion --- lua/plugin/code-companion.lua | 2 +- lua/plugins.lua | 19 ++++++++++++------- lua/remap.lua | 4 ++++ 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/lua/plugin/code-companion.lua b/lua/plugin/code-companion.lua index 6e524a7..f3e175e 100644 --- a/lua/plugin/code-companion.lua +++ b/lua/plugin/code-companion.lua @@ -3,7 +3,7 @@ require("codecompanion").setup({ chat = { adapter = { name = "copilot", - model = "claude-3.7-sonnet", + model = "claude-sonnet-4", }, }, }, diff --git a/lua/plugins.lua b/lua/plugins.lua index 2518cc6..68be979 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -40,6 +40,10 @@ require("lazy").setup({ lazygit = { enabled = true }, }, }, + { + "MeanderingProgrammer/render-markdown.nvim", + ft = { "markdown", "codecompanion" }, + }, { "nvim-treesitter/nvim-treesitter", build = ":TSUpdate", @@ -104,13 +108,13 @@ require("lazy").setup({ vim.g.db_ui_use_nerd_fonts = 1 end, }, - { - "olimorris/codecompanion.nvim", - dependencies = { - "nvim-lua/plenary.nvim", - "nvim-treesitter/nvim-treesitter", - } - }, + { + "olimorris/codecompanion.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-treesitter/nvim-treesitter", + }, + }, }, opts) local files = vim.split(vim.fn.globpath(vim.fn.stdpath("config") .. "/lua/plugin", "*.lua", true), "\n") @@ -119,3 +123,4 @@ for _, f in ipairs(files) do local name = vim.fn.fnamemodify(f, ":t:r") require("plugin." .. name) end + diff --git a/lua/remap.lua b/lua/remap.lua index 9a98430..0aaf481 100644 --- a/lua/remap.lua +++ b/lua/remap.lua @@ -29,3 +29,7 @@ vim.keymap.set("n", "tc", ":tabc") -- copy current file path vim.keymap.set("n", "cp", ":let @+ = expand('%')") +-- code companion +vim.keymap.set({"n", "v"}, "cc", ":CodeCompanionChat Toggle") +vim.keymap.set("v", "acc", "CodeCompanionChat Add") + From ec3135a937887a1014d49b268d1b54c1313872b7 Mon Sep 17 00:00:00 2001 From: Andre Schaf Date: Fri, 31 Oct 2025 15:17:39 +0100 Subject: [PATCH 09/10] applied lsp config --- lua/lsp.lua | 54 ++++++++++++---------- lua/lspconf/angular.lua | 69 ---------------------------- lua/lspconf/angularls.lua | 71 +++++++++++++++++++++++++++++ lua/lspconf/csharp.lua | 16 ------- lua/lspconf/intelephense.lua | 25 ++++++++++ lua/lspconf/{lua.lua => lua_ls.lua} | 6 +-- lua/lspconf/php.lua | 33 -------------- lua/lspconf/roslyn.lua | 16 +++++++ lua/plugins.lua | 1 - 9 files changed, 145 insertions(+), 146 deletions(-) delete mode 100644 lua/lspconf/angular.lua create mode 100644 lua/lspconf/angularls.lua delete mode 100644 lua/lspconf/csharp.lua create mode 100644 lua/lspconf/intelephense.lua rename lua/lspconf/{lua.lua => lua_ls.lua} (90%) delete mode 100644 lua/lspconf/php.lua create mode 100644 lua/lspconf/roslyn.lua diff --git a/lua/lsp.lua b/lua/lsp.lua index 9c4850e..d2db37f 100644 --- a/lua/lsp.lua +++ b/lua/lsp.lua @@ -1,32 +1,38 @@ -local loaded_configs = require('lspconfig.configs') -local lspconfig = require('lspconfig') -local my_config = require('lspconf') +local my_config = require("lspconf") -local function load_custom_configs() - local config_files = vim.split(vim.fn.globpath(vim.fn.stdpath('config') .. '/lua/lspconf', '*.lua', true), '\n') +local function get_custom_server_names() + local config_files = vim.split(vim.fn.globpath(vim.fn.stdpath("config") .. "/lua/lspconf", "*.lua", true), "\n") + local custom_servers = {} - for _, f in ipairs(config_files) do - local name = vim.fn.fnamemodify(f, ':t:r') - require('lspconf.' .. name) - end + for _, f in ipairs(config_files) do + local name = vim.fn.fnamemodify(f, ":t:r") + custom_servers[name] = true + end + + return custom_servers end -local function setup_default_configs() - local available_servers = require('mason-lspconfig').get_installed_servers() - local config = my_config - local excluded = { angularls = true, roslyn = true } +local function load_custom_configs() + local config_files = vim.split(vim.fn.globpath(vim.fn.stdpath("config") .. "/lua/lspconf", "*.lua", true), "\n") - for _, server in pairs(available_servers) do - if loaded_configs[server] or excluded[server] then - goto continue - end - - lspconfig[server].setup(config) - vim.lsp.config(server, config) - - ::continue:: - end + for _, f in ipairs(config_files) do + local name = vim.fn.fnamemodify(f, ":t:r") + require("lspconf." .. name) + end end load_custom_configs() -setup_default_configs() + +local available_servers = require("mason-lspconfig").get_installed_servers() +local config = my_config +local custom_servers = get_custom_server_names() +-- Always exclude these special cases +-- custom_servers.stylua = true + +for _, server in pairs(available_servers) do + if not custom_servers[server] then + vim.lsp.config(server, config) + end + + vim.lsp.enable(server) +end diff --git a/lua/lspconf/angular.lua b/lua/lspconf/angular.lua deleted file mode 100644 index 1015999..0000000 --- a/lua/lspconf/angular.lua +++ /dev/null @@ -1,69 +0,0 @@ -local lspconfig = require 'lspconfig' - --- Angular requires a node_modules directory to probe for @angular/language-service and typescript --- in order to use your projects configured versions. --- This defaults to the vim cwd, but will get overwritten by the resolved root of the file. -local function get_probe_dir(root_dir) - local project_root = vim.fs.dirname(vim.fs.find('node_modules', { path = root_dir, upward = true })[1]) - - return project_root and (project_root .. '/node_modules') or '' -end - -local function get_angular_core_version(root_dir) - local project_root = vim.fs.dirname(vim.fs.find('node_modules', { path = root_dir, upward = true })[1]) - - if not project_root then - return '' - end - - local package_json = project_root .. '/package.json' - if not vim.uv.fs_stat(package_json) then - return '' - end - - local contents = io.open(package_json):read '*a' - local json = vim.json.decode(contents) - if not json.dependencies then - return '' - end - - local angular_core_version = json.dependencies['@angular/core'] - - angular_core_version = angular_core_version and angular_core_version:match('%d+%.%d+%.%d+') - - return angular_core_version -end - -local default_probe_dir = get_probe_dir(vim.fn.getcwd()) -local default_angular_core_version = get_angular_core_version(vim.fn.getcwd()) - -local cmd = { - 'node', - '--max-old-space-size=8192', - vim.fn.exepath('ngserver'), - '--stdio', - '--tsProbeLocations', - default_probe_dir, - '--ngProbeLocations', - default_probe_dir, - '--angularCoreVersion', - default_angular_core_version, -} - -local config = { - cmd = cmd, - on_new_config = function(new_config,new_root_dir) - new_config.cmd = cmd - end, - on_attach = function() - for _, server in ipairs(vim.lsp.get_clients()) do - if server.name == "ts_ls" then - local tsserver = vim.lsp.get_client_by_id(server.id) - tsserver.server_capabilities.renameProvider = false - end - end - end -} - -lspconfig.angularls.setup(config) - diff --git a/lua/lspconf/angularls.lua b/lua/lspconf/angularls.lua new file mode 100644 index 0000000..89104db --- /dev/null +++ b/lua/lspconf/angularls.lua @@ -0,0 +1,71 @@ +-- Angular requires a node_modules directory to probe for @angular/language-service and typescript +-- in order to use your projects configured versions. +-- This defaults to the vim cwd, but will get overwritten by the resolved root of the file. +local function get_probe_dir(root_dir) + local project_root = vim.fs.dirname(vim.fs.find("node_modules", { path = root_dir, upward = true })[1]) + + return project_root and (project_root .. "/node_modules") or "" +end + +local function get_angular_core_version(root_dir) + local project_root = vim.fs.dirname(vim.fs.find("node_modules", { path = root_dir, upward = true })[1]) + + if not project_root then + return "" + end + + local package_json = project_root .. "/package.json" + if not vim.uv.fs_stat(package_json) then + return "" + end + + local contents = io.open(package_json):read("*a") + local json = vim.json.decode(contents) + if not json.dependencies then + return "" + end + + local angular_core_version = json.dependencies["@angular/core"] + + angular_core_version = angular_core_version and angular_core_version:match("%d+%.%d+%.%d+") + + return angular_core_version +end + +local default_probe_dir = get_probe_dir(vim.fn.getcwd()) +local default_angular_core_version = get_angular_core_version(vim.fn.getcwd()) + +local cmd = { + 'node', + '--max-old-space-size=8192', + vim.fn.exepath('ngserver'), + '--stdio', + '--tsProbeLocations', + default_probe_dir, + '--ngProbeLocations', + default_probe_dir, + '--angularCoreVersion', + default_angular_core_version, +} + +local my_config = require("lspconf") + +local config = { + cmd = cmd, + on_new_config = function(new_config, new_root_dir) + new_config.cmd = cmd + end, + on_attach = function(client, bufnr) + my_config.on_attach(client, bufnr) + for _, server in ipairs(vim.lsp.get_clients()) do + if server.name == "ts_ls" then + local tsserver = vim.lsp.get_client_by_id(server.id) + tsserver.server_capabilities.renameProvider = false + end + end + end, + capabilities = my_config.capabilities, +} + +vim.lsp.config("angularls", config) + diff --git a/lua/lspconf/csharp.lua b/lua/lspconf/csharp.lua deleted file mode 100644 index 92183d9..0000000 --- a/lua/lspconf/csharp.lua +++ /dev/null @@ -1,16 +0,0 @@ -local my_config = require('lspconf') - -vim.lsp.config("roslyn", { - on_attach = my_config.on_attach, - capabilities = my_config.capabilities, - settings = { - ["csharp|inlay_hints"] = { - csharp_enable_inlay_hints_for_implicit_object_creation = true, - csharp_enable_inlay_hints_for_implicit_variable_types = true, - }, - ["csharp|code_lens"] = { - - dotnet_enable_references_code_lens = true, - }, - }, -}) diff --git a/lua/lspconf/intelephense.lua b/lua/lspconf/intelephense.lua new file mode 100644 index 0000000..96ec7f7 --- /dev/null +++ b/lua/lspconf/intelephense.lua @@ -0,0 +1,25 @@ + local my_config = require('lspconf') + + vim.lsp.config('intelephense', { + cmd = { 'intelephense', '--stdio' }, + filetypes = { 'php' }, + root_dir = function(fname) + return vim.loop.cwd() + end, + on_attach = my_config.on_attach, + capabilities = my_config.capabilities, + settings = { + intelephense = { + files = { + maxSize = 1000000, + }, + environment = { + includePaths = { + "/home/serii/Sites/wordpress", + "/home/serii/Sites/advanced-custom-fields-pro", + "/home/serii/Sites/woocommerce" + } + } + } + } + }) \ No newline at end of file diff --git a/lua/lspconf/lua.lua b/lua/lspconf/lua_ls.lua similarity index 90% rename from lua/lspconf/lua.lua rename to lua/lspconf/lua_ls.lua index 51a883e..bb7c3bc 100644 --- a/lua/lspconf/lua.lua +++ b/lua/lspconf/lua_ls.lua @@ -1,8 +1,8 @@ -local lspconfig = require("lspconfig") local my_conf = require("lspconf") -lspconfig.lua_ls.setup({ + vim.lsp.config('lua_ls', { on_attach = my_conf.on_attach, + capabilities = my_conf.capabilities, settings = { Lua = { runtime = { @@ -28,4 +28,4 @@ lspconfig.lua_ls.setup({ }, }, }, -}) +}) \ No newline at end of file diff --git a/lua/lspconf/php.lua b/lua/lspconf/php.lua deleted file mode 100644 index cc67e03..0000000 --- a/lua/lspconf/php.lua +++ /dev/null @@ -1,33 +0,0 @@ -local lspconfig = require 'lspconfig' -local configs = require 'lspconfig.configs' - -local capabilities = vim.lsp.protocol.make_client_capabilities() -capabilities.textDocument.completion.completionItem.snippetSupport = true - -if not configs.intelephense then - configs.intelephense = { - default_config = { - cmd = { 'intelephense', '--stdio' }, - filetypes = { 'php' }, - root_dir = function(fname) - return vim.loop.cwd() - end, - settings = { - intelephense = { - files = { - maxSize = 1000000, - }, - environment = { - includePaths = { - "/home/serii/Sites/wordpress", - "/home/serii/Sites/advanced-custom-fields-pro", - "/home/serii/Sites/woocommerce" - } - } - } - } - } - } -end - -lspconfig.intelephense.setup { capabilities = capabilities } diff --git a/lua/lspconf/roslyn.lua b/lua/lspconf/roslyn.lua new file mode 100644 index 0000000..1845f26 --- /dev/null +++ b/lua/lspconf/roslyn.lua @@ -0,0 +1,16 @@ +local my_config = require("lspconf") + +vim.lsp.config("roslyn", { + on_attach = my_config.on_attach, + capabilities = my_config.capabilities, + settings = { + ["csharp|inlay_hints"] = { + csharp_enable_inlay_hints_for_implicit_object_creation = true, + csharp_enable_inlay_hints_for_implicit_variable_types = true, + }, + ["csharp|code_lens"] = { + + dotnet_enable_references_code_lens = true, + }, + }, +}) \ No newline at end of file diff --git a/lua/plugins.lua b/lua/plugins.lua index 68be979..6afce57 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -123,4 +123,3 @@ for _, f in ipairs(files) do local name = vim.fn.fnamemodify(f, ":t:r") require("plugin." .. name) end - From c144250c7563089cc8d6831e96fb364a001cc512 Mon Sep 17 00:00:00 2001 From: Andre Schaf Date: Mon, 13 Apr 2026 16:11:07 +0200 Subject: [PATCH 10/10] fixes --- lua/lspconf.lua | 6 +++++- lua/plugins.lua | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lua/lspconf.lua b/lua/lspconf.lua index 65434d8..fcad88f 100644 --- a/lua/lspconf.lua +++ b/lua/lspconf.lua @@ -1,6 +1,10 @@ local conform = require("conform") -local on_attach = function(_, bufnr) +local on_attach = function(client, bufnr) + if client.config.flags then + client.config.flags.debounce_text_changes = 300 + end + local opts = { buffer = bufnr, remap = false } -- Global mappings. diff --git a/lua/plugins.lua b/lua/plugins.lua index 6afce57..37a6c22 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -18,6 +18,7 @@ require("lazy").setup({ { "lewis6991/gitsigns.nvim" }, { "tpope/vim-commentary" }, { "tpope/vim-surround" }, + { "sphamba/smear-cursor.nvim", opts = {}, }, { "folke/snacks.nvim", priority = 1000,