This commit is contained in:
Smaug123
2024-03-24 17:14:24 +00:00
parent ddbd6718b5
commit 742a708c0c
3 changed files with 31 additions and 13 deletions

View File

@@ -78,7 +78,7 @@ vim.api.nvim_create_autocmd("BufReadPost", {
-- Trim trailing whitespace on save
function CleanExtraSpaces()
local save_cursor = vim.api.nvim.win_get_cursor(0)
local save_cursor = vim.api.nvim_win_get_cursor(0)
local old_query = vim.fn.getreg("/")
vim.cmd("%s/\\s\\+$//e")
vim.api.nvim_win_set_cursor(0, save_cursor)

View File

@@ -183,7 +183,7 @@ end
-- if handle then
-- local stdout = handle:read("*all")
-- handle:close()
--
--
-- local allResults = {}
-- for match in string.gmatch(stdout, "([^%z]+)") do
-- table.insert(allResults, match)
@@ -199,7 +199,7 @@ end
-- return a < b -- If both or neither end with 'proj', sort alphabetically
-- end
-- end)
--
--
-- for _, line in ipairs(allResults) do
-- table.insert(results, line)
-- end
@@ -234,7 +234,7 @@ vim.api.nvim_create_user_command("BuildFSharpProject", function(opts)
})
:find()
end
end, { nargs = "?", complete = 'file' })
end, { nargs = "?", complete = "file" })
local function SetupFSharpKeyBindings()
local status, whichkey = pcall(require, "which-key")

View File

@@ -56,12 +56,31 @@ require("lspconfig").nil_ls.setup(coq.lsp_ensure_capabilities({
},
}))
-- 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)
function ToggleLocList()
local winid = vim.fn.getloclist(0, { winid = 0 }).winid
if winid == 0 then
vim.cmd.lopen()
else
vim.cmd.lclose()
end
end
local whichkey_status, whichkey = pcall(require, "which-key")
if whichkey_status then
whichkey.register({
l = {
p = { vim.diagnostic.goto_prev, "Go to previous entry in loclist" },
n = { vim.diagnostic.goto_next, "Go to next entry in loclist" },
l = { ToggleLocList, "Toggle loclist" },
f = { vim.diagnostic.open_float, "Open current loclist entry in floating window" },
},
}, { prefix = vim.api.nvim_get_var("maplocalleader") })
else
vim.keymap.set("n", "<localleader>lp", vim.diagnostic.goto_prev)
vim.keymap.set("n", "<localleader>ln", vim.diagnostic.goto_next)
vim.keymap.set("n", "<localleader>ll", ToggleLocList)
vim.keymap.set("n", "<localleader>lf", vim.diagnostic.open_float)
end
-- Use LspAttach autocommand to only map the following keys
-- after the language server attaches to the current buffer
@@ -74,8 +93,7 @@ vim.api.nvim_create_autocmd("LspAttach", {
-- Buffer local mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions
local opts = { buffer = ev.buf }
local status, whichkey = pcall(require, "which-key")
if status then
if whichkey_status then
whichkey.register({
g = {
D = { vim.lsp.buf.declaration, "Go to declaration" },
@@ -114,7 +132,7 @@ vim.api.nvim_create_autocmd("LspAttach", {
a = { vim.lsp.buf.code_action, "Select a code action" },
},
r = {
n = { vim.lsp.buf.rename, "Rename buffer" },
n = { vim.lsp.buf.rename, "Rename variable" },
},
D = { vim.lsp.buf.type_definition, "Go to type definition" },
}, { prefix = "<space>" })