diff options
Diffstat (limited to '.config/nvim')
| -rw-r--r-- | .config/nvim/after/ftplugin/c.vim | 6 | ||||
| -rw-r--r-- | .config/nvim/after/plugin/autocmds.lua | 158 | ||||
| -rw-r--r-- | .config/nvim/after/plugin/autocmds.vim | 5 | ||||
| -rw-r--r-- | .config/nvim/lua/core/options.lua | 2 | ||||
| -rw-r--r-- | .config/nvim/lua/helpers/autocmds.lua | 127 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/conform.lua | 24 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/git.lua | 6 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/lastplace.lua | 11 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/lsp.lua | 158 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/telescope.lua | 10 | ||||
| -rw-r--r-- | .config/nvim/spell/en.utf-8.add | 3 |
11 files changed, 292 insertions, 218 deletions
diff --git a/.config/nvim/after/ftplugin/c.vim b/.config/nvim/after/ftplugin/c.vim index 25eeecd..41a9917 100644 --- a/.config/nvim/after/ftplugin/c.vim +++ b/.config/nvim/after/ftplugin/c.vim | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | setlocal tabstop=8 | 1 | setlocal tabstop=2 |
| 2 | setlocal softtabstop=8 | 2 | setlocal softtabstop=2 |
| 3 | setlocal shiftwidth=8 | 3 | setlocal shiftwidth=2 |
| 4 | setlocal noexpandtab | 4 | setlocal noexpandtab |
diff --git a/.config/nvim/after/plugin/autocmds.lua b/.config/nvim/after/plugin/autocmds.lua deleted file mode 100644 index 3751cd4..0000000 --- a/.config/nvim/after/plugin/autocmds.lua +++ /dev/null | |||
| @@ -1,158 +0,0 @@ | |||
| 1 | local function augroup(name) | ||
| 2 | return vim.api.nvim_create_augroup("lazyvim_" .. name, { clear = true }) | ||
| 3 | end | ||
| 4 | |||
| 5 | -- Set typst filetype | ||
| 6 | vim.api.nvim_create_autocmd( | ||
| 7 | { | ||
| 8 | "BufNewFile", | ||
| 9 | "BufRead", | ||
| 10 | }, | ||
| 11 | { | ||
| 12 | pattern = "*.typ", | ||
| 13 | callback = function() | ||
| 14 | local buf = vim.api.nvim_get_current_buf() | ||
| 15 | vim.api.nvim_set_option_value("filetype", "typst", { buf = buf }) | ||
| 16 | vim.api.nvim_set_option_value("shiftwidth", 2, { buf = buf }) | ||
| 17 | end | ||
| 18 | } | ||
| 19 | ) | ||
| 20 | |||
| 21 | -- Set PKGBUILD filetype | ||
| 22 | vim.api.nvim_create_autocmd( | ||
| 23 | { | ||
| 24 | "BufNewFile", | ||
| 25 | "BufRead", | ||
| 26 | }, | ||
| 27 | { | ||
| 28 | pattern = "PKGBUILD", | ||
| 29 | callback = function() | ||
| 30 | local buf = vim.api.nvim_get_current_buf() | ||
| 31 | vim.api.nvim_set_option_value("filetype", "PKGBUILD", { buf = buf }) | ||
| 32 | end | ||
| 33 | } | ||
| 34 | ) | ||
| 35 | |||
| 36 | -- Set vimwiki filetype | ||
| 37 | vim.api.nvim_create_autocmd( | ||
| 38 | { | ||
| 39 | "BufNewFile", | ||
| 40 | "BufRead", | ||
| 41 | }, | ||
| 42 | { | ||
| 43 | pattern = "PKGBUILD", | ||
| 44 | callback = function() | ||
| 45 | local buf = vim.api.nvim_get_current_buf() | ||
| 46 | vim.api.nvim_set_option_value("filetype", "*.wiki", { buf = buf }) | ||
| 47 | end | ||
| 48 | } | ||
| 49 | ) | ||
| 50 | |||
| 51 | -- Set buku-edit filetype | ||
| 52 | vim.api.nvim_create_autocmd( | ||
| 53 | { | ||
| 54 | "BufNewFile", | ||
| 55 | "BufRead", | ||
| 56 | }, | ||
| 57 | { | ||
| 58 | pattern = "buku-edit-*", | ||
| 59 | callback = function() | ||
| 60 | local buf = vim.api.nvim_get_current_buf() | ||
| 61 | vim.api.nvim_set_option_value("filetype", "buku", { buf = buf }) | ||
| 62 | end | ||
| 63 | } | ||
| 64 | ) | ||
| 65 | |||
| 66 | -- Set mail filetype | ||
| 67 | vim.api.nvim_create_autocmd( | ||
| 68 | { | ||
| 69 | "BufNewFile", | ||
| 70 | "BufRead", | ||
| 71 | }, | ||
| 72 | { | ||
| 73 | pattern = "/tmp/neomutt*", | ||
| 74 | callback = function() | ||
| 75 | local buf = vim.api.nvim_get_current_buf() | ||
| 76 | vim.api.nvim_set_option_value("autoindent", false, { buf = buf }) | ||
| 77 | vim.api.nvim_set_option_value("filetype", "mail", { buf = buf }) | ||
| 78 | vim.api.nvim_set_option_value("wrapmargin", 0, { buf = buf }) | ||
| 79 | vim.api.nvim_set_option_value("textwidth", 80, { buf = buf }) | ||
| 80 | end | ||
| 81 | } | ||
| 82 | ) | ||
| 83 | |||
| 84 | -- Resize splits if window got resized | ||
| 85 | vim.api.nvim_create_autocmd({ "VimResized" }, { | ||
| 86 | group = augroup("resize_splits"), | ||
| 87 | callback = function() | ||
| 88 | local current_tab = vim.fn.tabpagenr() | ||
| 89 | vim.cmd("tabdo wincmd =") | ||
| 90 | vim.cmd("tabnext " .. current_tab) | ||
| 91 | end, | ||
| 92 | }) | ||
| 93 | |||
| 94 | -- go to last loc when opening a buffer | ||
| 95 | vim.api.nvim_create_autocmd("BufReadPost", { | ||
| 96 | group = augroup("last_loc"), | ||
| 97 | callback = function(event) | ||
| 98 | local exclude = { "gitcommit" } | ||
| 99 | local buf = event.buf | ||
| 100 | if vim.tbl_contains(exclude, vim.bo[buf].filetype) or vim.b[buf].lazyvim_last_loc then | ||
| 101 | return | ||
| 102 | end | ||
| 103 | vim.b[buf].lazyvim_last_loc = true | ||
| 104 | local mark = vim.api.nvim_buf_get_mark(buf, '"') | ||
| 105 | local lcount = vim.api.nvim_buf_line_count(buf) | ||
| 106 | if mark[1] > 0 and mark[1] <= lcount then | ||
| 107 | pcall(vim.api.nvim_win_set_cursor, 0, mark) | ||
| 108 | end | ||
| 109 | end, | ||
| 110 | }) | ||
| 111 | |||
| 112 | -- close some filetypes with <q> | ||
| 113 | vim.api.nvim_create_autocmd("FileType", { | ||
| 114 | group = augroup("close_with_q"), | ||
| 115 | pattern = { | ||
| 116 | "PlenaryTestPopup", | ||
| 117 | "checkhealth", | ||
| 118 | "dbout", | ||
| 119 | "gitsigns-blame", | ||
| 120 | "grug-far", | ||
| 121 | "help", | ||
| 122 | "lspinfo", | ||
| 123 | "neotest-output", | ||
| 124 | "neotest-output-panel", | ||
| 125 | "neotest-summary", | ||
| 126 | "notify", | ||
| 127 | "qf", | ||
| 128 | "snacks_win", | ||
| 129 | "spectre_panel", | ||
| 130 | "startuptime", | ||
| 131 | "tsplayground", | ||
| 132 | }, | ||
| 133 | callback = function(event) | ||
| 134 | vim.bo[event.buf].buflisted = false | ||
| 135 | vim.schedule(function() | ||
| 136 | vim.keymap.set("n", "q", function() | ||
| 137 | vim.cmd("close") | ||
| 138 | pcall(vim.api.nvim_buf_delete, event.buf, { force = true }) | ||
| 139 | end, { | ||
| 140 | buffer = event.buf, | ||
| 141 | silent = true, | ||
| 142 | desc = "Quit buffer", | ||
| 143 | }) | ||
| 144 | end) | ||
| 145 | end, | ||
| 146 | }) | ||
| 147 | |||
| 148 | -- Auto create dir when saving a file, in case some intermediate directory does not exist | ||
| 149 | vim.api.nvim_create_autocmd({ "BufWritePre" }, { | ||
| 150 | group = augroup("auto_create_dir"), | ||
| 151 | callback = function(event) | ||
| 152 | if event.match:match("^%w%w+:[\\/][\\/]") then | ||
| 153 | return | ||
| 154 | end | ||
| 155 | local file = vim.uv.fs_realpath(event.match) or event.match | ||
| 156 | vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p") | ||
| 157 | end, | ||
| 158 | }) | ||
diff --git a/.config/nvim/after/plugin/autocmds.vim b/.config/nvim/after/plugin/autocmds.vim index ae55046..21c7bc4 100644 --- a/.config/nvim/after/plugin/autocmds.vim +++ b/.config/nvim/after/plugin/autocmds.vim | |||
| @@ -1,2 +1,7 @@ | |||
| 1 | " I don't know how to port this yet | 1 | " I don't know how to port this yet |
| 2 | autocmd BufRead,BufWrite * if ! &bin | silent! %s/\s\+$//ge | endif | 2 | autocmd BufRead,BufWrite * if ! &bin | silent! %s/\s\+$//ge | endif |
| 3 | |||
| 4 | augroup vimwiki | ||
| 5 | autocmd! | ||
| 6 | autocmd BufRead,BufNewFile *.wiki set filetype=vimwiki | ||
| 7 | augroup END | ||
diff --git a/.config/nvim/lua/core/options.lua b/.config/nvim/lua/core/options.lua index 1a45b8f..9962f4f 100644 --- a/.config/nvim/lua/core/options.lua +++ b/.config/nvim/lua/core/options.lua | |||
| @@ -63,6 +63,8 @@ local opts = { | |||
| 63 | -- switch case labels | 63 | -- switch case labels |
| 64 | cinoptions = "l1", | 64 | cinoptions = "l1", |
| 65 | 65 | ||
| 66 | signcolumn = "yes:1", | ||
| 67 | |||
| 66 | } | 68 | } |
| 67 | 69 | ||
| 68 | for opt, val in pairs(opts) do | 70 | for opt, val in pairs(opts) do |
diff --git a/.config/nvim/lua/helpers/autocmds.lua b/.config/nvim/lua/helpers/autocmds.lua index 11f4480..7461090 100644 --- a/.config/nvim/lua/helpers/autocmds.lua +++ b/.config/nvim/lua/helpers/autocmds.lua | |||
| @@ -29,3 +29,130 @@ vim.api.nvim_create_autocmd("VimResized", { | |||
| 29 | }, | 29 | }, |
| 30 | command = "wincmd =", | 30 | command = "wincmd =", |
| 31 | }) | 31 | }) |
| 32 | |||
| 33 | -- https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua | ||
| 34 | -- Set typst filetype | ||
| 35 | vim.api.nvim_create_autocmd( | ||
| 36 | { | ||
| 37 | "BufNewFile", | ||
| 38 | "BufRead", | ||
| 39 | }, | ||
| 40 | { | ||
| 41 | group = augroup("typst"), | ||
| 42 | pattern = "*.typ", | ||
| 43 | callback = function() | ||
| 44 | local buf = vim.api.nvim_get_current_buf() | ||
| 45 | vim.api.nvim_set_option_value("filetype", "typst", { buf = buf }) | ||
| 46 | vim.api.nvim_set_option_value("shiftwidth", 2, { buf = buf }) | ||
| 47 | end | ||
| 48 | } | ||
| 49 | ) | ||
| 50 | |||
| 51 | -- Set PKGBUILD filetype | ||
| 52 | vim.api.nvim_create_autocmd( | ||
| 53 | { | ||
| 54 | "BufNewFile", | ||
| 55 | "BufRead", | ||
| 56 | }, | ||
| 57 | { | ||
| 58 | group = augroup("pkgbuild"), | ||
| 59 | pattern = "PKGBUILD", | ||
| 60 | callback = function() | ||
| 61 | local buf = vim.api.nvim_get_current_buf() | ||
| 62 | vim.api.nvim_set_option_value("filetype", "PKGBUILD", { buf = buf }) | ||
| 63 | end | ||
| 64 | } | ||
| 65 | ) | ||
| 66 | |||
| 67 | -- Set buku-edit filetype | ||
| 68 | vim.api.nvim_create_autocmd( | ||
| 69 | { | ||
| 70 | "BufNewFile", | ||
| 71 | "BufRead", | ||
| 72 | }, | ||
| 73 | { | ||
| 74 | group = augroup("buku-edit"), | ||
| 75 | pattern = "buku-edit-*", | ||
| 76 | callback = function() | ||
| 77 | local buf = vim.api.nvim_get_current_buf() | ||
| 78 | vim.api.nvim_set_option_value("filetype", "buku", { buf = buf }) | ||
| 79 | end | ||
| 80 | } | ||
| 81 | ) | ||
| 82 | |||
| 83 | -- Set mail filetype | ||
| 84 | vim.api.nvim_create_autocmd( | ||
| 85 | { | ||
| 86 | "BufNewFile", | ||
| 87 | "BufRead", | ||
| 88 | }, | ||
| 89 | { | ||
| 90 | group = augroup("mail"), | ||
| 91 | pattern = "/tmp/neomutt*", | ||
| 92 | callback = function() | ||
| 93 | local buf = vim.api.nvim_get_current_buf() | ||
| 94 | vim.api.nvim_set_option_value("autoindent", false, { buf = buf }) | ||
| 95 | vim.api.nvim_set_option_value("filetype", "mail", { buf = buf }) | ||
| 96 | vim.api.nvim_set_option_value("wrapmargin", 0, { buf = buf }) | ||
| 97 | vim.api.nvim_set_option_value("textwidth", 80, { buf = buf }) | ||
| 98 | end | ||
| 99 | } | ||
| 100 | ) | ||
| 101 | |||
| 102 | -- Resize splits if window got resized | ||
| 103 | vim.api.nvim_create_autocmd({ "VimResized" }, { | ||
| 104 | group = augroup("resize_splits"), | ||
| 105 | callback = function() | ||
| 106 | local current_tab = vim.fn.tabpagenr() | ||
| 107 | vim.cmd("tabdo wincmd =") | ||
| 108 | vim.cmd("tabnext " .. current_tab) | ||
| 109 | end, | ||
| 110 | }) | ||
| 111 | |||
| 112 | -- close some filetypes with <q> | ||
| 113 | vim.api.nvim_create_autocmd("FileType", { | ||
| 114 | group = augroup("close_with_q"), | ||
| 115 | pattern = { | ||
| 116 | "PlenaryTestPopup", | ||
| 117 | "checkhealth", | ||
| 118 | "dbout", | ||
| 119 | "gitsigns-blame", | ||
| 120 | "grug-far", | ||
| 121 | "help", | ||
| 122 | "lspinfo", | ||
| 123 | "neotest-output", | ||
| 124 | "neotest-output-panel", | ||
| 125 | "neotest-summary", | ||
| 126 | "notify", | ||
| 127 | "qf", | ||
| 128 | "snacks_win", | ||
| 129 | "spectre_panel", | ||
| 130 | "startuptime", | ||
| 131 | "tsplayground", | ||
| 132 | }, | ||
| 133 | callback = function(event) | ||
| 134 | vim.bo[event.buf].buflisted = false | ||
| 135 | vim.schedule(function() | ||
| 136 | vim.keymap.set("n", "q", function() | ||
| 137 | vim.cmd("close") | ||
| 138 | pcall(vim.api.nvim_buf_delete, event.buf, { force = true }) | ||
| 139 | end, { | ||
| 140 | buffer = event.buf, | ||
| 141 | silent = true, | ||
| 142 | desc = "Quit buffer", | ||
| 143 | }) | ||
| 144 | end) | ||
| 145 | end, | ||
| 146 | }) | ||
| 147 | |||
| 148 | -- Auto create dir when saving a file, in case some intermediate directory does not exist | ||
| 149 | vim.api.nvim_create_autocmd({ "BufWritePre" }, { | ||
| 150 | group = augroup("auto_create_dir"), | ||
| 151 | callback = function(event) | ||
| 152 | if event.match:match("^%w%w+:[\\/][\\/]") then | ||
| 153 | return | ||
| 154 | end | ||
| 155 | local file = vim.uv.fs_realpath(event.match) or event.match | ||
| 156 | vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p") | ||
| 157 | end, | ||
| 158 | }) | ||
diff --git a/.config/nvim/lua/plugins/conform.lua b/.config/nvim/lua/plugins/conform.lua new file mode 100644 index 0000000..06231dc --- /dev/null +++ b/.config/nvim/lua/plugins/conform.lua | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | return { | ||
| 2 | { | ||
| 3 | 'stevearc/conform.nvim', | ||
| 4 | opts = { | ||
| 5 | format_on_save = { | ||
| 6 | -- These options will be passed to conform.format() | ||
| 7 | timeout_ms = 500, | ||
| 8 | lsp_format = "fallback", | ||
| 9 | }, | ||
| 10 | formatters_by_ft = { | ||
| 11 | lua = { "stylua" }, | ||
| 12 | -- Conform will run multiple formatters sequentially | ||
| 13 | -- You can customize some of the format options for the filetype (:help conform.format) | ||
| 14 | rust = { "rustfmt", lsp_format = "fallback" }, | ||
| 15 | -- Conform will run the first available formatter | ||
| 16 | javascript = { "prettierd", "prettier", stop_after_first = true }, | ||
| 17 | -- latex | ||
| 18 | tex = { "tex-fmt" }, | ||
| 19 | -- sql | ||
| 20 | sql = { "sqruff" }, | ||
| 21 | }, | ||
| 22 | } | ||
| 23 | }, | ||
| 24 | } | ||
diff --git a/.config/nvim/lua/plugins/git.lua b/.config/nvim/lua/plugins/git.lua index db1f435..5f1c1e3 100644 --- a/.config/nvim/lua/plugins/git.lua +++ b/.config/nvim/lua/plugins/git.lua | |||
| @@ -99,11 +99,11 @@ return { | |||
| 99 | { | 99 | { |
| 100 | "NeogitOrg/neogit", | 100 | "NeogitOrg/neogit", |
| 101 | dependencies = { | 101 | dependencies = { |
| 102 | "nvim-lua/plenary.nvim", -- required | 102 | "nvim-lua/plenary.nvim", -- required |
| 103 | "sindrets/diffview.nvim", -- optional - Diff integration | 103 | "sindrets/diffview.nvim", -- optional - Diff integration |
| 104 | "nvim-telescope/telescope.nvim", -- optional | 104 | "nvim-telescope/telescope.nvim", -- optional |
| 105 | }, | 105 | }, |
| 106 | cmd="Neogit", | 106 | cmd = "Neogit", |
| 107 | config = true | 107 | config = true |
| 108 | } | 108 | } |
| 109 | } | 109 | } |
diff --git a/.config/nvim/lua/plugins/lastplace.lua b/.config/nvim/lua/plugins/lastplace.lua new file mode 100644 index 0000000..72e5c7f --- /dev/null +++ b/.config/nvim/lua/plugins/lastplace.lua | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | return { | ||
| 2 | { | ||
| 3 | "ethanholz/nvim-lastplace", | ||
| 4 | |||
| 5 | opts = { | ||
| 6 | lastplace_ignore_buftype = { "quickfix", "nofile", "help" }, | ||
| 7 | lastplace_ignore_filetype = { "gitcommit", "gitrebase", "svn", "hgcommit" }, | ||
| 8 | lastplace_open_folds = true, | ||
| 9 | }, | ||
| 10 | } | ||
| 11 | } | ||
diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua index 2fa92c2..b10aa58 100644 --- a/.config/nvim/lua/plugins/lsp.lua +++ b/.config/nvim/lua/plugins/lsp.lua | |||
| @@ -12,37 +12,38 @@ return { | |||
| 12 | local map = require("helpers.keys").map | 12 | local map = require("helpers.keys").map |
| 13 | 13 | ||
| 14 | map('n', '<leader>e', vim.diagnostic.open_float, "lsp: open diagnostics float") | 14 | map('n', '<leader>e', vim.diagnostic.open_float, "lsp: open diagnostics float") |
| 15 | map('n', '[d', vim.diagnostic.goto_prev, "lsp: goto previous diagnostic") | 15 | map('n', '[d', function() vim.diagnostic.jump({ count = -1, float = true }) end, |
| 16 | map('n', ']d', vim.diagnostic.goto_next, "lsp: goto next diagnostic") | 16 | "lsp: goto previous diagnostic") |
| 17 | 17 | map('n', ']d', function() vim.diagnostic.jump({ count = 1, float = true }) end, "lsp: goto next diagnostic") | |
| 18 | -- set up cool signs for diagnostics | ||
| 19 | local signs = { Error = " ", Warn = "", Hint = "", Info = "" } | ||
| 20 | for type, icon in pairs(signs) do | ||
| 21 | local hl = "DiagnosticSign" .. type | ||
| 22 | vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) | ||
| 23 | end | ||
| 24 | 18 | ||
| 25 | -- Diagnostic config | 19 | vim.diagnostic.config({ |
| 26 | local config = { | 20 | underline = true, |
| 27 | virtual_text = false, | ||
| 28 | signs = { | 21 | signs = { |
| 29 | active = signs, | 22 | active = true, |
| 23 | text = { | ||
| 24 | [vim.diagnostic.severity.ERROR] = "", | ||
| 25 | [vim.diagnostic.severity.WARN] = "", | ||
| 26 | [vim.diagnostic.severity.HINT] = "", | ||
| 27 | [vim.diagnostic.severity.INFO] = "", | ||
| 28 | }, | ||
| 30 | }, | 29 | }, |
| 31 | update_in_insert = true, | 30 | virtual_text = false, |
| 32 | underline = true, | ||
| 33 | severity_sort = true, | ||
| 34 | float = { | 31 | float = { |
| 35 | focusable = true, | ||
| 36 | style = "minimal", | ||
| 37 | border = "rounded", | ||
| 38 | source = "always", | ||
| 39 | header = "", | 32 | header = "", |
| 40 | prefix = "", | 33 | border = "rounded", |
| 34 | format = function(diagnostic) | ||
| 35 | return string.format( | ||
| 36 | "%s (%s) [%s]", | ||
| 37 | diagnostic.message, | ||
| 38 | diagnostic.source, | ||
| 39 | diagnostic.code or diagnostic.user_data.lsp.code | ||
| 40 | ) | ||
| 41 | end, | ||
| 41 | }, | 42 | }, |
| 42 | } | ||
| 43 | vim.diagnostic.config(config) | ||
| 44 | 43 | ||
| 45 | -- this function gets run when an lsp connects to a particular buffer. | 44 | }) |
| 45 | |||
| 46 | -- This function gets run when an LSP connects to a particular buffer. | ||
| 46 | local on_attach = function(_, bufnr) | 47 | local on_attach = function(_, bufnr) |
| 47 | map = require("helpers.keys").lsp_map | 48 | map = require("helpers.keys").lsp_map |
| 48 | 49 | ||
| @@ -71,17 +72,16 @@ return { | |||
| 71 | capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities) | 72 | capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities) |
| 72 | 73 | ||
| 73 | -- misc. | 74 | -- misc. |
| 74 | local lspconfig = require('lspconfig') | 75 | local servers = { 'ts_ls', 'jsonls', 'eslint', 'cssls', 'html', 'vala_ls', 'gopls', 'clangd' } |
| 75 | local servers = { 'ts_ls', 'jsonls', 'eslint', 'cssls', 'html', 'vala_ls', 'gopls' } | ||
| 76 | for _, lsp in pairs(servers) do | 76 | for _, lsp in pairs(servers) do |
| 77 | lspconfig[lsp].setup { | 77 | vim.lsp.config(lsp, { |
| 78 | on_attach = on_attach, | 78 | on_attach = on_attach, |
| 79 | capabilites = capabilities, | 79 | capabilites = capabilities, |
| 80 | } | 80 | }) |
| 81 | end | 81 | end |
| 82 | 82 | ||
| 83 | -- typst/tinymist | 83 | -- typst/tinymist |
| 84 | require("lspconfig")["tinymist"].setup({ | 84 | vim.lsp.config("tinymist", { |
| 85 | on_attach = on_attach, | 85 | on_attach = on_attach, |
| 86 | capabilities = capabilities, | 86 | capabilities = capabilities, |
| 87 | single_file_support = true, | 87 | single_file_support = true, |
| @@ -94,7 +94,7 @@ return { | |||
| 94 | }) | 94 | }) |
| 95 | 95 | ||
| 96 | -- lua | 96 | -- lua |
| 97 | require("lspconfig")["lua_ls"].setup({ | 97 | vim.lsp.config("lua_ls", { |
| 98 | on_attach = on_attach, | 98 | on_attach = on_attach, |
| 99 | capabilities = capabilities, | 99 | capabilities = capabilities, |
| 100 | settings = { | 100 | settings = { |
| @@ -116,7 +116,7 @@ return { | |||
| 116 | }) | 116 | }) |
| 117 | 117 | ||
| 118 | -- python | 118 | -- python |
| 119 | require("lspconfig")["pylsp"].setup({ | 119 | vim.lsp.config("pylsp", { |
| 120 | on_attach = on_attach, | 120 | on_attach = on_attach, |
| 121 | capabilities = capabilities, | 121 | capabilities = capabilities, |
| 122 | settings = { | 122 | settings = { |
| @@ -139,7 +139,7 @@ return { | |||
| 139 | }) | 139 | }) |
| 140 | 140 | ||
| 141 | -- efm | 141 | -- efm |
| 142 | require("lspconfig")["efm"].setup({ | 142 | vim.lsp.config("efm", { |
| 143 | on_attach = on_attach, | 143 | on_attach = on_attach, |
| 144 | settings = { | 144 | settings = { |
| 145 | initializationOptions = { | 145 | initializationOptions = { |
| @@ -155,26 +155,7 @@ return { | |||
| 155 | filetypes = { 'sh', 'tex' }, | 155 | filetypes = { 'sh', 'tex' }, |
| 156 | }) | 156 | }) |
| 157 | 157 | ||
| 158 | vim.g.rustaceanvim = { | 158 | vim.lsp.config("harper_ls", { |
| 159 | -- Plugin configuration | ||
| 160 | tools = { | ||
| 161 | }, | ||
| 162 | -- LSP configuration | ||
| 163 | server = { | ||
| 164 | on_attach = on_attach, | ||
| 165 | vim.lsp.inlay_hint.enable(true), | ||
| 166 | default_settings = { | ||
| 167 | -- rust-analyzer language server configuration | ||
| 168 | ['rust-analyzer'] = { | ||
| 169 | }, | ||
| 170 | }, | ||
| 171 | }, | ||
| 172 | -- DAP configuration | ||
| 173 | dap = { | ||
| 174 | }, | ||
| 175 | } | ||
| 176 | |||
| 177 | lspconfig.harper_ls.setup { | ||
| 178 | on_attach = on_attach, | 159 | on_attach = on_attach, |
| 179 | capabilities = capabilities, | 160 | capabilities = capabilities, |
| 180 | settings = { | 161 | settings = { |
| @@ -199,12 +180,58 @@ return { | |||
| 199 | } | 180 | } |
| 200 | }, | 181 | }, |
| 201 | filetypes = { | 182 | filetypes = { |
| 202 | "markdown", "rust", "typescript", "typescriptreact", "javascript", "python", "c", "cpp", "ruby", "swift", "csharp", "toml", "lua", "gitcommit", "java", "html", "vimwiki" | 183 | "markdown", "rust", "typescript", "typescriptreact", "javascript", "python", "c", "cpp", "ruby", "swift", "csharp", "toml", "lua", "gitcommit", "java", "html", "vimwiki", "tex" |
| 184 | }, | ||
| 185 | root_dir = function(fname) | ||
| 186 | return vim.fs.dirname(vim.fs.find('.git', { path = fname, upward = true })[1]) | ||
| 187 | end, | ||
| 188 | }) | ||
| 189 | |||
| 190 | -- ltex | ||
| 191 | vim.lsp.config("ltex", { | ||
| 192 | capabilities = capabilities, | ||
| 193 | on_attach = function(client, bufnr) | ||
| 194 | on_attach(client, bufnr) | ||
| 195 | require("ltex_extra").setup { | ||
| 196 | load_langs = { "en-GB" }, | ||
| 197 | init_check = true, | ||
| 198 | log_level = "warn", | ||
| 199 | } | ||
| 200 | end, | ||
| 201 | filetypes = { "bib", "gitcommit", "markdown", "org", "plaintex", "rst", "rnoweb", "tex", "pandoc", "quarto", "rmd", "context", "mail", "text" }, | ||
| 202 | settings = { | ||
| 203 | ltex = { | ||
| 204 | enabled = { "bibtex", "gitcommit", "markdown", "org", "tex", "restructuredtext", "rsweave", "latex", "quarto", "rmd", "context", "mail", "plaintext" } | ||
| 205 | } | ||
| 203 | } | 206 | } |
| 207 | }) | ||
| 208 | |||
| 209 | vim.g.rustaceanvim = { | ||
| 210 | -- Plugin configuration | ||
| 211 | tools = { | ||
| 212 | }, | ||
| 213 | -- LSP configuration | ||
| 214 | server = { | ||
| 215 | on_attach = on_attach, | ||
| 216 | vim.lsp.inlay_hint.enable(true), | ||
| 217 | default_settings = { | ||
| 218 | -- rust-analyzer language server configuration | ||
| 219 | ['rust-analyzer'] = { | ||
| 220 | }, | ||
| 221 | }, | ||
| 222 | }, | ||
| 223 | -- DAP configuration | ||
| 224 | dap = { | ||
| 225 | }, | ||
| 204 | } | 226 | } |
| 205 | end, | 227 | end, |
| 206 | }, | 228 | }, |
| 207 | { | 229 | { |
| 230 | "barreiroleo/ltex_extra.nvim", | ||
| 231 | ft = { "markdown", "tex" }, | ||
| 232 | dependencies = { "neovim/nvim-lspconfig" }, | ||
| 233 | }, | ||
| 234 | { | ||
| 208 | "j-hui/fidget.nvim", | 235 | "j-hui/fidget.nvim", |
| 209 | event = "VeryLazy", | 236 | event = "VeryLazy", |
| 210 | opts = { | 237 | opts = { |
| @@ -228,9 +255,32 @@ return { | |||
| 228 | }, | 255 | }, |
| 229 | { | 256 | { |
| 230 | "folke/lazydev.nvim", | 257 | "folke/lazydev.nvim", |
| 231 | ft = "lua", -- only load on lua files | 258 | ft = "lua", |
| 232 | }, | 259 | }, |
| 233 | { | 260 | { |
| 234 | 'fatih/vim-go' | 261 | 'fatih/vim-go' |
| 262 | }, | ||
| 263 | { | ||
| 264 | "danymat/neogen", | ||
| 265 | config = true, | ||
| 266 | opts = { | ||
| 267 | snippet_engine = "luasnip", | ||
| 268 | languages = { | ||
| 269 | python = { | ||
| 270 | template = { | ||
| 271 | annotation_convention = "reST", | ||
| 272 | } | ||
| 273 | } | ||
| 274 | } | ||
| 275 | } | ||
| 276 | }, | ||
| 277 | { | ||
| 278 | 'marcelofern/vale.nvim', | ||
| 279 | config = function() | ||
| 280 | require("vale").setup({ | ||
| 281 | bin = "/usr/bin/vale", | ||
| 282 | vale_config_path = "$HOME/.config/vale/.vale.ini", | ||
| 283 | }) | ||
| 284 | end, | ||
| 235 | } | 285 | } |
| 236 | } | 286 | } |
diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua index 40c99a4..24f820d 100644 --- a/.config/nvim/lua/plugins/telescope.lua +++ b/.config/nvim/lua/plugins/telescope.lua | |||
| @@ -12,10 +12,16 @@ return { | |||
| 12 | "gbprod/yanky.nvim", | 12 | "gbprod/yanky.nvim", |
| 13 | }, | 13 | }, |
| 14 | config = function() | 14 | config = function() |
| 15 | local open_with_trouble = require("trouble.sources.telescope").open | ||
| 16 | |||
| 15 | require('telescope').setup({ | 17 | require('telescope').setup({ |
| 16 | defaults = { | 18 | defaults = { |
| 17 | path_display = { "truncate" }, | 19 | path_display = { "truncate" }, |
| 18 | prompt_prefix = " ", | 20 | prompt_prefix = " ", |
| 21 | mappings = { | ||
| 22 | i = { ["<leader>xt"] = open_with_trouble }, | ||
| 23 | n = { ["<leader>xt"] = open_with_trouble }, | ||
| 24 | }, | ||
| 19 | }, | 25 | }, |
| 20 | extensions = { | 26 | extensions = { |
| 21 | fzf = { | 27 | fzf = { |
| @@ -46,6 +52,10 @@ return { | |||
| 46 | map("n", "<leader>sw", require("telescope.builtin").grep_string, "🔭: current word") | 52 | map("n", "<leader>sw", require("telescope.builtin").grep_string, "🔭: current word") |
| 47 | map("n", "<leader>sg", require("telescope.builtin").live_grep, "🔭: live grep") | 53 | map("n", "<leader>sg", require("telescope.builtin").live_grep, "🔭: live grep") |
| 48 | map("n", "<leader>sd", require("telescope.builtin").diagnostics, "🔭: diagnostics") | 54 | map("n", "<leader>sd", require("telescope.builtin").diagnostics, "🔭: diagnostics") |
| 55 | map("n", "<leader>sc", function() | ||
| 56 | require("telescope.builtin").lsp_document_symbols({ symbols = 'function' }) | ||
| 57 | end, "🔭: lsp symbols (functions)") | ||
| 58 | |||
| 49 | map("n", "<leader>st", function() | 59 | map("n", "<leader>st", function() |
| 50 | require("telescope.builtin").spell_suggest(require("telescope.themes").get_cursor({ | 60 | require("telescope.builtin").spell_suggest(require("telescope.themes").get_cursor({ |
| 51 | prompt_title = "", | 61 | prompt_title = "", |
diff --git a/.config/nvim/spell/en.utf-8.add b/.config/nvim/spell/en.utf-8.add index 8374b5b..da95938 100644 --- a/.config/nvim/spell/en.utf-8.add +++ b/.config/nvim/spell/en.utf-8.add | |||
| @@ -129,3 +129,6 @@ Wayback | |||
| 129 | FarSight | 129 | FarSight |
| 130 | Zetalytics | 130 | Zetalytics |
| 131 | VirusTotal | 131 | VirusTotal |
| 132 | eSLD | ||
| 133 | NXDOMAIN | ||
| 134 | CrUX | ||
