diff options
Diffstat (limited to '.config/nvim/lua')
| -rw-r--r-- | .config/nvim/lua/autocomplete.lua | 21 | ||||
| -rw-r--r-- | .config/nvim/lua/fzf.lua | 1 | ||||
| -rw-r--r-- | .config/nvim/lua/lsp.lua | 30 | ||||
| -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 | 34 | ||||
| -rw-r--r-- | .config/nvim/lua/treesitter.lua | 2 |
7 files changed, 125 insertions, 23 deletions
diff --git a/.config/nvim/lua/autocomplete.lua b/.config/nvim/lua/autocomplete.lua index 4ada86b..58af67f 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' }), @@ -23,8 +25,8 @@ cmp.setup({ mapping = cmp.mapping.preset.insert({ ['<C-b>'] = cmp.mapping.scroll_docs(-4), ['<C-f>'] = cmp.mapping.scroll_docs(4), - ['<C-y>'] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. - ['<C-e>'] = cmp.mapping.abort(), + ['<C-y>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + ['<C-c>'] = cmp.mapping.complete(), }), sources = cmp.config.sources({ { name = 'nvim_lsp' }, @@ -35,7 +37,10 @@ cmp.setup({ -- { name = 'snippy' }, -- For snippy users. }, { { name = 'buffer' }, - }) + }), + completion = { + autocomplete = false, + } }) -- Set configuration for specific filetype. diff --git a/.config/nvim/lua/fzf.lua b/.config/nvim/lua/fzf.lua index 170158a..21341f1 100644 --- a/.config/nvim/lua/fzf.lua +++ b/.config/nvim/lua/fzf.lua @@ -1,5 +1,6 @@ local fzf = require('fzf-lua') vim.keymap.set('n', '<c-b>', fzf.buffers, {}) +vim.keymap.set('n', '<c-m>', fzf.marks, {}) vim.keymap.set('n', '<leader>fb', fzf.lines, {}) vim.keymap.set('n', '<leader>ff', fzf.files, {}) vim.keymap.set('n', '<leader>fg', fzf.live_grep, {}) diff --git a/.config/nvim/lua/lsp.lua b/.config/nvim/lua/lsp.lua index 55e70cc..c417026 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({ @@ -142,6 +141,35 @@ lspconfig.sqls.setup { }, } +-- local lsp = require 'lspconfig' +-- local configs = require 'lspconfig.configs' + +-- if not configs.jai_lsp then +-- configs.jai_lsp = { +-- default_config = { +-- cmd = { 'jails' }, +-- filetypes = { 'jai' }, +-- } +-- } +-- end + +-- lspconfig.jai_lsp.setup({ +-- on_attach = on_attach, +-- capabilities = capabilities, +-- }) + +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 7bd8b20..a68da80 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 @@ -107,4 +110,33 @@ return require('lazy').setup({ }, 'mg979/vim-visual-multi', + { + "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 b4e9b9b..011ea9f 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, |
