diff --git a/lua/lsp.lua b/lua/lsp.lua index d2db37f..0d4fea6 100644 --- a/lua/lsp.lua +++ b/lua/lsp.lua @@ -1,38 +1,91 @@ -local my_config = require("lspconf") +local lsp = require('lsp-zero').preset({}) +local lspconfig = require('lspconfig') +local loaded_configs = require('lspconfig.configs') +local conform = require('conform') -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 = {} +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) - for _, f in ipairs(config_files) do - local name = vim.fn.fnamemodify(f, ":t:r") - custom_servers[name] = true - end + vim.keymap.set('n', 'f', function() + vim.lsp.buf.format { async = true } + end, opts) - return custom_servers + 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 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() + + for _, server in pairs(available_servers) do + if not loaded_configs[server] then + lspconfig[server].setup(config) + end + 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 +lsp.on_attach(on_attach) +lsp.setup() -for _, server in pairs(available_servers) do - if not custom_servers[server] then - vim.lsp.config(server, config) - end +-- You need to setup `cmp` after lsp-zero +local cmp = require('cmp') +local cmp_action = require('lsp-zero').cmp_action() - vim.lsp.enable(server) -end +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 deleted file mode 100644 index fcad88f..0000000 --- a/lua/lspconf.lua +++ /dev/null @@ -1,48 +0,0 @@ -local conform = require("conform") - -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. - -- 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 new file mode 100644 index 0000000..fb86039 --- /dev/null +++ b/lua/lspconf/angular.lua @@ -0,0 +1,12 @@ +local lspconfig = require 'lspconfig' + +lspconfig.angularls.setup({ + on_attach = function() + for _, server in ipairs(vim.lsp.buf_get_clients()) do + if server.name == "tsserver" then + local tsserver = vim.lsp.get_client_by_id(server.id) + tsserver.server_capabilities.renameProvider = false + end + end + end +}) diff --git a/lua/lspconf/angularls.lua b/lua/lspconf/angularls.lua deleted file mode 100644 index 89104db..0000000 --- a/lua/lspconf/angularls.lua +++ /dev/null @@ -1,71 +0,0 @@ --- 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 new file mode 100644 index 0000000..a47be71 --- /dev/null +++ b/lua/lspconf/csharp.lua @@ -0,0 +1,92 @@ +local util = require 'lspconfig.util' +local configs = require 'lspconfig.configs' + +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" }, + }, + + 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/intelephense.lua b/lua/lspconf/intelephense.lua deleted file mode 100644 index 96ec7f7..0000000 --- a/lua/lspconf/intelephense.lua +++ /dev/null @@ -1,25 +0,0 @@ - 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.lua new file mode 100644 index 0000000..85b350c --- /dev/null +++ b/lua/lspconf/lua.lua @@ -0,0 +1,29 @@ +local lspconfig = require('lspconfig') + +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, + }, + }, + }, +} diff --git a/lua/lspconf/lua_ls.lua b/lua/lspconf/lua_ls.lua deleted file mode 100644 index bb7c3bc..0000000 --- a/lua/lspconf/lua_ls.lua +++ /dev/null @@ -1,31 +0,0 @@ -local my_conf = require("lspconf") - - vim.lsp.config('lua_ls', { - on_attach = my_conf.on_attach, - capabilities = my_conf.capabilities, - 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, - }, - }, - }, -}) \ No newline at end of file diff --git a/lua/lspconf/php.lua b/lua/lspconf/php.lua new file mode 100644 index 0000000..cc67e03 --- /dev/null +++ b/lua/lspconf/php.lua @@ -0,0 +1,33 @@ +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 deleted file mode 100644 index 1845f26..0000000 --- a/lua/lspconf/roslyn.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, - }, - }, -}) \ No newline at end of file diff --git a/lua/plugin/cmp.lua b/lua/plugin/cmp.lua deleted file mode 100644 index c2cc6db..0000000 --- a/lua/plugin/cmp.lua +++ /dev/null @@ -1,25 +0,0 @@ -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/code-companion.lua b/lua/plugin/code-companion.lua deleted file mode 100644 index f3e175e..0000000 --- a/lua/plugin/code-companion.lua +++ /dev/null @@ -1,10 +0,0 @@ -require("codecompanion").setup({ - strategies = { - chat = { - adapter = { - name = "copilot", - model = "claude-sonnet-4", - }, - }, - }, -}) diff --git a/lua/plugin/formatter.lua b/lua/plugin/formatter.lua index cfe2674..48f5e6d 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/mason.lua b/lua/plugin/mason.lua deleted file mode 100644 index 12d8f1f..0000000 --- a/lua/plugin/mason.lua +++ /dev/null @@ -1,6 +0,0 @@ -require("mason").setup({ - registries = { - "github:mason-org/mason-registry", - "github:Crashdummyy/mason-registry", - }, -}) diff --git a/lua/plugin/neo-tree.lua b/lua/plugin/neo-tree.lua new file mode 100644 index 0000000..8719510 --- /dev/null +++ b/lua/plugin/neo-tree.lua @@ -0,0 +1,12 @@ +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 deleted file mode 100644 index b7e43fe..0000000 --- a/lua/plugin/oil.lua +++ /dev/null @@ -1,8 +0,0 @@ -require("oil").setup { - view_options = { - -- Show files and directories that start with "." - show_hidden = true, - - } -} - diff --git a/lua/plugin/snacks.lua b/lua/plugin/snacks.lua deleted file mode 100644 index 6e24f0d..0000000 --- a/lua/plugin/snacks.lua +++ /dev/null @@ -1,10 +0,0 @@ -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 new file mode 100644 index 0000000..0b00d89 --- /dev/null +++ b/lua/plugin/telescope.lua @@ -0,0 +1,69 @@ +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 37a6c22..8bd1445 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -1,126 +1,96 @@ 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" }, - { "tpope/vim-surround" }, - { "sphamba/smear-cursor.nvim", opts = {}, }, - { - "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 }, - }, - }, - { - "MeanderingProgrammer/render-markdown.nvim", - ft = { "markdown", "codecompanion" }, - }, - { - "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, - }, - { - "olimorris/codecompanion.nvim", - dependencies = { - "nvim-lua/plenary.nvim", - "nvim-treesitter/nvim-treesitter", - }, - }, + { + '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' }, + + { + "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 = {}, + }, + -- Autocompletion + { 'hrsh7th/nvim-cmp' }, -- Required + { 'hrsh7th/cmp-nvim-lsp' }, -- Required + { 'L3MON4D3/LuaSnip' }, -- Required + { 'nvim-cmp' }, + -- { 'rcarriga/nvim-dap-ui', dependencies = { 'mfussenegger/nvim-dap' } }, + } + }, + { + "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, + }, + { + "ThePrimeagen/harpoon", + 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" }, + ft = { "markdown" }, + build = function() vim.fn["mkdp#util#install"]() end, + }, + { 'github/copilot.vim' }, + { 'mhinz/vim-startify' }, }, 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 diff --git a/lua/remap.lua b/lua/remap.lua index 0aaf481..7b9ae2e 100644 --- a/lua/remap.lua +++ b/lua/remap.lua @@ -1,4 +1,5 @@ -vim.keymap.set("n", "kk", "Oil", { desc = "Open parent directory" }) +vim.keymap.set("n", ";;", ":Neotree toggle") +vim.keymap.set("n", "kk", ":Neotree reveal") -- jk to escape vim.keymap.set("i", "jk", "") @@ -22,14 +23,5 @@ 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") - -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('%')") - --- code companion -vim.keymap.set({"n", "v"}, "cc", ":CodeCompanionChat Toggle") -vim.keymap.set("v", "acc", "CodeCompanionChat Add") - +-- LazyGit +vim.keymap.set("n", "gg", ":LazyGit") diff --git a/lua/set.lua b/lua/set.lua index cf691ec..2da4ab7 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,23 +25,10 @@ vim.opt.smartcase = true vim.opt.termguicolors = true -vim.opt.scrolloff = 10 +vim.opt.scrolloff = 8 vim.opt.signcolumn = "yes" 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, -}