diff options
Diffstat (limited to 'dot_config/nvim/after')
| -rw-r--r-- | dot_config/nvim/after/ftplugin/gitcommit.lua | 3 | ||||
| -rw-r--r-- | dot_config/nvim/after/ftplugin/gitrebase.lua | 16 | ||||
| -rw-r--r-- | dot_config/nvim/after/ftplugin/mail.lua | 1 | ||||
| -rw-r--r-- | dot_config/nvim/after/ftplugin/markdown.lua | 1 | ||||
| -rw-r--r-- | dot_config/nvim/after/ftplugin/text.lua | 3 | ||||
| -rw-r--r-- | dot_config/nvim/after/lsp/clangd.lua | 57 | ||||
| -rw-r--r-- | dot_config/nvim/after/lsp/fortls.lua | 10 | ||||
| -rw-r--r-- | dot_config/nvim/after/lsp/lua_ls.lua | 9 |
8 files changed, 100 insertions, 0 deletions
diff --git a/dot_config/nvim/after/ftplugin/gitcommit.lua b/dot_config/nvim/after/ftplugin/gitcommit.lua new file mode 100644 index 0000000..e670035 --- /dev/null +++ b/dot_config/nvim/after/ftplugin/gitcommit.lua @@ -0,0 +1,3 @@ +vim.wo.spell = true +vim.b.undo_ftplugin = (vim.b.undo_ftplugin or "") .. "|setlocal spell<" +vim.cmd([[match ErrorMsg /\%1l.\%>50v/]]) diff --git a/dot_config/nvim/after/ftplugin/gitrebase.lua b/dot_config/nvim/after/ftplugin/gitrebase.lua new file mode 100644 index 0000000..1bfcd69 --- /dev/null +++ b/dot_config/nvim/after/ftplugin/gitrebase.lua @@ -0,0 +1,16 @@ +local function nvmap(l, r, desc) + vim.keymap.set( + { "n", "v" }, + l, + ":" .. r .. "<CR>", + { buffer = 0, desc = "[G]it rebase " .. desc } + ) +end + +nvmap("gc", "Cycle", "[C]ycle") +nvmap("gp", "Pick", "[P]ick") +nvmap("ge", "Edit", "[E]dit") +nvmap("gf", "Fixup", "[F]ixup") +nvmap("gd", "Drop", "[D]rop") +nvmap("gs", "Squash", "[S]quash") +nvmap("gr", "Reword", "[R]eword") diff --git a/dot_config/nvim/after/ftplugin/mail.lua b/dot_config/nvim/after/ftplugin/mail.lua new file mode 100644 index 0000000..9fe1500 --- /dev/null +++ b/dot_config/nvim/after/ftplugin/mail.lua @@ -0,0 +1 @@ +vim.wo.spell = true diff --git a/dot_config/nvim/after/ftplugin/markdown.lua b/dot_config/nvim/after/ftplugin/markdown.lua new file mode 100644 index 0000000..9fe1500 --- /dev/null +++ b/dot_config/nvim/after/ftplugin/markdown.lua @@ -0,0 +1 @@ +vim.wo.spell = true diff --git a/dot_config/nvim/after/ftplugin/text.lua b/dot_config/nvim/after/ftplugin/text.lua new file mode 100644 index 0000000..2179c42 --- /dev/null +++ b/dot_config/nvim/after/ftplugin/text.lua @@ -0,0 +1,3 @@ +vim.wo.spell = true +vim.bo.formatoptions = vim.bo.formatoptions .. "t" +vim.bo.commentstring = "# %s" diff --git a/dot_config/nvim/after/lsp/clangd.lua b/dot_config/nvim/after/lsp/clangd.lua new file mode 100644 index 0000000..e9868ae --- /dev/null +++ b/dot_config/nvim/after/lsp/clangd.lua @@ -0,0 +1,57 @@ +local function validate_bufnr(bufnr) + vim.validate("bufnr", bufnr, "number") + return bufnr == 0 and vim.api.nvim_get_current_buf() or bufnr +end + +local function switch_source_header_splitcmd(bufnr, splitcmd) + local method_name = "textDocument/switchSourceHeader" + bufnr = validate_bufnr(bufnr) + local client = vim.lsp.get_clients({ bufnr = bufnr, name = "clangd" })[1] + if not client then + return vim.notify( + ("method %s is not supported by any servers active on the current buffer"):format( + method_name + ) + ) + end + local params = vim.lsp.util.make_text_document_params(bufnr) + client.request(method_name, params, function(err, result) + if err then + error(tostring(err)) + end + if not result then + vim.notify("corresponding file cannot be determined") + return + end + vim.api.nvim_cmd({ + cmd = splitcmd, + args = { vim.uri_to_fname(result) }, + }, {}) + end, bufnr) +end + +return { + capabilities = { + offsetEncoding = { "utf-16" }, + }, + on_attach = function(_, bufnr) + local function nmap(l, r, desc) + vim.keymap.set("n", l, r, { buffer = bufnr, desc = desc }) + end + nmap("gH", function() + switch_source_header_splitcmd(bufnr, "edit") + end, "[G]o to [H]eader") + nmap("gvH", function() + switch_source_header_splitcmd(bufnr, "vsplit") + end, "[G]o in a [V]ertical split to [H]eader") + nmap("gxH", function() + switch_source_header_splitcmd(bufnr, "split") + end, "[G]o in a [X]horizontal split to [H]eader") + nmap("gtH", function() + switch_source_header_splitcmd(bufnr, "tabedit") + end, "[G]o in a [T]ab to [H]eader") + end, + init_options = { + clangdFileStatus = true, + }, +} diff --git a/dot_config/nvim/after/lsp/fortls.lua b/dot_config/nvim/after/lsp/fortls.lua new file mode 100644 index 0000000..8899dd2 --- /dev/null +++ b/dot_config/nvim/after/lsp/fortls.lua @@ -0,0 +1,10 @@ +return { + cmd = { + "fortls", + "--notify_init", + "--hover_signature", + "--hover_language=fortran", + "--use_signature_help", + "--autocomplete_no_snippets", + }, +} diff --git a/dot_config/nvim/after/lsp/lua_ls.lua b/dot_config/nvim/after/lsp/lua_ls.lua new file mode 100644 index 0000000..af0e681 --- /dev/null +++ b/dot_config/nvim/after/lsp/lua_ls.lua @@ -0,0 +1,9 @@ +return { + settings = { + Lua = { + diagnostics = { + disable = { "missing-fields" }, + }, + }, + }, +} |
