fix: rm unused files

This commit is contained in:
2024-03-22 15:47:10 +08:00
parent e430d2a721
commit cabec5bd63
19 changed files with 51 additions and 368 deletions
+10 -6
View File
@@ -12,6 +12,9 @@ keymap.set('n', "<Leader>br", "<cmd>e!<cr>", {desc="reload" })
keymap.set('n', "<Leader>bd", "<cmd>BufferClose<cr>", {desc="close buffer" })
keymap.set({'n','v'}, "<Leader>b/", "<cmd>CommentToggle<CR>", {desc="toggle comment" })
-- <Leader>c
keymap.set('n', "<Leader>cs", "<cmd>SymbolsOutline<cr>", { desc = "Symbols Outline" })
-- <Leader>D
keymap.set('n', "<Leader>Dt", "<cmd>TroubleToggle<cr>", {desc="trouble" })
keymap.set('n', "<Leader>Dw", "<cmd>TroubleToggle lsp_workspace_diagnostics<cr>", {desc="workspace" })
@@ -64,23 +67,24 @@ keymap.set('n', '<Leader>h', ':set hlsearch!<CR>', { noremap = true, silent = tr
-- <Leader>l for lsp
keymap.set('n', '<Leader>l', "", {desc="+Language"})
keymap.set('n', '<Leader>la', "<cmd>Lspsaga code_action<cr>", {desc="Code Action" })
keymap.set('n', '<Leader>lA', "<cmd>Lspsaga range_code_action<cr>", {desc="Selected Action" })
keymap.set({'n','v'}, '<Leader>la', "<cmd>lua vim.lsp.buf.code_action()<cr>", {desc="Code Action" })
--keymap.set('n', '<Leader>lA', "<cmd>Lspsaga range_code_action<cr>", {desc="Selected Action" })
keymap.set('n', '<Leader>ld', "<cmd>Telescope lsp_document_diagnostics<cr>", {desc="Document Diagnostics" })
keymap.set('n', '<Leader>lD', "<cmd>Telescope lsp_workspace_diagnostics<cr>", {desc="Workspace Diagnostics" })
keymap.set('n', '<Leader>lf', "<cmd>LspFormatting<cr>", {desc="Format" })
keymap.set('n', '<Leader>lF', "<cmd>Lspsaga lsp_finder<cr>", {desc="LSP Finder" })
--keymap.set('n', '<Leader>lF', "<cmd>Lspsaga lsp_finder<cr>", {desc="LSP Finder" })
keymap.set('n', '<Leader>li', "<cmd>lua vim.lsp.buf.implementation()<cr>", {desc="implement" })
keymap.set('n', '<Leader>ll', "<cmd>lua vim.lsp.buf.hover()<cr>", {desc="hover" })
keymap.set('n', '<Leader>lL', "<cmd>Lspsaga show_line_diagnostics<cr>", {desc="Line Diagnostics" })
--keymap.set('n', '<Leader>lL', "<cmd>Lspsaga show_line_diagnostics<cr>", {desc="Line Diagnostics" })
keymap.set('n', '<Leader>lk', "<cmd>: LspRestart<cr>", {desc="restart lsp server" })
keymap.set('n', '<Leader>ln', "<cmd>lua vim.lsp.diagnostic.goto_next()<cr>", {desc="next diagnostic" })
keymap.set('n', '<Leader>lo', "<cmd>: SymbolsOutline<cr>", {desc="symbols outline" })
keymap.set('n', '<Leader>lp', "<cmd>lua vim.lsp.diagnostic.goto_prev()<cr>", {desc="prev diagnostic" })
keymap.set('n', '<Leader>lP', "<cmd>Lspsaga preview_definition<cr>", {desc="Preview Definition" })
--keymap.set('n', '<Leader>lP', "<cmd>Lspsaga preview_definition<cr>", {desc="Preview Definition" })
keymap.set('n', '<Leader>lq', "<cmd>Telescope quickfix<cr>", {desc="Quickfix" })
keymap.set('n', '<Leader>lr', "<cmd>lua vim.lsp.buf.references()<cr>", {desc="references" })
keymap.set('n', '<Leader>lR', "<cmd>Lspsaga rename<cr>", {desc="Rename" })
keymap.set('n', '<leader>lR', "<cmd>lua vim.lsp.buf.rename()<cr>", { desc = "Rename" })
--keymap.set('n', '<Leader>lR', "<cmd>Lspsaga rename<cr>", {desc="Rename" })
keymap.set('n', '<Leader>lt', "<cmd>LspTypeDefinition<cr>", {desc="Type Definition" })
keymap.set('n', '<Leader>lx', "<cmd>cclose<cr>", {desc="Close Quickfix" })
keymap.set('n', '<Leader>ls', "<cmd>Telescope lsp_document_symbols<cr>", {desc="Document Symbols" })
-6
View File
@@ -1,6 +0,0 @@
-- npm i -g bash-language-server
require'lspconfig'.bashls.setup {
cmd = {DATA_PATH .. "/lspinstall/bash/node_modules/.bin/bash-language-server", "start"},
on_attach = require'lsp'.common_on_attach,
filetypes = { "sh", "zsh" }
}
-8
View File
@@ -1,8 +0,0 @@
-- npm install -g vscode-css-languageserver-bin
require'lspconfig'.cssls.setup {
cmd = {
"node", DATA_PATH .. "/lspinstall/css/vscode-css/css-language-features/server/dist/node/cssServerMain.js",
"--stdio"
},
on_attach = require'lsp'.common_on_attach
}
-6
View File
@@ -1,6 +0,0 @@
-- npm install -g dockerfile-language-server-nodejs
require'lspconfig'.dockerls.setup {
cmd = {DATA_PATH .. "/lspinstall/dockerfile/node_modules/.bin/docker-langserver", "--stdio"},
on_attach = require'lsp'.common_on_attach,
root_dir = vim.loop.cwd
}
-19
View File
@@ -1,19 +0,0 @@
local nvim_lsp = require'lspconfig'
local configs = require'lspconfig/configs'
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
configs.emmet_ls = {
default_config = {
cmd = {'emmet-ls', '--stdio'};
filetypes = {'html', 'css'};
root_dir = function()
return vim.loop.cwd()
end;
settings = {};
};
}
nvim_lsp.emmet_ls.setup{
-- on_attach = on_attach;
}
-156
View File
@@ -1,156 +0,0 @@
-- LSP
require 'lspconfig'.gopls.setup {
-- cmd = {DATA_PATH .. "/lspinstall/go/gopls"},
cmd = { "gopls", "serve" }, -- use cmd in path, I can update it easily
settings = {
gopls = {
analyses = {
nilness = true,
unusedparams = true,
unusedwrite = true,
useany = true,
},
staticcheck = false
}
},
root_dir = require 'lspconfig'.util.root_pattern(".git", "go.mod", "go.work"),
init_options = { usePlaceholders = true, completeUnimported = true },
on_attach = require 'lsp'.common_on_attach
}
--[[
require'dap-install'.config("go_delve",{})
-- DAP
local dap = require "dap"
vim.fn.sign_define('DapBreakpoint', {text='🟥', texthl='', linehl='', numhl=''})
--vim.fn.sign_define('DapStopped', {text='⭐️', texthl='', linehl='', numhl=''})
local M = {}
local ts_utils = require 'nvim-treesitter.ts_utils'
function M.get_node()
local n = ts_utils.get_node_at_cursor()
put(ts_utils.get_node_text(n))
end
function M.get_node2()
local current_node = ts_utils.get_node_at_cursor()
if not current_node then
return ""
end
local expr = current_node
while expr do
if expr:type() == 'function_definition' then
put(expr:type())
break
end
expr = expr:parent()
end
if not expr then return "" end
put(ts_utils.get_node_text(expr))
return (ts_utils.get_node_text(expr:child(1)))[1]
end
return M
--[[
-- https://github.com/go-delve/delve/blob/master/Documentation/usage/dlv_dap.md
dap.configurations.go = {
{
type = "go",
name = "Debug",
request = "launch",
program = "${file}"
},
-- works with go.mod packages and sub packagesfunction M.get_current_function_name() local current_node = ts_utils.get_node_at_cursor() if not current_node then return "" end
local expr = current_node
while expr do
if expr:type() == 'function_definition' then
break
end
expr = expr:parent()
end
if not expr then return "" end
return (ts_utils.get_node_text(expr:child(1)))[1]
end
{
type = "go",
name = "Debug test (go.mod)",
request = "launch",
mode = "test",
program = "./${relativeFileDirname}"
}
}
--[[
local dap = require('dap')
dap.adapters.go = function(callback, config)
local stdout = vim.loop.new_pipe(false)
local handle
local pid_or_err
local port = 38697
local opts = {
stdio = {nil, stdout},
args = {"dap", "-l", "127.0.0.1:" .. port},
detached = true
}
handle, pid_or_err = vim.loop.spawn("dlv", opts, function(code)
stdout:close()
handle:close()
if code ~= 0 then
print('dlv exited with code', code)
end
end)
assert(handle, 'Error running dlv: ' .. tostring(pid_or_err))
stdout:read_start(function(err, chunk)
assert(not err, err)
if chunk then
vim.schedule(function()
require('dap.repl').append(chunk)
end)
end
end)
-- Wait for delve to start
vim.defer_fn(
function()
callback({type = "server", host = "127.0.0.1", port = port})
end,
100)
end
-- https://github.com/go-delve/delve/blob/master/Documentation/usage/dlv_dap.md
dap.configurations.go = {
{
type = "go",
name = "Debug",
request = "launch",
program = "${file}"
},
{
type = "go",
name = "Debug test", -- configuration for debugging test files
request = "launch",
mode = "test",
program = "${file}"
},
-- works with go.mod packages and sub packages
{
type = "go",
name = "Debug test (go.mod)",
request = "launch",
mode = "test",
program = "./${relativeFileDirname}"
}
}
]]
-9
View File
@@ -1,9 +0,0 @@
-- npm install -g vscode-html-languageserver-bin
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
require'lspconfig'.html.setup {
cmd = {"node", DATA_PATH .. "/lspinstall/html/vscode-html/html-language-features/server/dist/node/htmlServerMain.js", "--stdio"},
on_attach = require'lsp'.common_on_attach,
capabilities = capabilities
}
-28
View File
@@ -1,28 +0,0 @@
-- npm install -g typescript typescript-language-server
-- require'snippets'.use_suggested_mappings()
-- local capabilities = vim.lsp.protocol.make_client_capabilities()
-- capabilities.textDocument.completion.completionItem.snippetSupport = true;
-- local on_attach_common = function(client)
-- print("LSP Initialized")
-- require'completion'.on_attach(client)
-- require'illuminate'.on_attach(client)
-- end
require'lspconfig'.tsserver.setup {
cmd = {DATA_PATH .. "/lspinstall/typescript/node_modules/.bin/typescript-language-server", "--stdio"},
filetypes = { "javascript", "javascriptreact", "javascript.jsx", "typescript", "typescriptreact", "typescript.tsx" },
on_attach = require'lsp'.tsserver_on_attach,
-- This makes sure tsserver is not used for formatting (I prefer prettier)
-- on_attach = require'lsp'.common_on_attach,
root_dir = require('lspconfig/util').root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git"),
settings = {documentFormatting = false},
handlers = {
["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
virtual_text = O.tsserver.diagnostics.virtual_text,
signs = O.tsserver.diagnostics.signs,
underline = O.tsserver.diagnostics.underline,
update_in_insert = true
})
}
}
-16
View File
@@ -1,16 +0,0 @@
-- npm install -g vscode-json-languageserver
require'lspconfig'.jsonls.setup {
cmd = {
"node", DATA_PATH .. "/lspinstall/json/vscode-json/json-language-features/server/dist/node/jsonServerMain.js",
"--stdio"
},
on_attach = require'lsp'.common_on_attach,
commands = {
Format = {
function()
vim.lsp.buf.range_formatting({}, {0, 0}, {vim.fn.line("$"), 0})
end
}
}
}
-4
View File
@@ -1,4 +0,0 @@
require'lspconfig'.texlab.setup{
cmd = {DATA_PATH .. "/lspinstall/latex/texlab"},
on_attach = require'lsp'.common_on_attach
}
-28
View File
@@ -1,28 +0,0 @@
-- https://github.com/sumneko/lua-language-server/wiki/Build-and-Run-(Standalone)
local brew_path = "/usr/local/Cellar/lua-language-server/2.5.5/libexec"
local sumneko_root_path = brew_path
local sumneko_binary = brew_path .. "/bin/lua-language-server"
require'lspconfig'.sumneko_lua.setup {
cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"},
on_attach = require'lsp'.common_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',
-- Setup your lua path
path = vim.split(package.path, ';')
},
diagnostics = {
-- Get the language server to recognize the `vim` global
globals = {'vim'}
},
workspace = {
-- Make the server aware of Neovim runtime files
library = {[vim.fn.expand('$VIMRUNTIME/lua')] = true, [vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true},
maxPreload = 10000
}
}
}
}
-22
View File
@@ -1,22 +0,0 @@
-- npm i -g pyright
require'lspconfig'.pyright.setup {
cmd = {DATA_PATH .. "/lspinstall/python/node_modules/.bin/pyright-langserver", "--stdio"},
on_attach = require'lsp'.common_on_attach,
handlers = {
["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
virtual_text = O.python.diagnostics.virtual_text,
signs = O.python.diagnostics.signs,
underline = O.python.diagnostics.underline,
update_in_insert = true
})
},
settings = {
python = {
analysis = {
typeCheckingMode = O.python.analysis.type_checking,
autoSearchPaths = O.python.analysis.auto_search_paths,
useLibraryCodeForTypes = O.python.analysis.use_library_code_types
}
}
}
}
-5
View File
@@ -1,5 +0,0 @@
require'lspconfig'.rust_analyzer.setup{
cmd = {DATA_PATH .. "/lspinstall/rust/rust-analyzer"},
on_attach = require'lsp'.common_on_attach
}
-5
View File
@@ -1,5 +0,0 @@
-- npm install -g yaml-language-server
require'lspconfig'.yamlls.setup{
cmd = {DATA_PATH .. "/lspinstall/yaml/node_modules/.bin/yaml-language-server", "--stdio"},
on_attach = require'lsp'.common_on_attach,
}
+1 -1
View File
@@ -3,7 +3,7 @@ return {
"stevearc/conform.nvim",
opts = {
formatters_by_ft = {
go = { "gofmt"},
go = { "goimports"},
}
}
}
-12
View File
@@ -1,12 +0,0 @@
return {
{
'nvimdev/lspsaga.nvim',
config = function()
require('lspsaga').setup({})
end,
dependencies = {
'nvim-treesitter/nvim-treesitter',
'nvim-tree/nvim-web-devicons' -- optional
}
}
}