diff options
| author | triethyl <triethylammonium@pm.me> | 2025-08-17 12:45:30 -0400 |
|---|---|---|
| committer | triethyl <triethylammonium@pm.me> | 2025-08-17 12:45:30 -0400 |
| commit | 89a88e24d00306076b067a0ccb87ad2a603054f3 (patch) | |
| tree | 85b5ef8730893b4ac2b750498916ee7f90e44e0d /pkgs/custom-neovim/config/lua | |
| parent | 58ceb817bb6ba195d1189160878f318f3bcda0ef (diff) | |
neovim: working on new config
Diffstat (limited to 'pkgs/custom-neovim/config/lua')
| -rw-r--r-- | pkgs/custom-neovim/config/lua/keymaps.lua | 17 | ||||
| -rw-r--r-- | pkgs/custom-neovim/config/lua/lsp.lua | 42 | ||||
| -rw-r--r-- | pkgs/custom-neovim/config/lua/plugins/colorschemes.lua | 12 | ||||
| -rw-r--r-- | pkgs/custom-neovim/config/lua/plugins/comment.lua | 7 | ||||
| -rw-r--r-- | pkgs/custom-neovim/config/lua/plugins/git.lua | 26 | ||||
| -rw-r--r-- | pkgs/custom-neovim/config/lua/plugins/mini-clue.lua | 8 | ||||
| -rw-r--r-- | pkgs/custom-neovim/config/lua/plugins/mini-files.lua | 10 | ||||
| -rw-r--r-- | pkgs/custom-neovim/config/lua/plugins/mini-pairs.lua | 8 | ||||
| -rw-r--r-- | pkgs/custom-neovim/config/lua/plugins/mini-pick.lua | 1 | ||||
| -rw-r--r-- | pkgs/custom-neovim/config/lua/plugins/mini-statusline.lua | 26 |
10 files changed, 122 insertions, 35 deletions
diff --git a/pkgs/custom-neovim/config/lua/keymaps.lua b/pkgs/custom-neovim/config/lua/keymaps.lua index f766fb5..2ae207e 100644 --- a/pkgs/custom-neovim/config/lua/keymaps.lua +++ b/pkgs/custom-neovim/config/lua/keymaps.lua @@ -11,6 +11,23 @@ vim.g.mapleader = " " mapkey("n", "<leader>f", "Open file picker", ":Pick files<cr>", "mini.pick") mapkey("n", "<leader>o", "Open old file picker", ":Pick oldfiles<cr>", "mini.pick") mapkey("n", "<leader>/", "Open live grep picker", ":Pick grep_live<cr>", "mini.pick") +mapkey("n", "<leader>b", "Open buffer picker", ":Pick buffers<cr>", "mini.pick") -- File manager mapkey("n", "<leader>e", "Open file manager", ":lua MiniFiles.open()<cr>", "mini.files") + +-- Really delete +mapkey({"n", "v"}, "<leader>d", "Really delete", [["_d]]) +mapkey({"n", "v"}, "<leader>x", "Really delete character", [["_x]]) + +-- Visual Movement Keys. +mapkey({"n", "v"}, "j", "Go down visually", "gj") +mapkey({"n", "v"}, "k", "Go up visually", "gk") + +-- QOL Keys +mapkey("t", "<Esc><Esc>", "Exit terminal insert mode", "<C-\\><C-n>") +vim.keymap.set("c", "<cr>", function() + if vim.fn.pumvisible() == 1 then return '<c-y>' end + return '<cr>' +end, { expr = true }) -- Make enter complete command. +mapkey("n", "<esc>", "Clear highlights", ":noh<cr>") -- Make esc clear highlights diff --git a/pkgs/custom-neovim/config/lua/lsp.lua b/pkgs/custom-neovim/config/lua/lsp.lua index a4a25bc..5744280 100644 --- a/pkgs/custom-neovim/config/lua/lsp.lua +++ b/pkgs/custom-neovim/config/lua/lsp.lua @@ -1,19 +1,18 @@ -- Lua LS vim.lsp.config("lua_ls", { - cmd = { 'lua-language-server' }, - filetypes = { 'lua' }, - root_markers = { - '.luarc.json', - '.luarc.jsonc', - '.luacheckrc', - '.stylua.toml', - 'stylua.toml', - 'selene.toml', - 'selene.yml', - '.git', - }, - } -) + cmd = { 'lua-language-server' }, + filetypes = { 'lua' }, + root_markers = { + '.luarc.json', + '.luarc.jsonc', + '.luacheckrc', + '.stylua.toml', + 'stylua.toml', + 'selene.toml', + 'selene.yml', + '.git', + }, +}) vim.lsp.enable("lua_ls") -- LSP Autocommands @@ -32,13 +31,13 @@ vim.api.nvim_create_autocmd('LspAttach', { -- after the language server attaches to the current buffer vim.api.nvim_create_autocmd('LspAttach', { group = vim.api.nvim_create_augroup('UserLspConfig', {}), - callback = function(ev) + callback = function() -- Enable completion triggered by <c-x><c-o> -- vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc' local mapkey = function(mode, key, desc, action, plugin) - local keymapper = plugin and require("lz.n").keymap(plugin).set or vim.keymap.set - keymapper(mode, key, action, {noremap = true, silent = true, desc = desc}) + local keymapper = plugin and require("lz.n").keymap(plugin).set or vim.keymap.set + keymapper(mode, key, action, { noremap = true, silent = true, desc = desc }) end -- LSP Pickers @@ -55,11 +54,10 @@ vim.api.nvim_create_autocmd('LspAttach', { mapkey('n', 'gi', "Go to implementation", vim.lsp.buf.implementation) -- Other LSP Keys - mapkey('n', 'gs', "Signature Help", vim.lsp.buf.signature_help) - mapkey('n', 'gR', "Buffer References", vim.lsp.buf.references) - mapkey('n', 'gr', "Open ", vim.lsp.buf.references) - mapkey('n', '<leader>r', "Rename Symbol", vim.lsp.buf.rename) - mapkey('n', '<leader>h', "Format Buffer", function() + mapkey('n', 'gs', "Go to signature help", vim.lsp.buf.signature_help) + mapkey('n', 'gR', "Go to buffer references", vim.lsp.buf.references) + mapkey('n', '<leader>r', "Rename symbol", vim.lsp.buf.rename) + mapkey('n', '<leader>h', "Format buffer", function() vim.lsp.buf.format { async = true } end) end, diff --git a/pkgs/custom-neovim/config/lua/plugins/colorschemes.lua b/pkgs/custom-neovim/config/lua/plugins/colorschemes.lua index 1ca3c7e..a40da32 100644 --- a/pkgs/custom-neovim/config/lua/plugins/colorschemes.lua +++ b/pkgs/custom-neovim/config/lua/plugins/colorschemes.lua @@ -1,18 +1,8 @@ return { { "nightfox.nvim", - -- lazy = false, - event = "VimEnter", + lazy = false, after = function () - require("nightfox").setup { - options = { - module_default = false, - modules = { - "mini", - "treesitter", - }, - }, - } vim.cmd.colorscheme("carbonfox") end }, diff --git a/pkgs/custom-neovim/config/lua/plugins/comment.lua b/pkgs/custom-neovim/config/lua/plugins/comment.lua new file mode 100644 index 0000000..749e622 --- /dev/null +++ b/pkgs/custom-neovim/config/lua/plugins/comment.lua @@ -0,0 +1,7 @@ +return { + "comment.nvim", + lazy = false, + after = function() + require("Comment").setup() + end +} diff --git a/pkgs/custom-neovim/config/lua/plugins/git.lua b/pkgs/custom-neovim/config/lua/plugins/git.lua new file mode 100644 index 0000000..ce60214 --- /dev/null +++ b/pkgs/custom-neovim/config/lua/plugins/git.lua @@ -0,0 +1,26 @@ +return { + { + "mini.git", + lazy = false, + cmd = "Git", + after = function() + require("mini.git").setup() + end + }, + { + "mini.diff", + lazy = false, + after = function() + require("mini.diff").setup() + end + }, + { + "neogit", + lazy = true, + cmd = "Neogit", + after = function() + vim.cmd.packadd("plenary.nvim") + require("neogit").setup() + end + }, +} diff --git a/pkgs/custom-neovim/config/lua/plugins/mini-clue.lua b/pkgs/custom-neovim/config/lua/plugins/mini-clue.lua index 752b001..25c0866 100644 --- a/pkgs/custom-neovim/config/lua/plugins/mini-clue.lua +++ b/pkgs/custom-neovim/config/lua/plugins/mini-clue.lua @@ -1,5 +1,6 @@ return { "mini.clue", + lazy = true, event = "VimEnter", -- Load after everything else to capture all keybinds. after = function() local miniclue = require('mini.clue') @@ -53,5 +54,12 @@ return { scroll_up = "<C-u>", }, }) + -- Make clue appear in mini.files + vim.api.nvim_create_autocmd("User", { + pattern = "MiniFilesWindowOpen", + callback = function() + vim.cmd.lua("MiniClue.ensure_buf_triggers()") + end, + }) end } diff --git a/pkgs/custom-neovim/config/lua/plugins/mini-files.lua b/pkgs/custom-neovim/config/lua/plugins/mini-files.lua index d979221..948fcc4 100644 --- a/pkgs/custom-neovim/config/lua/plugins/mini-files.lua +++ b/pkgs/custom-neovim/config/lua/plugins/mini-files.lua @@ -1,6 +1,14 @@ return { "mini.files", + lazy = true, after = function() - require("mini.files").setup() + require("mini.files").setup { + mappings = { + close = "<esc>", + }, + windows = { + preview = true, + }, + } end } diff --git a/pkgs/custom-neovim/config/lua/plugins/mini-pairs.lua b/pkgs/custom-neovim/config/lua/plugins/mini-pairs.lua new file mode 100644 index 0000000..e799c50 --- /dev/null +++ b/pkgs/custom-neovim/config/lua/plugins/mini-pairs.lua @@ -0,0 +1,8 @@ +return { + "mini.pairs", + lazy = true, + event = "InsertEnter", + after = function() + require("mini.pairs").setup() + end +} diff --git a/pkgs/custom-neovim/config/lua/plugins/mini-pick.lua b/pkgs/custom-neovim/config/lua/plugins/mini-pick.lua index c08c1de..25f88de 100644 --- a/pkgs/custom-neovim/config/lua/plugins/mini-pick.lua +++ b/pkgs/custom-neovim/config/lua/plugins/mini-pick.lua @@ -1,5 +1,6 @@ return { "mini.pick", + lazy = true, cmd = "Pick", after = function() local win_config = function() diff --git a/pkgs/custom-neovim/config/lua/plugins/mini-statusline.lua b/pkgs/custom-neovim/config/lua/plugins/mini-statusline.lua index f3bf10b..36e268d 100644 --- a/pkgs/custom-neovim/config/lua/plugins/mini-statusline.lua +++ b/pkgs/custom-neovim/config/lua/plugins/mini-statusline.lua @@ -2,6 +2,30 @@ return { "mini.statusline", lazy = false, after = function() - require("mini.statusline").setup() + require("mini.statusline").setup { + content = { + active = function() + local mode, mode_hl = MiniStatusline.section_mode({ trunc_width = 120 }) + local git = MiniStatusline.section_git({ trunc_width = 40 }) + local diff = MiniStatusline.section_diff({ trunc_width = 75 }) + local diagnostics = MiniStatusline.section_diagnostics({ trunc_width = 75 }) + local lsp = MiniStatusline.section_lsp({ trunc_width = 75 }) + local filename = MiniStatusline.section_filename({ trunc_width = 140 }) + local fileinfo = MiniStatusline.section_fileinfo({ trunc_width = 120 }) + local location = MiniStatusline.section_location({ trunc_width = 75 }) + local search = MiniStatusline.section_searchcount({ trunc_width = 75 }) + + return MiniStatusline.combine_groups({ + { hl = mode_hl, strings = { mode } }, + { hl = 'MiniStatuslineDevinfo', strings = { git, diff, diagnostics, lsp } }, + '%<', -- Mark general truncate point + { hl = 'MiniStatuslineFilename', strings = { filename } }, + '%=', -- End left alignment + { hl = 'MiniStatuslineFileinfo', strings = { fileinfo } }, + { hl = mode_hl, strings = { search, location } }, + }) + end + }, + } end } |
