Compare commits

...

13 Commits

9 changed files with 38 additions and 34 deletions

View File

@@ -3,6 +3,9 @@ This repository contains my NeoVim configs, including some of my snippets.
It uses Lazy.nvim as the plugin manager, lspconfig for the language server configuration, none-ls for formatting, telescope, tree-sitter and many other plugins. Partially documented and fairly well organized It uses Lazy.nvim as the plugin manager, lspconfig for the language server configuration, none-ls for formatting, telescope, tree-sitter and many other plugins. Partially documented and fairly well organized
## Linter configs
You may find the linter configs and setup-scripts for some linters that require some extra setup [here](https://git.janishutz.com/janishutz/dotfiles/)
# Issues with jdtls # Issues with jdtls
Ensure you have jdk21-opnejdk or newer installed. On Arch (and derivatives) you can switch the preferred java version using `archlinux-java set <version name>` Ensure you have jdk21-opnejdk or newer installed. On Arch (and derivatives) you can switch the preferred java version using `archlinux-java set <version name>`

View File

@@ -43,16 +43,15 @@ vim.api.nvim_set_keymap("v", ">", ">gv", { noremap = true, silent = true })
keymap.set("n", "E", ":wq!<CR>", opts("write and quit file")) keymap.set("n", "E", ":wq!<CR>", opts("write and quit file"))
keymap.set("n", "<leader>E", ":lua require('utils').sudo_write()<CR>:q!<CR>", opts("sudo write and quit file")) keymap.set("n", "<leader>E", ":lua require('utils').sudo_write()<CR>:q!<CR>", opts("sudo write and quit file"))
-- Quite file -- Quit file
keymap.set("n", "Q", ":q!<CR>", opts("quit file")) keymap.set("n", "Q", ":q!<CR>", opts("quit file"))
-- Duplicate line -- Duplicate line
keymap.set("n", "<leader>dd", ":t.<CR>", opts("Duplicate line")) keymap.set("n", "<leader>dd", ":t.<CR>", opts("Duplicate line"))
-- Editor focus -- Editor focus
keymap.set("n", "<C-b>", ":wincmd p<CR>", opts("Cycle focus"))
-- Key Mappings for LaTeX workflow -- LaTeX mappings
keymap.set("n", "<leader>lc", ":VimtexCompile<CR>", opts("Compile latex document")) -- Compile LaTeX file keymap.set("n", "<leader>lc", ":VimtexCompile<CR>", opts("Compile latex document")) -- Compile LaTeX file
keymap.set("n", "<leader>lv", ":VimtexView<CR>", opts("View compiled latex pdf")) -- View compiled PDF keymap.set("n", "<leader>lv", ":VimtexView<CR>", opts("View compiled latex pdf")) -- View compiled PDF
keymap.set("n", "<leader>lq", ":VimtexStop<CR>", opts("Stop Compiling document")) -- Stop compilation keymap.set("n", "<leader>lq", ":VimtexStop<CR>", opts("Stop Compiling document")) -- Stop compilation
@@ -112,17 +111,6 @@ keymap.set("i", "<C-$>", "<End>", opts("Jump to EOL"))
keymap.set("i", "<C-0>", "<Home>", opts("Jump to beginning of line")) keymap.set("i", "<C-0>", "<Home>", opts("Jump to beginning of line"))
-- Spell checking -- Spell checking
function StopTextlsp()
local clients = vim.lsp.get_clients()
for client in clients do
if client.name == "textlsp" then
vim.lsp.stop_client(client.id)
end
end
end
keymap.set("n", "<leader>sr", ':lua vim.lsp.enable("textlsp")<CR>', opts("Start textlsp"))
keymap.set("n", "<leader>sq", StopTextlsp, opts("Stop textlsp"))
keymap.set("n", "<leader>ss", ":set spell<CR>", opts("Start built-in spell checker")) keymap.set("n", "<leader>ss", ":set spell<CR>", opts("Start built-in spell checker"))
keymap.set("n", "<leader>sn", ":set nospell<CR>", opts("Stop spell checker")) keymap.set("n", "<leader>sn", ":set nospell<CR>", opts("Stop spell checker"))
keymap.set("n", "<leader>slu", ":set spelllang=en_us<CR>", opts("Set spell checker lang to en_US")) keymap.set("n", "<leader>slu", ":set spelllang=en_us<CR>", opts("Set spell checker lang to en_US"))
@@ -139,7 +127,7 @@ keymap.set({ "n", "v" }, "C", '"_C', opts())
keymap.set({ "n", "v" }, "<leader>d", "d", opts("yank and delete")) keymap.set({ "n", "v" }, "<leader>d", "d", opts("yank and delete"))
keymap.set({ "n", "v" }, "<leader>D", "D", opts("YANK and DELETE to end")) keymap.set({ "n", "v" }, "<leader>D", "D", opts("YANK and DELETE to end"))
-- <leader> + yank/paste/delete uses system clipboard -- <leader> + yank/paste/delete with system clipboard
keymap.set({ "n", "v" }, "<leader>y", '"+y', opts("yank to system clipboard")) keymap.set({ "n", "v" }, "<leader>y", '"+y', opts("yank to system clipboard"))
keymap.set({ "n", "v" }, "<leader>Y", '"+y$', opts("YANK to system clipboard")) keymap.set({ "n", "v" }, "<leader>Y", '"+y$', opts("YANK to system clipboard"))
keymap.set({ "n", "v" }, "<leader>p", '"+p', opts("paste from system clipboard")) keymap.set({ "n", "v" }, "<leader>p", '"+p', opts("paste from system clipboard"))

View File

@@ -53,6 +53,13 @@ M.on_attach = function(client, bufnr)
vim.opt.signcolumn = "yes" -- reserve space for diagnostics vim.opt.signcolumn = "yes" -- reserve space for diagnostics
end end
M.on_attach_no_formatting = function(client, bufnr)
M.on_attach(client, bufnr)
client.server_capabilities.documentFormattingProvider = false
client.server_capabilities.documentRangeFormattingProvider = false
end
-- used to enable autocompletion (assign to every lsp server config) -- used to enable autocompletion (assign to every lsp server config)
-- local capabilities = cmp_nvim_lsp.default_capabilities() -- local capabilities = cmp_nvim_lsp.default_capabilities()
M.capabilities = vim.lsp.protocol.make_client_capabilities() M.capabilities = vim.lsp.protocol.make_client_capabilities()

View File

@@ -22,14 +22,6 @@ lsp.config("texlab", {
on_attach = on_attach, on_attach = on_attach,
}) })
-- ┌ ┐
-- │ Spell checking │
-- └ ┘
lsp.config("textlsp", {
capabilities = capabilities,
on_attach = on_attach,
})
-- ── Enable configs ─────────────────────────────────────────────── -- ── Enable configs ───────────────────────────────────────────────
local enable = vim.lsp.enable local enable = vim.lsp.enable
enable("marksman") enable("marksman")

View File

@@ -5,6 +5,7 @@ local lsp = vim.lsp
local capabilities = require("lsp-options").capabilities local capabilities = require("lsp-options").capabilities
local on_attach = require("lsp-options").on_attach local on_attach = require("lsp-options").on_attach
local on_attach_no_formatting = require("lsp-options").on_attach_no_formatting
-- ┌ ┐ -- ┌ ┐
-- │ HTML, CSS, JSON │ -- │ HTML, CSS, JSON │
@@ -29,7 +30,7 @@ lsp.config("jsonls", {
-- └ ┘ -- └ ┘
lsp.config("vue_ls", { lsp.config("vue_ls", {
capabilities = capabilities, capabilities = capabilities,
on_attach = on_attach, on_attach = on_attach_no_formatting,
filetypes = { filetypes = {
"vue", "vue",
}, },
@@ -40,7 +41,7 @@ lsp.config("vue_ls", {
-- └ ┘ -- └ ┘
lsp.config("ts_ls", { lsp.config("ts_ls", {
capabilities = capabilities, capabilities = capabilities,
on_attach = on_attach, on_attach = on_attach_no_formatting,
init_options = { init_options = {
plugins = { plugins = {
{ {
@@ -64,6 +65,6 @@ lsp.config("ts_ls", {
local enable = vim.lsp.enable local enable = vim.lsp.enable
enable("jsonls") enable("jsonls")
enable("html") enable("html")
enable("css") enable("cssls")
enable("vue_ls") enable("vue_ls")
enable("ts_ls") enable("ts_ls")

View File

@@ -25,23 +25,23 @@ return {
mason_lspconfig.setup({ mason_lspconfig.setup({
-- list of servers for mason to install -- list of servers for mason to install
ensure_installed = { ensure_installed = {
"asm-lsp", "asm_lsp",
"bashls", "bashls",
"clangd", "clangd",
"cmake", "cmake",
-- "cssls", -- "cssls",
"dartls",
"gopls", "gopls",
"hyprls", "hyprls",
"jdtls", "jdtls",
"latexindent",
"marksman", "marksman",
-- "lua_ls", -- "lua_ls",
-- "pyright", -- "pyright",
"rust_analyzer", "rust_analyzer",
"ruby_lsp", "ruby_lsp",
-- "ts_ls", -- "ts_ls",
"textlsp", "vue_ls",
"vue_ls" "verible",
}, },
-- auto-install configured servers (with lspconfig) -- auto-install configured servers (with lspconfig)
automatic_enable = false automatic_enable = false

View File

@@ -15,7 +15,8 @@ return {
i = { i = {
["<C-j>"] = actions.move_selection_next, ["<C-j>"] = actions.move_selection_next,
["<C-k>"] = actions.move_selection_previous, ["<C-k>"] = actions.move_selection_previous,
["<C-q>"] = actions.send_selected_to_qflist + actions.open_qflist, -- TODO investigate ["<C-q>"] = actions.smart_add_selected_to_qflist,
["<C-A-q>"] = actions.smart_send_selected_to_qflist,
}, },
}, },
}, },
@@ -64,5 +65,9 @@ return {
-- Implementations -- Implementations
opts.desc = "Show implementations" opts.desc = "Show implementations"
vim.keymap.set("n", "<leader>fi", ":Telescope lsp_implementations<CR>", opts) vim.keymap.set("n", "<leader>fi", ":Telescope lsp_implementations<CR>", opts)
-- quickfix
opts.desc = "Show quickfix list"
vim.keymap.set("n", "<leader>fq", ":Telescope quickfix<CR>", opts)
end, end,
} }

View File

@@ -5,7 +5,7 @@ return {
config = function() config = function()
require("nvim-autopairs").setup({ require("nvim-autopairs").setup({
fast_wrap = { fast_wrap = {
map = "<C-e>", map = "<leader>wa",
chars = { "{", "[", "(", '"', "'", "`" }, chars = { "{", "[", "(", '"', "'", "`" },
}, },
}) })

View File

@@ -1,6 +1,14 @@
{ {
"docTitle": { "docTitle": {
"prefix": "prepareDoc", "prefix": "prepareDoc",
"body": "$BLOCK_COMMENT_START\n*\t\t\t\t$WORKSPACE_NAME - $TM_FILENAME\n*\n*\tCreated by Janis Hutz $CURRENT_MONTH/$CURRENT_DATE/$CURRENT_YEAR, Licensed under ${1|the GPL V3,the MIT,a proprietary,the BSD,the LGPL V3,the Apache|} License\n*\t\t\thttps://janishutz.com, development@janishutz.com\n*\n*\n$BLOCK_COMMENT_END" "body": [
"$BLOCK_COMMENT_START",
" * $WORKSPACE_NAME - $TM_FILENAME",
" *",
" * Created by Janis Hutz $CURRENT_MONTH/$CURRENT_DATE/$CURRENT_YEAR, Licensed under ${1|the GPL V3,the MIT,a proprietary,the BSD,the LGPL V3,the Apache|} License",
" * https://janishutz.com, development@janishutz.com",
" *\n *",
"$BLOCK_COMMENT_END"
]
} }
} }