wip: feat(nvim/rust-tools): begin migration

wip: feat(nvim/rust-tools): begin migration

feat(nvim/dev-icons): enable

feat(nvim/nerdtree): removed

feat(nvim): removed coc

feat(nvim/cmp): connect rust-tools

feat(nvim/dap): setup lldb

feat(nvim/cmp): icons

feat(nvim/dap): icons

feat(nvim/rust): load crates plugin

feat(nvim): switch rust-tools to rustaceanvim

feat(nvim): enable inlay hints

feat(nvim): cmdline completions

style: nix run sys#luaformatter -- home/nvim/*.lua -i

feat(nvim/nix): break once neovim hits 0.10.0

wip: feat(nvim/rust-tools): begin migration

feat(nvim): removed coc
This commit is contained in:
u2515h
2023-12-27 09:31:44 +01:00
parent cdb1cbd040
commit 8cd1e08ecf
5 changed files with 525 additions and 110 deletions

View File

@@ -1,3 +1,4 @@
local deps = require("nvim-deps")
vim.opt.termguicolors = true
vim.notify = require("notify")
vim.notify.setup({background_colour = "#000000"})
@@ -44,33 +45,9 @@ neogit.setup({
local dap, dapui = require("dap"), require("dapui")
dap.adapters.lldb = {
type = "executable",
command = lldb_path .. "/bin/lldb-vscode",
command = deps.lldb_path .. "/bin/lldb-vscode",
name = "lldb"
}
local lldb = {
name = "Launch lldb",
type = "lldb", -- matches the adapter
request = "launch", -- could also attach to a currently running process
program = function()
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/",
"file")
end,
cwd = "$${workspaceFolder}",
stopOnEntry = false,
args = {},
console = internalConsole,
runInTerminal = true
}
dap.configurations.rust = {
lldb -- different debuggers or more configurations can be used here
}
--[[ local opts = {
dap = {
adapter = require("rust-tools.dap").get_codelldb_adapter("${pkgs.lldb}/bin/lldb-vscode", "${pkgs.lldb.lib}/lib/liblldb.so"),
},
}
require("rust-tools").setup { opts } ]]
local dap_breakpoint = {
error = {
text = "🟥",
@@ -79,19 +56,22 @@ local dap_breakpoint = {
numhl = ""
},
rejected = {
text = "",
text = "",
texthl = "LspDiagnosticsSignHint",
linehl = "",
numhl = ""
},
stopped = {
text = "⭐️",
text = "🛑",
texthl = "LspDiagnosticsSignInformation",
linehl = "DiagnosticUnderlineInfo",
numhl = "LspDiagnosticsSignInformation"
}
}
vim.keymap.set('n', '<leader>dk', function() dap.continue() end)
vim.keymap.set('n', '<leader>dl', function() dap.run_last() end)
vim.keymap.set('n', '<leader>b', function() dap.toggle_breakpoint() end)
vim.fn.sign_define("DapBreakpoint", dap_breakpoint.error)
vim.fn.sign_define("DapStopped", dap_breakpoint.stopped)
vim.fn.sign_define("DapBreakpointRejected", dap_breakpoint.rejected)
@@ -104,3 +84,46 @@ dap.listeners.after.event_initialized["dapui_config"] =
dap.listeners.before.event_terminated["dapui_config"] =
function() dapui.close() end
dap.listeners.before.event_exited["dapui_config"] = function() dapui.close() end
-- Setup language servers.
local lspconfig = require('lspconfig')
-- Global mappings.
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
vim.keymap.set('n', '<leader>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', '<leader>q', vim.diagnostic.setloclist)
-- Use LspAttach autocommand to only map the following keys
-- after the language server attaches to the current buffer
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
callback = function(ev)
-- Enable completion triggered by <c-x><c-o>
vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
-- Buffer local mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions
local opts = {buffer = ev.buf}
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', '<leader>wa', vim.lsp.buf.add_workspace_folder, opts)
vim.keymap.set('n', '<leader>wr', vim.lsp.buf.remove_workspace_folder,
opts)
vim.keymap.set('n', '<leader>wl', function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, opts)
vim.keymap.set('n', '<leader>D', vim.lsp.buf.type_definition, opts)
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, opts)
vim.keymap.set({'n', 'v'}, '<leader>ca', vim.lsp.buf.code_action, opts)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
vim.keymap.set('n', '<leader>f',
function() vim.lsp.buf.format {async = true} end, opts)
end
})
require("lsp-inlayhints").setup()
require("completion")