diff options
0.11 nvim
-rw-r--r-- | .config/nvim/ftplugin/lua.lua | 2 | ||||
-rw-r--r-- | .config/nvim/init.lua | 85 | ||||
-rw-r--r-- | .config/nvim/plugin/backports.lua | 198 | ||||
m--------- | .local/share/nvim/site/pack/plugins/start/conform | 0 | ||||
m--------- | .local/share/nvim/site/pack/plugins/start/lazydev | 0 | ||||
m--------- | .local/share/nvim/site/pack/plugins/start/mason | 0 | ||||
m--------- | .local/share/nvim/site/pack/plugins/start/mason-lspconfig | 0 | ||||
m--------- | .local/share/nvim/site/pack/plugins/start/nvim-cmp | 0 | ||||
m--------- | .local/share/nvim/site/pack/plugins/start/nvim-lspconfig | 0 | ||||
m--------- | .local/share/nvim/site/pack/plugins/start/nvim-treesitter | 0 | ||||
m--------- | .zfunc/zsh-completions | 0 |
11 files changed, 54 insertions, 231 deletions
diff --git a/.config/nvim/ftplugin/lua.lua b/.config/nvim/ftplugin/lua.lua index 6633c77..ab8173f 100644 --- a/.config/nvim/ftplugin/lua.lua +++ b/.config/nvim/ftplugin/lua.lua @@ -1,2 +1,2 @@ -require'lazydev'.setup {} +-- require'lazydev'.setup {} diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 80b67a3..f2d40b9 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -39,9 +39,10 @@ vim.opt.fillchars = { eob = " " } +vim.o.completeopt = "menuone,noinsert,popup,fuzzy" vim.o.showtabline = 2 -vim.cmd.colorscheme('retrobox') +vim.cmd.colorscheme 'retrobox' vim.keymap.set({ 'n', 'x' }, '<leader>y', '"+y') vim.keymap.set('n', '<leader>p', '"+p') @@ -86,6 +87,10 @@ vim.keymap.set('n', '<leader>q', function() vim.diagnostic.setloclist() end) +vim.diagnostic.config { + virtual_lines = true, +} + require 'conform'.setup {} vim.o.formatexpr = "v:lua.require'conform'.formatexpr()" @@ -142,11 +147,19 @@ vim.api.nvim_create_autocmd('LspAttach', { local opts = { buffer = ev.buf } local client = vim.lsp.get_client_by_id(ev.data.client_id) - if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then + if not client then + return + end + + if client:supports_method('textDocument/inlayHint') then vim.lsp.inlay_hint.enable() end - if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then + if client:supports_method('textDocument/completion') then + vim.lsp.completion.enable(true, ev.data.client_id, ev.buf, { autotrigger = true }) + end + + if client:supports_method('textDocument/documentHighlight') then local highlight_augroup = vim.api.nvim_create_augroup('lsp-highlight', { clear = false }) vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { @@ -172,7 +185,12 @@ vim.api.nvim_create_autocmd('LspAttach', { }) end - if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_codelens) then + if client:supports_method('textDocument/foldingRange') then + local win = vim.api.nvim_get_current_win() + vim.wo[win][0].foldexpr = 'v:lua.vim.lsp.foldexpr()' + end + + if client:supports_method('textDocument/codelens') then vim.lsp.codelens.refresh(opts) vim.api.nvim_create_autocmd({ 'CursorHold', 'InsertLeave' }, { buffer = ev.buf, @@ -192,8 +210,8 @@ local function setupLSP(server_name, settings) settings.capabilities = vim.tbl_deep_extend( "force", {}, - vim.lsp.protocol.make_client_capabilities(), - require 'cmp_nvim_lsp'.default_capabilities() + vim.lsp.protocol.make_client_capabilities() + -- require 'cmp_nvim_lsp'.default_capabilities() ) require "lspconfig"[server_name].setup(settings) end @@ -210,6 +228,12 @@ require 'mason-lspconfig'.setup { setupLSP("lua_ls", { settings = { Lua = { + runtime = { + version = 'LuaJIT' + }, + workspace = { + library = vim.api.nvim_get_runtime_file("", true) + }, completion = { callSnippet = 'Replace', }, @@ -236,9 +260,6 @@ require 'mason-lspconfig'.setup { compositeLiteralTypes = true, functionTypeParameters = true, }, - codelenses = { - gc_details = true, - } }, } }) @@ -292,26 +313,26 @@ require 'mason-lspconfig'.setup { } } -local cmp = require 'cmp' -local cmp_select = { behavior = cmp.SelectBehavior.Select } - -cmp.setup { - snippet = { - expand = function(args) - vim.snippet.expand(args.body) - end, - }, - mapping = cmp.mapping.preset.insert({ - ['<Up>'] = cmp.mapping.select_prev_item(cmp_select), - ['<Down>'] = cmp.mapping.select_next_item(cmp_select), - }), - sources = cmp.config.sources({ - { - name = 'lazydev', - group_index = 0, - }, - { name = 'nvim_lsp' }, - }, { - { name = 'buffer' }, - }) -} +-- local cmp = require 'cmp' +-- local cmp_select = { behavior = cmp.SelectBehavior.Select } +-- +-- cmp.setup { +-- snippet = { +-- expand = function(args) +-- vim.snippet.expand(args.body) +-- end, +-- }, +-- mapping = cmp.mapping.preset.insert({ +-- ['<Up>'] = cmp.mapping.select_prev_item(cmp_select), +-- ['<Down>'] = cmp.mapping.select_next_item(cmp_select), +-- }), +-- sources = cmp.config.sources({ +-- { +-- name = 'lazydev', +-- group_index = 0, +-- }, +-- { name = 'nvim_lsp' }, +-- }, { +-- { name = 'buffer' }, +-- }) +-- } diff --git a/.config/nvim/plugin/backports.lua b/.config/nvim/plugin/backports.lua deleted file mode 100644 index c6ba87b..0000000 --- a/.config/nvim/plugin/backports.lua +++ /dev/null @@ -1,198 +0,0 @@ --- backports from nightly to 0.10 - --- LSP Stuff -vim.keymap.set('n', 'grn', function() - vim.lsp.buf.rename() -end) - -vim.keymap.set({ 'n', 'x' }, 'gra', function() - vim.lsp.buf.code_action() -end) - -vim.keymap.set('n', 'grr', function() - vim.lsp.buf.references() -end) - -vim.keymap.set('n', 'gri', function() - vim.lsp.buf.implementation() -end) - -vim.keymap.set('n', 'gO', function() - vim.lsp.buf.document_symbol() -end) - -vim.keymap.set({ 'i', 's' }, '<C-S>', function() - vim.lsp.buf.signature_help() -end) - --- Terminal AutoSetup -vim.api.nvim_create_autocmd('TermOpen', { - desc = 'Default settings for :terminal buffers', - callback = function() - vim.bo.modifiable = false - vim.bo.undolevels = -1 - vim.bo.scrollback = vim.o.scrollback < 0 and 10000 or math.max(1, vim.o.scrollback) - vim.bo.textwidth = 0 - vim.wo[0][0].wrap = false - vim.wo[0][0].list = false - vim.wo[0][0].number = false - vim.wo[0][0].relativenumber = false - vim.wo[0][0].signcolumn = 'no' - vim.wo[0][0].foldcolumn = '0' - - -- This is gross. Proper list options support when? - local winhl = vim.o.winhighlight - if winhl ~= '' then - winhl = winhl .. ',' - end - vim.wo[0][0].winhighlight = winhl .. 'StatusLine:StatusLineTerm,StatusLineNC:StatusLineTermNC' - end, -}) - --- Vim Unpaired --- ]<Space> and [<Space> not ported - ---- Execute a command and print errors without a stacktrace. ---- @param opts table Arguments to |nvim_cmd()| -local function cmd(opts) - local ok, err = pcall(vim.api.nvim_cmd, opts, {}) - if not ok then - vim.api.nvim_err_writeln(err:sub(#'Vim:' + 1)) - end -end - --- Quickfix mappings -vim.keymap.set('n', '[q', function() - cmd({ cmd = 'cprevious', count = vim.v.count1 }) -end, { desc = ':cprevious' }) - -vim.keymap.set('n', ']q', function() - cmd({ cmd = 'cnext', count = vim.v.count1 }) -end, { desc = ':cnext' }) - -vim.keymap.set('n', '[Q', function() - cmd({ cmd = 'crewind', count = vim.v.count ~= 0 and vim.v.count or nil }) -end, { desc = ':crewind' }) - -vim.keymap.set('n', ']Q', function() - cmd({ cmd = 'clast', count = vim.v.count ~= 0 and vim.v.count or nil }) -end, { desc = ':clast' }) - -vim.keymap.set('n', '[<C-Q>', function() - cmd({ cmd = 'cpfile', count = vim.v.count1 }) -end, { desc = ':cpfile' }) - -vim.keymap.set('n', ']<C-Q>', function() - cmd({ cmd = 'cnfile', count = vim.v.count1 }) -end, { desc = ':cnfile' }) - --- Location list mappings -vim.keymap.set('n', '[l', function() - cmd({ cmd = 'lprevious', count = vim.v.count1 }) -end, { desc = ':lprevious' }) - -vim.keymap.set('n', ']l', function() - cmd({ cmd = 'lnext', count = vim.v.count1 }) -end, { desc = ':lnext' }) - -vim.keymap.set('n', '[L', function() - cmd({ cmd = 'lrewind', count = vim.v.count ~= 0 and vim.v.count or nil }) -end, { desc = ':lrewind' }) - -vim.keymap.set('n', ']L', function() - cmd({ cmd = 'llast', count = vim.v.count ~= 0 and vim.v.count or nil }) -end, { desc = ':llast' }) - -vim.keymap.set('n', '[<C-L>', function() - cmd({ cmd = 'lpfile', count = vim.v.count1 }) -end, { desc = ':lpfile' }) - -vim.keymap.set('n', ']<C-L>', function() - cmd({ cmd = 'lnfile', count = vim.v.count1 }) -end, { desc = ':lnfile' }) - --- Argument list -vim.keymap.set('n', '[a', function() - cmd({ cmd = 'previous', count = vim.v.count1 }) -end, { desc = ':previous' }) - -vim.keymap.set('n', ']a', function() - -- count doesn't work with :next, must use range. See #30641. - cmd({ cmd = 'next', range = { vim.v.count1 } }) -end, { desc = ':next' }) - -vim.keymap.set('n', '[A', function() - if vim.v.count ~= 0 then - cmd({ cmd = 'argument', count = vim.v.count }) - else - cmd({ cmd = 'rewind' }) - end -end, { desc = ':rewind' }) - -vim.keymap.set('n', ']A', function() - if vim.v.count ~= 0 then - cmd({ cmd = 'argument', count = vim.v.count }) - else - cmd({ cmd = 'last' }) - end -end, { desc = ':last' }) - --- Tags -vim.keymap.set('n', '[t', function() - -- count doesn't work with :tprevious, must use range. See #30641. - cmd({ cmd = 'tprevious', range = { vim.v.count1 } }) -end, { desc = ':tprevious' }) - -vim.keymap.set('n', ']t', function() - -- count doesn't work with :tnext, must use range. See #30641. - cmd({ cmd = 'tnext', range = { vim.v.count1 } }) -end, { desc = ':tnext' }) - -vim.keymap.set('n', '[T', function() - -- count doesn't work with :trewind, must use range. See #30641. - cmd({ cmd = 'trewind', range = vim.v.count ~= 0 and { vim.v.count } or nil }) -end, { desc = ':trewind' }) - -vim.keymap.set('n', ']T', function() - -- :tlast does not accept a count, so use :trewind if count given - if vim.v.count ~= 0 then - cmd({ cmd = 'trewind', range = { vim.v.count } }) - else - cmd({ cmd = 'tlast' }) - end -end, { desc = ':tlast' }) - -vim.keymap.set('n', '[<C-T>', function() - -- count doesn't work with :ptprevious, must use range. See #30641. - cmd({ cmd = 'ptprevious', range = { vim.v.count1 } }) -end, { desc = ' :ptprevious' }) - -vim.keymap.set('n', ']<C-T>', function() - -- count doesn't work with :ptnext, must use range. See #30641. - cmd({ cmd = 'ptnext', range = { vim.v.count1 } }) -end, { desc = ':ptnext' }) - --- Buffers -vim.keymap.set('n', '[b', function() - cmd({ cmd = 'bprevious', count = vim.v.count1 }) -end, { desc = ':bprevious' }) - -vim.keymap.set('n', ']b', function() - cmd({ cmd = 'bnext', count = vim.v.count1 }) -end, { desc = ':bnext' }) - -vim.keymap.set('n', '[B', function() - if vim.v.count ~= 0 then - cmd({ cmd = 'buffer', count = vim.v.count }) - else - cmd({ cmd = 'brewind' }) - end -end, { desc = ':brewind' }) - -vim.keymap.set('n', ']B', function() - if vim.v.count ~= 0 then - cmd({ cmd = 'buffer', count = vim.v.count }) - else - cmd({ cmd = 'blast' }) - end -end, { desc = ':blast' }) diff --git a/.local/share/nvim/site/pack/plugins/start/conform b/.local/share/nvim/site/pack/plugins/start/conform -Subproject 363243c03102a531a8203311d4f2ae704c620d9 +Subproject f9ef25a7ef00267b7d13bfc00b0dea22d78702d diff --git a/.local/share/nvim/site/pack/plugins/start/lazydev b/.local/share/nvim/site/pack/plugins/start/lazydev -Subproject a1b78b2ac6f978c72e76ea90ae92a94edf380cf +Subproject 2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2 diff --git a/.local/share/nvim/site/pack/plugins/start/mason b/.local/share/nvim/site/pack/plugins/start/mason -Subproject e2f7f9044ec30067bc11800a9e266664b88cda2 +Subproject fc98833b6da5de5a9c5b1446ac541577059555b diff --git a/.local/share/nvim/site/pack/plugins/start/mason-lspconfig b/.local/share/nvim/site/pack/plugins/start/mason-lspconfig -Subproject 805c31ec6bfb557975143712ecff6956d322714 +Subproject 1a31f824b9cd5bc6f342fc29e9a53b60d74af24 diff --git a/.local/share/nvim/site/pack/plugins/start/nvim-cmp b/.local/share/nvim/site/pack/plugins/start/nvim-cmp -Subproject 12509903a5723a876abd65953109f926f4634c3 +Subproject 1e1900b0769324a9675ef85b38f99cca29e203b diff --git a/.local/share/nvim/site/pack/plugins/start/nvim-lspconfig b/.local/share/nvim/site/pack/plugins/start/nvim-lspconfig -Subproject 6c17f8656f667727b27f5f598463afedb7791b1 +Subproject 85e0dd26b710e834a105d679200d01e326a3d2b diff --git a/.local/share/nvim/site/pack/plugins/start/nvim-treesitter b/.local/share/nvim/site/pack/plugins/start/nvim-treesitter -Subproject 6108ba7a135ed37e32276ccb877a348af17fe41 +Subproject da5825bf70cc2ea7eacd1e60c32c07baf19adeb diff --git a/.zfunc/zsh-completions b/.zfunc/zsh-completions -Subproject 85e041be36a33d8f6ca71746654406425d3a910 +Subproject e61c9c14d6978191762e9586a0c882114e49221 |