lsp snacks and avante
This commit is contained in:
parent
cc53010b2e
commit
633ef6a9cb
13 changed files with 283 additions and 331 deletions
81
lua/lsp.lua
81
lua/lsp.lua
|
|
@ -1,50 +1,6 @@
|
||||||
local lsp = require('lsp-zero').preset({})
|
|
||||||
local lspconfig = require('lspconfig')
|
|
||||||
local loaded_configs = require('lspconfig.configs')
|
local loaded_configs = require('lspconfig.configs')
|
||||||
local conform = require('conform')
|
local lspconfig = require('lspconfig')
|
||||||
|
local my_config = require('lspconf')
|
||||||
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', '<space>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', '<space>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', '<C-k>', vim.lsp.buf.signature_help, opts)
|
|
||||||
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts)
|
|
||||||
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts)
|
|
||||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts)
|
|
||||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts)
|
|
||||||
vim.keymap.set('n', '<space>wl', function()
|
|
||||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
|
||||||
end, opts)
|
|
||||||
vim.keymap.set({ 'n', 'v' }, '<space>ca', vim.lsp.buf.code_action, opts)
|
|
||||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
|
|
||||||
|
|
||||||
vim.keymap.set('n', '<space>f', function()
|
|
||||||
vim.lsp.buf.format { async = true }
|
|
||||||
end, opts)
|
|
||||||
|
|
||||||
vim.keymap.set('n', '<space>L', ':EslintFixAll<cr>')
|
|
||||||
|
|
||||||
vim.keymap.set('n', '<space>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 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')
|
||||||
|
|
@ -57,35 +13,20 @@ end
|
||||||
|
|
||||||
local function setup_default_configs()
|
local function setup_default_configs()
|
||||||
local available_servers = require('mason-lspconfig').get_installed_servers()
|
local available_servers = require('mason-lspconfig').get_installed_servers()
|
||||||
local config = get_config()
|
local config = my_config
|
||||||
|
local excluded = { angularls = true, roslyn = true }
|
||||||
|
|
||||||
for _, server in pairs(available_servers) do
|
for _, server in pairs(available_servers) do
|
||||||
if not loaded_configs[server] then
|
if loaded_configs[server] or excluded[server] then
|
||||||
lspconfig[server].setup(config)
|
goto continue
|
||||||
end
|
end
|
||||||
|
|
||||||
|
lspconfig[server].setup(config)
|
||||||
|
vim.lsp.config(server, config)
|
||||||
|
|
||||||
|
::continue::
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
load_custom_configs()
|
load_custom_configs()
|
||||||
setup_default_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
|
|
||||||
['<CR>'] = cmp.mapping.confirm({ select = false }),
|
|
||||||
|
|
||||||
-- Ctrl+Space to trigger completion menu
|
|
||||||
['<C-Space>'] = cmp.mapping.complete(),
|
|
||||||
|
|
||||||
-- Navigate between snippet placeholder
|
|
||||||
['<C-f>'] = cmp_action.luasnip_jump_forward(),
|
|
||||||
['<C-b>'] = cmp_action.luasnip_jump_backward(),
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
|
||||||
44
lua/lspconf.lua
Normal file
44
lua/lspconf.lua
Normal file
|
|
@ -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", "<space>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", "<space>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", "<C-k>", vim.lsp.buf.signature_help, opts)
|
||||||
|
vim.keymap.set("n", "<space>wa", vim.lsp.buf.add_workspace_folder, opts)
|
||||||
|
vim.keymap.set("n", "<space>wr", vim.lsp.buf.remove_workspace_folder, opts)
|
||||||
|
vim.keymap.set("n", "<space>D", vim.lsp.buf.type_definition, opts)
|
||||||
|
vim.keymap.set("n", "<space>rn", vim.lsp.buf.rename, opts)
|
||||||
|
vim.keymap.set("n", "<space>wl", function()
|
||||||
|
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||||
|
end, opts)
|
||||||
|
vim.keymap.set({ "n", "v" }, "<space>ca", vim.lsp.buf.code_action, opts)
|
||||||
|
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
|
||||||
|
|
||||||
|
vim.keymap.set('n', '<space>F', function()
|
||||||
|
vim.lsp.buf.format { async = true }
|
||||||
|
end, opts)
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<space>f", function()
|
||||||
|
conform.format({ bufnr = bufnr })
|
||||||
|
end, opts)
|
||||||
|
|
||||||
|
vim.keymap.set("i", "<C-n>", 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,
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
local lspconfig = require 'lspconfig'
|
local lspconfig = require 'lspconfig'
|
||||||
local configs = require 'lspconfig.configs'
|
|
||||||
|
|
||||||
-- Angular requires a node_modules directory to probe for @angular/language-service and typescript
|
-- Angular requires a node_modules directory to probe for @angular/language-service and typescript
|
||||||
-- in order to use your projects configured versions.
|
-- in order to use your projects configured versions.
|
||||||
|
|
@ -51,18 +50,20 @@ local cmd = {
|
||||||
default_angular_core_version,
|
default_angular_core_version,
|
||||||
}
|
}
|
||||||
|
|
||||||
lspconfig.angularls.setup({
|
local config = {
|
||||||
cmd = cmd,
|
cmd = cmd,
|
||||||
on_new_config = function(new_config,new_root_dir)
|
on_new_config = function(new_config,new_root_dir)
|
||||||
new_config.cmd = cmd
|
new_config.cmd = cmd
|
||||||
end,
|
end,
|
||||||
on_attach = function()
|
on_attach = function()
|
||||||
for _, server in ipairs(vim.lsp.get_clients()) do
|
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)
|
local tsserver = vim.lsp.get_client_by_id(server.id)
|
||||||
tsserver.server_capabilities.renameProvider = false
|
tsserver.server_capabilities.renameProvider = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
}
|
||||||
|
|
||||||
|
lspconfig.angularls.setup(config)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,92 +1,16 @@
|
||||||
local util = require 'lspconfig.util'
|
local my_config = require('lspconf')
|
||||||
local configs = require 'lspconfig.configs'
|
|
||||||
|
|
||||||
configs.omnisharp = {
|
vim.lsp.config("roslyn", {
|
||||||
default_config = {
|
on_attach = my_config.on_attach,
|
||||||
cmd = { "dotnet",
|
capabilities = my_config.capabilities,
|
||||||
"C:\\Users\\andre.schaf\\.vscode\\extensions\\ms-dotnettools.csharp-2.13.10-win32-x64\\.roslyn\\Microsoft.CodeAnalysis.LanguageServer.dll"
|
settings = {
|
||||||
-- "C:\\dev\\tools\\omni\\OmniSharp.Roslyn.dll"
|
["csharp|inlay_hints"] = {
|
||||||
-- "/path/to/omnisharp/OmniSharp.dll" },
|
csharp_enable_inlay_hints_for_implicit_object_creation = true,
|
||||||
|
csharp_enable_inlay_hints_for_implicit_variable_types = true,
|
||||||
},
|
},
|
||||||
|
["csharp|code_lens"] = {
|
||||||
|
|
||||||
filetypes = { 'cs' },
|
dotnet_enable_references_code_lens = true,
|
||||||
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 = {},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,21 @@
|
||||||
local lspconfig = require('lspconfig')
|
local lspconfig = require("lspconfig")
|
||||||
|
local my_conf = require("lspconf")
|
||||||
|
|
||||||
lspconfig.lua_ls.setup {
|
lspconfig.lua_ls.setup({
|
||||||
|
on_attach = my_conf.on_attach,
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
runtime = {
|
runtime = {
|
||||||
-- Tell the language server which version of Lua you're using
|
-- Tell the language server which version of Lua you're using
|
||||||
-- (most likely LuaJIT in the case of Neovim)
|
-- (most likely LuaJIT in the case of Neovim)
|
||||||
version = 'LuaJIT',
|
version = "LuaJIT",
|
||||||
},
|
},
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
-- Get the language server to recognize the `vim` global
|
-- Get the language server to recognize the `vim` global
|
||||||
globals = {
|
globals = {
|
||||||
'vim',
|
"vim",
|
||||||
'require',
|
"require",
|
||||||
'opt',
|
"opt",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
workspace = {
|
workspace = {
|
||||||
|
|
@ -26,4 +28,4 @@ lspconfig.lua_ls.setup {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
})
|
||||||
|
|
|
||||||
12
lua/plugin/avante.lua
Normal file
12
lua/plugin/avante.lua
Normal file
|
|
@ -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" },
|
||||||
|
},
|
||||||
|
})
|
||||||
25
lua/plugin/cmp.lua
Normal file
25
lua/plugin/cmp.lua
Normal file
|
|
@ -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({
|
||||||
|
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||||
|
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||||
|
["<CR>"] = 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" },
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
|
@ -4,7 +4,7 @@ formatter.setup({
|
||||||
formatters_by_ft = {
|
formatters_by_ft = {
|
||||||
lua = { "stylua" },
|
lua = { "stylua" },
|
||||||
-- Use a sub-list to run only the first available formatter
|
-- Use a sub-list to run only the first available formatter
|
||||||
javascript = { { "prettierd", "prettier" } },
|
javascript = { "prettierd", "prettier" },
|
||||||
typescript = { { "prettier" } },
|
typescript = { "prettier" },
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
||||||
10
lua/plugin/snacks.lua
Normal file
10
lua/plugin/snacks.lua
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
local Snacks = require('snacks')
|
||||||
|
|
||||||
|
-- Picker
|
||||||
|
vim.keymap.set('n', '<leader>ff', function() Snacks.picker.smart() end, {})
|
||||||
|
vim.keymap.set('n', '<leader>fg', function() Snacks.picker.grep() end, {})
|
||||||
|
vim.keymap.set('n', '<leader>jj', function() Snacks.picker.buffers() end, {})
|
||||||
|
vim.keymap.set('n', '<leader>fh', function() Snacks.picker.comand_history() end, {})
|
||||||
|
|
||||||
|
-- LazyGit
|
||||||
|
vim.keymap.set("n", "<leader>gg", function() Snacks.lazygit() end, {})
|
||||||
|
|
@ -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', '<leader>ff', builtin.find_files, {})
|
|
||||||
vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
|
|
||||||
vim.keymap.set('n', '<leader>jj', builtin.buffers, {})
|
|
||||||
vim.keymap.set('n', '<leader>fh', builtin.help_tags, {})
|
|
||||||
137
lua/plugins.lua
137
lua/plugins.lua
|
|
@ -14,26 +14,34 @@ end
|
||||||
vim.opt.rtp:prepend(lazypath)
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
require("lazy").setup({
|
require("lazy").setup({
|
||||||
{
|
|
||||||
'nvim-telescope/telescope.nvim',
|
|
||||||
tag = '0.1.2',
|
|
||||||
dependencies = { 'nvim-lua/plenary.nvim' }
|
|
||||||
},
|
|
||||||
-- themes
|
|
||||||
{ 'gruvbox-community/gruvbox' },
|
{ 'gruvbox-community/gruvbox' },
|
||||||
-- gitsigns
|
|
||||||
{ 'lewis6991/gitsigns.nvim' },
|
{ 'lewis6991/gitsigns.nvim' },
|
||||||
-- tpope commentary
|
|
||||||
{ 'tpope/vim-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"
|
"nvim-treesitter/nvim-treesitter", build = ":TSUpdate"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
'VonHeikemen/lsp-zero.nvim',
|
|
||||||
branch = 'v2.x',
|
|
||||||
dependencies = {
|
|
||||||
-- LSP Support
|
|
||||||
{ 'neovim/nvim-lspconfig' }, -- Required
|
{ 'neovim/nvim-lspconfig' }, -- Required
|
||||||
{ -- Optional
|
{ -- Optional
|
||||||
'williamboman/mason.nvim',
|
'williamboman/mason.nvim',
|
||||||
|
|
@ -42,41 +50,25 @@ require("lazy").setup({
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{ 'williamboman/mason-lspconfig.nvim' }, -- Optional
|
{ 'williamboman/mason-lspconfig.nvim' }, -- Optional
|
||||||
-- formatter
|
|
||||||
{
|
{
|
||||||
'stevearc/conform.nvim',
|
'stevearc/conform.nvim',
|
||||||
opts = {
|
|
||||||
formatters_by_ft = {
|
|
||||||
htmlangular = { "prettier" },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
-- Autocompletion
|
-- Autocompletion
|
||||||
{ 'hrsh7th/nvim-cmp' }, -- Required
|
{ 'hrsh7th/nvim-cmp' }, -- Required
|
||||||
{ 'hrsh7th/cmp-nvim-lsp' }, -- Required
|
{ 'hrsh7th/cmp-nvim-lsp' }, -- Required
|
||||||
{ 'L3MON4D3/LuaSnip' }, -- Required
|
{ 'L3MON4D3/LuaSnip' }, -- Required
|
||||||
{ 'nvim-cmp' },
|
-- roslyn
|
||||||
-- { 'rcarriga/nvim-dap-ui', dependencies = { 'mfussenegger/nvim-dap' } },
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"seblyng/roslyn.nvim",
|
"seblyng/roslyn.nvim",
|
||||||
ft = "cs",
|
ft = "cs",
|
||||||
-- @module 'roslyn.config'
|
|
||||||
-- @type RoslynNvimConfig
|
|
||||||
opts = {
|
opts = {
|
||||||
-- your configuration comes here; leave empty for default settings
|
-- your configuration comes here; leave empty for default settings
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'stevearc/oil.nvim',
|
'stevearc/oil.nvim',
|
||||||
---@module 'oil'
|
|
||||||
---@type oil.SetupOpts
|
|
||||||
opts = {},
|
opts = {},
|
||||||
-- Optional dependencies
|
|
||||||
dependencies = { { "echasnovski/mini.icons", opts = {} } },
|
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,
|
lazy = false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -84,13 +76,6 @@ require("lazy").setup({
|
||||||
branch = "harpoon2",
|
branch = "harpoon2",
|
||||||
dependencies = { "nvim-lua/plenary.nvim" }
|
dependencies = { "nvim-lua/plenary.nvim" }
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"kdheepak/lazygit.nvim",
|
|
||||||
-- optional for floating window border decoration
|
|
||||||
dependencies = {
|
|
||||||
"nvim-lua/plenary.nvim",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"iamcco/markdown-preview.nvim",
|
"iamcco/markdown-preview.nvim",
|
||||||
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
|
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
|
||||||
|
|
@ -98,6 +83,82 @@ require("lazy").setup({
|
||||||
build = function() vim.fn["mkdp#util#install"]() end,
|
build = function() vim.fn["mkdp#util#install"]() end,
|
||||||
},
|
},
|
||||||
{ 'mhinz/vim-startify' },
|
{ '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)
|
}, opts)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,5 +22,6 @@ vim.keymap.set("n", "<S-H>", ":bp<CR>")
|
||||||
vim.keymap.set("n", "<leader>t<Space>2", ":set expandtab shiftwidth=2 softtabstop=2<CR>")
|
vim.keymap.set("n", "<leader>t<Space>2", ":set expandtab shiftwidth=2 softtabstop=2<CR>")
|
||||||
vim.keymap.set("n", "<leader>t<Space>4", ":set expandtab shiftwidth=4 softtabstop=4<CR>")
|
vim.keymap.set("n", "<leader>t<Space>4", ":set expandtab shiftwidth=4 softtabstop=4<CR>")
|
||||||
vim.keymap.set("n", "<leader>t<Space><Tab>", ":set noexpandtab shiftwidth=4 softtabstop=4<CR>")
|
vim.keymap.set("n", "<leader>t<Space><Tab>", ":set noexpandtab shiftwidth=4 softtabstop=4<CR>")
|
||||||
-- LazyGit
|
|
||||||
vim.keymap.set("n", "<leader>gg", ":LazyGit<CR>")
|
vim.keymap.set("n", "<leader>gt", ":wincmd s<cr> :wincmd T<cr>")
|
||||||
|
vim.keymap.set("n", "<leader>tc", ":tabc<cr>")
|
||||||
|
|
|
||||||
|
|
@ -11,11 +11,11 @@ vim.opt.smartindent = true
|
||||||
|
|
||||||
vim.opt.wrap = false
|
vim.opt.wrap = false
|
||||||
vim.opt.list = true
|
vim.opt.list = true
|
||||||
|
vim.opt.laststatus = 3
|
||||||
|
|
||||||
vim.opt.swapfile = false
|
vim.opt.swapfile = false
|
||||||
|
|
||||||
vim.opt.backup = false
|
vim.opt.backup = false
|
||||||
-- vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
|
|
||||||
vim.opt.undofile = true
|
vim.opt.undofile = true
|
||||||
|
|
||||||
vim.opt.hlsearch = true
|
vim.opt.hlsearch = true
|
||||||
|
|
@ -25,7 +25,7 @@ vim.opt.smartcase = true
|
||||||
|
|
||||||
vim.opt.termguicolors = true
|
vim.opt.termguicolors = true
|
||||||
|
|
||||||
vim.opt.scrolloff = 8
|
vim.opt.scrolloff = 10
|
||||||
vim.opt.signcolumn = "yes"
|
vim.opt.signcolumn = "yes"
|
||||||
|
|
||||||
vim.opt.updatetime = 50
|
vim.opt.updatetime = 50
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue