diff options
Diffstat (limited to '.config/nvim/lua')
| -rw-r--r-- | .config/nvim/lua/autocomplete.lua | 16 | ||||
| -rw-r--r-- | .config/nvim/lua/lsp.lua | 13 | ||||
| -rw-r--r-- | .config/nvim/lua/lspsaga_conf.lua | 2 | ||||
| -rw-r--r-- | .config/nvim/lua/mappings.lua | 58 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins.lua | 32 | ||||
| -rw-r--r-- | .config/nvim/lua/treesitter.lua | 2 |
6 files changed, 101 insertions, 22 deletions
diff --git a/.config/nvim/lua/autocomplete.lua b/.config/nvim/lua/autocomplete.lua index 1de4271..7746750 100644 --- a/.config/nvim/lua/autocomplete.lua +++ b/.config/nvim/lua/autocomplete.lua @@ -1,6 +1,7 @@ -- Set up nvim-cmp. local cmp = require 'cmp' + cmp.setup({ snippet = { -- REQUIRED - you must specify a snippet engine @@ -11,11 +12,12 @@ cmp.setup({ -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users. end, }, - experimental = { - ghost_text = { - hl_group = "CmpGhostText", - }, - }, + -- can't figure this out, could be cool if ghost text actually took on different color + -- experimental = { + -- ghost_text = { + -- hl_group = "CmpGhostText", + -- }, + -- }, window = { completion = cmp.config.window.bordered({ border = 'none' }), documentation = cmp.config.window.bordered({ border = 'none' }), @@ -24,7 +26,7 @@ cmp.setup({ ['<C-b>'] = cmp.mapping.scroll_docs(-4), ['<C-f>'] = cmp.mapping.scroll_docs(4), ['<C-y>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. - ['<C-e>'] = cmp.mapping.abort(), + ['<C-c>'] = cmp.mapping.complete(), }), sources = cmp.config.sources({ { name = 'nvim_lsp' }, @@ -37,7 +39,7 @@ cmp.setup({ { name = 'buffer' }, }), completion = { - autocomplete = false + autocomplete = false, } }) diff --git a/.config/nvim/lua/lsp.lua b/.config/nvim/lua/lsp.lua index e70ce07..3178a5d 100644 --- a/.config/nvim/lua/lsp.lua +++ b/.config/nvim/lua/lsp.lua @@ -58,7 +58,6 @@ local lspconfig = require('lspconfig') lspconfig.zls.setup({ on_attach = on_attach, capabilities = capabilities, - }) lspconfig.bashls.setup({ @@ -160,6 +159,18 @@ end lspconfig.jails.setup({}) vim.filetype.add({ extension = { jai = "jai", } }) +lspconfig.ols.setup({ + on_attach = on_attach, + capabilities = capabilities, + init_options = { + enable_references = true, + enable_rename = true, + enable_semantic_tokens = true, + enable_checker_only_saved = true, + enable_inlay_hints = true, + } +}) + vim.api.nvim_create_autocmd('BufWritePre', { pattern = '*.go', callback = function() diff --git a/.config/nvim/lua/lspsaga_conf.lua b/.config/nvim/lua/lspsaga_conf.lua index 73d5695..b31aeff 100644 --- a/.config/nvim/lua/lspsaga_conf.lua +++ b/.config/nvim/lua/lspsaga_conf.lua @@ -88,7 +88,7 @@ require('lspsaga').setup({ }, }) -Nmap('<c-e>', ':Lspsaga outline<CR>') +Nmap('<c-l>', ':Lspsaga outline<CR>') -- Nmap('<c-d>', ':Lspsaga show_buf_diagnostics<CR>') Nmap('<c-w>', ':Lspsaga show_buf_diagnostics<CR>') Nmap('<c-a>', ':Lspsaga code_action<CR>') diff --git a/.config/nvim/lua/mappings.lua b/.config/nvim/lua/mappings.lua index 838ba4f..e6c34ca 100644 --- a/.config/nvim/lua/mappings.lua +++ b/.config/nvim/lua/mappings.lua @@ -25,20 +25,56 @@ function Tmap(shortcut, command) Map('t', shortcut, command) end ---- pane nav -Nmap("<c-k>", ":wincmd k<CR>") -Nmap("<c-j>", ":wincmd j<CR>") -Nmap("<c-h>", ":wincmd h<CR>") -Nmap("<c-l>", ":wincmd l<CR>") +-- pane nav +Nmap("<leader>u", ":wincmd k<CR>") +Nmap("<leader>e", ":wincmd j<CR>") +Nmap("<leader>n", ":wincmd h<CR>") +Nmap("<leader>i", ":wincmd l<CR>") ---- pane resize -Nmap("_", ":resize -1<CR>") -Nmap("+", ":resize +1<CR>") +-- -- pane resize +-- Nmap("_", ":resize -1<CR>") +-- Nmap("+", ":resize +1<CR>") -- pane spawn -Nmap("t", ':split<CR>:wincmd j<CR>:term<CR>') -Nmap("s", ':vs<CR>:wincmd l<CR>') -Nmap("<c-s>", ':only<CR>') +Nmap("<leader>t", ':split<CR>:wincmd j<CR>:term<CR>') +Nmap("<leader>s", ':vs<CR>:wincmd l<CR>') +Nmap("<leader>wo", ':only<CR>') -- escape terminal mode easier Tmap('<Esc>', '<C-\\><C-n>') + + +-- yoinked from https://github.com/dycw/dotfiles/blob/master/nvim/lua/keymaps.lua +local function merge_tables(t1, t2) + local result = {} + for key, value in pairs(t1) do + result[key] = value + end + for key, value in pairs(t2) do + result[key] = value + end + return result +end + +local keymap_opts = { noremap = true, silent = true } + +local keymap_set = function(mode, lhs, rhs, desc) + vim.keymap.set(mode, lhs, rhs, merge_tables(keymap_opts, { desc = desc })) +end +-- command +keymap_set("n", ";", ":", "Command") + +-- global marks +local prefixes = "m'" +local letters = "abcdefghijklmnopqrstuvwxyz" +for i = 1, #prefixes do + local prefix = prefixes:sub(i, i) + for j = 1, #letters do + local lower_letter = letters:sub(j, j) + local upper_letter = string.upper(lower_letter) + keymap_set({ "n", "v" }, prefix .. lower_letter, prefix .. upper_letter, "Mark " .. upper_letter) + end +end + +-- paste in insert mode +keymap_set("i", "<C-v>", "<C-o>p", "Paste") diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua index 44a7294..0a72469 100644 --- a/.config/nvim/lua/plugins.lua +++ b/.config/nvim/lua/plugins.lua @@ -46,7 +46,7 @@ return require('lazy').setup({ 'scrooloose/nerdcommenter', -- commenting shortcuts 'tpope/vim-eunuch', -- wrappers UNIX commands - 'tpope/vim-surround', -- surround characters shortcuts + --'tpope/vim-surround', -- surround characters shortcuts 'tpope/vim-endwise', -- wisely add 'tpope/vim-repeat', -- repeat for plugins -- 'tpope/vim-vinegar', -- make explore better @@ -88,6 +88,9 @@ return require('lazy').setup({ -- jai 'rluba/jai.vim', + -- Odin + 'Tetralux/odin.vim', + 'johmsalas/text-case.nvim', -- integer base conversions @@ -116,5 +119,32 @@ return require('lazy').setup({ vim.g.lsp_zero_extend_cmp = 0 vim.g.lsp_zero_extend_lspconfig = 0 end, + "folke/todo-comments.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + opts = { + keywords = { + FIX = { + icon = " ", -- icon used for the sign, and in search results + color = "error", -- can be a hex color, or a named color (see below) + alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, -- a set of other keywords that all map to this FIX keywords + -- signs = false, -- configure signs for some keywords individually + }, + TODO = { icon = " ", color = "info", alt = { "nocheckin" } }, + HACK = { icon = " ", color = "warning" }, + WARN = { icon = " ", color = "warning", alt = { "WARNING", "XXX" } }, + PERF = { icon = " ", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } }, + NOTE = { icon = " ", color = "hint", alt = { "INFO" } }, + TEST = { icon = "⏲ ", color = "test", alt = { "TESTING", "PASSED", "FAILED" } }, + }, + } + }, + + -- movement + 'ggandor/leap.nvim', + { + "chentoast/marks.nvim", + event = "VeryLazy", + opts = { + }, }, }) diff --git a/.config/nvim/lua/treesitter.lua b/.config/nvim/lua/treesitter.lua index cbf7d0c..ce17c70 100644 --- a/.config/nvim/lua/treesitter.lua +++ b/.config/nvim/lua/treesitter.lua @@ -1,6 +1,6 @@ require 'nvim-treesitter.configs'.setup { -- A list of parser names, or "all" - ensure_installed = { "rust", "c", "lua", "vim", "zig", "go" }, + ensure_installed = { "rust", "c", "lua", "vim", "zig", "go", "odin" }, -- Install parsers synchronously (only applied to `ensure_installed`) sync_install = false, |
