Compare commits
No commits in common. "c144250c7563089cc8d6831e96fb364a001cc512" and "c49aaeb82aae616c1e70e322b2969099c92e99df" have entirely different histories.
c144250c75
...
c49aaeb82a
21 changed files with 420 additions and 421 deletions
97
lua/lsp.lua
97
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', '<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)
|
||||
|
||||
for _, f in ipairs(config_files) do
|
||||
local name = vim.fn.fnamemodify(f, ":t:r")
|
||||
custom_servers[name] = true
|
||||
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
|
||||
|
||||
return custom_servers
|
||||
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)
|
||||
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
|
||||
['<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(),
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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", "<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,
|
||||
}
|
||||
12
lua/lspconf/angular.lua
Normal file
12
lua/lspconf/angular.lua
Normal file
|
|
@ -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
|
||||
})
|
||||
|
|
@ -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)
|
||||
|
||||
92
lua/lspconf/csharp.lua
Normal file
92
lua/lspconf/csharp.lua
Normal file
|
|
@ -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 = {},
|
||||
}
|
||||
}
|
||||
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
29
lua/lspconf/lua.lua
Normal file
29
lua/lspconf/lua.lua
Normal file
|
|
@ -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,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -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,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
33
lua/lspconf/php.lua
Normal file
33
lua/lspconf/php.lua
Normal file
|
|
@ -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 }
|
||||
|
|
@ -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,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
|
@ -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({
|
||||
["<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" },
|
||||
}),
|
||||
})
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
require("codecompanion").setup({
|
||||
strategies = {
|
||||
chat = {
|
||||
adapter = {
|
||||
name = "copilot",
|
||||
model = "claude-sonnet-4",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
|
@ -4,7 +4,7 @@ formatter.setup({
|
|||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
-- Use a sub-list to run only the first available formatter
|
||||
javascript = { "prettierd", "prettier" },
|
||||
typescript = { "prettier" },
|
||||
javascript = { { "prettierd", "prettier" } },
|
||||
typescript = { { "prettier" } },
|
||||
},
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,6 +0,0 @@
|
|||
require("mason").setup({
|
||||
registries = {
|
||||
"github:mason-org/mason-registry",
|
||||
"github:Crashdummyy/mason-registry",
|
||||
},
|
||||
})
|
||||
12
lua/plugin/neo-tree.lua
Normal file
12
lua/plugin/neo-tree.lua
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
local neotree = require("neo-tree")
|
||||
|
||||
neotree.setup({
|
||||
buffers = {
|
||||
follow_current_file = {
|
||||
enabled = true,
|
||||
},
|
||||
},
|
||||
window = {
|
||||
position = "right",
|
||||
},
|
||||
})
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
require("oil").setup {
|
||||
view_options = {
|
||||
-- Show files and directories that start with "."
|
||||
show_hidden = true,
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
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, {})
|
||||
69
lua/plugin/telescope.lua
Normal file
69
lua/plugin/telescope.lua
Normal file
|
|
@ -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', '<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, {})
|
||||
134
lua/plugins.lua
134
lua/plugins.lua
|
|
@ -14,113 +14,83 @@ 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 },
|
||||
'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"
|
||||
},
|
||||
{
|
||||
"MeanderingProgrammer/render-markdown.nvim",
|
||||
ft = { "markdown", "codecompanion" },
|
||||
},
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
},
|
||||
{ "neovim/nvim-lspconfig" }, -- Required
|
||||
'VonHeikemen/lsp-zero.nvim',
|
||||
branch = 'v2.x',
|
||||
dependencies = {
|
||||
-- LSP Support
|
||||
{ 'neovim/nvim-lspconfig' }, -- Required
|
||||
{ -- Optional
|
||||
"williamboman/mason.nvim",
|
||||
'williamboman/mason.nvim',
|
||||
build = function()
|
||||
pcall(vim.cmd, "MasonUpdate")
|
||||
pcall(vim.cmd, 'MasonUpdate')
|
||||
end,
|
||||
},
|
||||
{ "williamboman/mason-lspconfig.nvim" }, -- Optional
|
||||
{ 'williamboman/mason-lspconfig.nvim' }, -- Optional
|
||||
-- formatter
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
'stevearc/conform.nvim',
|
||||
opts = {},
|
||||
},
|
||||
-- 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
|
||||
},
|
||||
{ 'hrsh7th/nvim-cmp' }, -- Required
|
||||
{ 'hrsh7th/cmp-nvim-lsp' }, -- Required
|
||||
{ 'L3MON4D3/LuaSnip' }, -- Required
|
||||
{ 'nvim-cmp' },
|
||||
-- { 'rcarriga/nvim-dap-ui', dependencies = { 'mfussenegger/nvim-dap' } },
|
||||
}
|
||||
},
|
||||
{
|
||||
"stevearc/oil.nvim",
|
||||
opts = {},
|
||||
dependencies = { { "echasnovski/mini.icons", opts = {} } },
|
||||
lazy = false,
|
||||
"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" },
|
||||
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,
|
||||
},
|
||||
{ "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",
|
||||
},
|
||||
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
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
vim.keymap.set("n", "<leader>kk", "<CMD>Oil<CR>", { desc = "Open parent directory" })
|
||||
vim.keymap.set("n", "<leader>;;", ":Neotree toggle<CR>")
|
||||
vim.keymap.set("n", "<leader>kk", ":Neotree reveal<CR>")
|
||||
|
||||
-- jk to escape
|
||||
vim.keymap.set("i", "jk", "<Esc>")
|
||||
|
|
@ -22,14 +23,5 @@ 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>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>gt", ":wincmd s<CR> :wincmd T<CR>")
|
||||
vim.keymap.set("n", "<leader>tc", ":tabc<CR>")
|
||||
|
||||
-- copy current file path
|
||||
vim.keymap.set("n", "<leader>cp", ":let @+ = expand('%')<CR>")
|
||||
|
||||
-- code companion
|
||||
vim.keymap.set({"n", "v"}, "<leader>cc", ":CodeCompanionChat Toggle<CR>")
|
||||
vim.keymap.set("v", "<leader>acc", "<cmd>CodeCompanionChat Add<cr>")
|
||||
|
||||
-- LazyGit
|
||||
vim.keymap.set("n", "<leader>gg", ":LazyGit<CR>")
|
||||
|
|
|
|||
17
lua/set.lua
17
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,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue