From d463a7b8c910ecf6cfc9316deedd3a19d6ff563b Mon Sep 17 00:00:00 2001 From: lew Date: Mon, 3 Nov 2025 03:10:38 +0000 Subject: [PATCH] Update .config/nvim/init.lua Update .config/nvim/lazy-lock.json Update .config/nvim/lua/config/10_opts.lua Update .config/nvim/lua/config/20_keymaps.lua Update .config/nvim/lua/plugin/00_colorscheme.lua Update .config/nvim/lua/plugin/01_whichkey.lua Update .config/nvim/lua/plugin/03_treesitter.lua Update .config/nvim/lua/plugin/05_fzf.lua Update .config/nvim/lua/plugin/15_lsp.lua Add .config/nvim/lua/plugin/25_git.lua Add .config/nvim/lua/plugin/30_formatting.lua Add .config/nvim/stylua.toml --- private_dot_config/nvim/init.lua | 3 +- private_dot_config/nvim/lazy-lock.json | 6 ++ .../nvim/lua/config/10_opts.lua | 81 ++++++++++--------- .../nvim/lua/config/20_keymaps.lua | 15 ++-- .../nvim/lua/plugin/00_colorscheme.lua | 18 +++-- .../nvim/lua/plugin/01_whichkey.lua | 30 +++++-- .../nvim/lua/plugin/03_treesitter.lua | 7 ++ private_dot_config/nvim/lua/plugin/05_fzf.lua | 28 +++++-- private_dot_config/nvim/lua/plugin/15_lsp.lua | 17 +++- private_dot_config/nvim/lua/plugin/25_git.lua | 5 ++ .../nvim/lua/plugin/30_formatting.lua | 39 +++++++++ private_dot_config/nvim/stylua.toml | 4 + 12 files changed, 181 insertions(+), 72 deletions(-) create mode 100644 private_dot_config/nvim/lua/plugin/25_git.lua create mode 100644 private_dot_config/nvim/lua/plugin/30_formatting.lua create mode 100644 private_dot_config/nvim/stylua.toml diff --git a/private_dot_config/nvim/init.lua b/private_dot_config/nvim/init.lua index faa6a31..3c8b303 100644 --- a/private_dot_config/nvim/init.lua +++ b/private_dot_config/nvim/init.lua @@ -11,12 +11,13 @@ -- ├── plugin/ Plugins for lazy.nvim are in here -- ├──── 00_colorscheme.lua Sets theme -- ├──── 01_whichkey.lua Displays keymaps on input --- ├──── 02_sleuth.lua Auto-adjusting shiftwidth and expandtab based on current file -- ├──── 03_treesitter.lua Does anybody know what this does? -- ├──── 05_fzf.lua Pickers with fzf-lua -- ├──── 10_hop.lua Enables hopping to words in the current buffer -- ├──── 15_lsp.lua Mason, LSP configurations -- ├──── 20_completion.lua Autocompletion with blink.cmp, and mini.snippets +-- ├──── 25_git.lua Gitsigns +-- ├──── 30_formatting.lua vim-sleuth and conform formatting configs -- ├ snippets/ Snippets definitions are in here -- ├── package.json Snippet repository metadata -- ├── global.json Global text snippets diff --git a/private_dot_config/nvim/lazy-lock.json b/private_dot_config/nvim/lazy-lock.json index 3a4f39e..1b298e6 100644 --- a/private_dot_config/nvim/lazy-lock.json +++ b/private_dot_config/nvim/lazy-lock.json @@ -1,18 +1,24 @@ { "blink.cmp": { "branch": "main", "commit": "327fff91fe6af358e990be7be1ec8b78037d2138" }, + "conform.nvim": { "branch": "master", "commit": "02736cf359a3235c6d7d601a2f6bdc909e557513" }, "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, "fzf-lua": { "branch": "main", "commit": "a8458b79a957a6e3e217d84106a0fd4b9470ff4c" }, + "gitsigns.nvim": { "branch": "main", "commit": "20ad4419564d6e22b189f6738116b38871082332" }, "helix-nvim": { "branch": "main", "commit": "c2875fb19df7f3624d0ae1c82b063fc14de1d64b" }, "hop.nvim": { "branch": "master", "commit": "08ddca799089ab96a6d1763db0b8adc5320bf050" }, "lazy.nvim": { "branch": "main", "commit": "db067881fff0fd4be8c00e5bde7492e0e1c77a2f" }, + "lazydev.nvim": { "branch": "main", "commit": "371cd7434cbf95606f1969c2c744da31b77fcfa6" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "d7b5feb6e769e995f7fcf44d92f49f811c51d10c" }, "mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" }, "mini.icons": { "branch": "main", "commit": "284798619aed9f4c1ac1b9417b9a5e3b4b85ef3a" }, "mini.pairs": { "branch": "main", "commit": "b9aada8c0e59f2b938e98fbf4eae0799eba96ad9" }, "mini.snippets": { "branch": "main", "commit": "7610dc3aaf7fb09b9cc428273a8ba15ef8aef495" }, + "nvim-colorizer.lua": { "branch": "master", "commit": "81e676d3203c9eb6e4c0ccf1eba1679296ef923f" }, "nvim-lspconfig": { "branch": "master", "commit": "a89bfcfd0e44f898341ac8a80ba83ccf6218bef3" }, "nvim-scissors": { "branch": "main", "commit": "9b4fc66427568b2139480fcc645dd7bb91884ade" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-treesitter-context": { "branch": "master", "commit": "ec308c7827b5f8cb2dd0ad303a059c945dd21969" }, + "trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" }, "vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" }, "which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" } } diff --git a/private_dot_config/nvim/lua/config/10_opts.lua b/private_dot_config/nvim/lua/config/10_opts.lua index b2025f4..3e961c9 100644 --- a/private_dot_config/nvim/lua/config/10_opts.lua +++ b/private_dot_config/nvim/lua/config/10_opts.lua @@ -1,41 +1,42 @@ -- 10_opts.lua --- General ================================= -vim.g.mapleader = ' ' -vim.o.mouse = '' -vim.o.mousescroll = 'ver:25,hor:6' -vim.o.switchbuf = 'usetab' -vim.o.undofile = true --- UI ====================================== -vim.o.breakindent = true -vim.o.breakindentopt = 'list:-1' -vim.o.colorcolumn = '+1' -vim.o.cursorline = true -vim.o.linebreak = true -vim.o.list = true -vim.o.relativenumber = true -vim.o.pumheight = 10 -vim.o.ruler = false -vim.o.signcolumn = 'yes' -vim.o.splitbelow = true -vim.o.splitright = true -vim.o.winborder = 'single' -vim.o.wrap = false -vim.o.cursorlineopt = 'screenline,number' --- Folds =================================== -vim.o.foldlevel = 10 -vim.o.foldmethod = 'indent' -vim.o.foldnestmax = 10 -vim.o.foldtext = '' --- Editing ================================= -vim.o.autoindent = true -vim.o.expandtab = true -vim.o.ignorecase = true -vim.o.incsearch = true -vim.o.infercase = true -vim.o.smartcase = true -vim.o.smartindent = true -vim.o.virtualedit = 'block' -vim.o.iskeyword = '@,48-57,_,192-255,-' -vim.o.tabstop = 2 -vim.o.shiftwidth = 2 - +-- General =================================== +vim.g.mapleader = " " +vim.o.mouse = "" +vim.o.mousescroll = "ver:25,hor:6" +vim.o.switchbuf = "usetab" +vim.o.undofile = true +-- UI ======================================== +vim.o.breakindent = true +vim.o.breakindentopt = "list:-1" +vim.o.colorcolumn = "+1" +vim.o.cursorline = true +vim.o.linebreak = true +vim.o.list = true +vim.o.relativenumber = true +vim.o.pumheight = 10 +vim.o.ruler = false +vim.o.signcolumn = "yes" +vim.o.splitbelow = true +vim.o.splitright = true +vim.o.winborder = "single" +vim.o.wrap = false +vim.o.cursorlineopt = "screenline,number" +-- Folds ===================================== +vim.o.foldlevel = 10 +vim.o.foldmethod = "indent" +vim.o.foldnestmax = 10 +vim.o.foldtext = "" +-- Editing =================================== +vim.o.autoindent = true +vim.o.expandtab = true +vim.o.ignorecase = true +vim.o.incsearch = true +vim.o.infercase = true +vim.o.smartcase = true +vim.o.smartindent = true +vim.o.virtualedit = "block" +vim.o.iskeyword = "@,48-57,_,192-255,-" +vim.o.tabstop = 2 +vim.o.shiftwidth = 2 +-- Diagnostic ================================ +vim.diagnostic.config({ virtual_text = true }) diff --git a/private_dot_config/nvim/lua/config/20_keymaps.lua b/private_dot_config/nvim/lua/config/20_keymaps.lua index caac947..75d2d9e 100644 --- a/private_dot_config/nvim/lua/config/20_keymaps.lua +++ b/private_dot_config/nvim/lua/config/20_keymaps.lua @@ -2,12 +2,17 @@ -- Helpers ==================================================== local nmap = function(lhs, rhs, desc) - vim.keymap.set('n', lhs, rhs, { desc = desc }) + vim.keymap.set("n", lhs, rhs, { desc = desc }) end local nmap_leader = function(lhs, rhs, desc) - vim.keymap.set('n', '' .. lhs, rhs, { desc = desc }) + vim.keymap.set("n", "" .. lhs, rhs, { desc = desc }) end -- Keymaps ==================================================== -nmap('[p', 'exe "put! " . v:register', 'Paste above') -nmap(']p', 'exe "put " . v:register', 'Paste below') -nmap_leader('ei', 'edit $MYVIMRC', 'init.lua') +-- stylua: ignore start +nmap('[p', 'exe "put! " . v:register', 'put above') +nmap(']p', 'exe "put " . v:register', 'put below') +nmap_leader('ei', 'edit $MYVIMRC', 'init.lua') +nmap_leader('aa', 'lua vim.lsp.buf.code_action()', 'lsp code action') +nmap_leader('ar', 'lua vim.lsp.buf.rename()', 'lsp rename') +nmap_leader('fi', 'lua vim.lsp.buf.implementation()', 'lsp find implementation') +nmap_leader('fr', 'lua vim.lsp.buf.references()', 'lsp find references') diff --git a/private_dot_config/nvim/lua/plugin/00_colorscheme.lua b/private_dot_config/nvim/lua/plugin/00_colorscheme.lua index bad6ab5..98644bd 100644 --- a/private_dot_config/nvim/lua/plugin/00_colorscheme.lua +++ b/private_dot_config/nvim/lua/plugin/00_colorscheme.lua @@ -1,8 +1,14 @@ return { - { - 'oneslash/helix-nvim', version = "*", - config = function () - vim.cmd.colorscheme("helix") - end, - } + { + "oneslash/helix-nvim", + vsersion = "*", + config = function() + vim.cmd.colorscheme("helix") + end, + }, + { + "catgoose/nvim-colorizer.lua", + event = "BufReadPre", + opts = {}, + }, } diff --git a/private_dot_config/nvim/lua/plugin/01_whichkey.lua b/private_dot_config/nvim/lua/plugin/01_whichkey.lua index 2536d60..51fa17f 100644 --- a/private_dot_config/nvim/lua/plugin/01_whichkey.lua +++ b/private_dot_config/nvim/lua/plugin/01_whichkey.lua @@ -1,18 +1,32 @@ return { { - 'folke/which-key.nvim', + "folke/which-key.nvim", event = "VeryLazy", opts = { preset = "helix", - delay = function(ctx) return ctx.plugin and 0 or 20 end, - spec = { - { "f", group = "fzf" }, - { "s", group = "snippet" }, - { "e", group = "edit config" }, + delay = function(ctx) + return ctx.plugin and 0 or 20 + end, + spec = { + { "f", group = "find" }, + { "a", group = "lsp action" }, + { "s", group = "snippet" }, + { "e", group = "edit config" }, }, }, keys = { - { "?", function() require("which-key").show({ global = true }) end, desc = "buffer local keymaps" } - } + { + "?", + function() + require("which-key").show({ global = true }) + end, + desc = "buffer local keymaps", + }, + }, + }, + { + "folke/trouble.nvim", + dependencies = { "mini-nvim/mini.icons" }, + opts = {}, }, } diff --git a/private_dot_config/nvim/lua/plugin/03_treesitter.lua b/private_dot_config/nvim/lua/plugin/03_treesitter.lua index e6724b0..bf17eeb 100644 --- a/private_dot_config/nvim/lua/plugin/03_treesitter.lua +++ b/private_dot_config/nvim/lua/plugin/03_treesitter.lua @@ -5,4 +5,11 @@ return { lazy = false, build = ":TSUpdate" }, + { + 'nvim-treesitter/nvim-treesitter-context', + dependencies = { 'nvim-treesitter/nvim-treesitter' }, + config = function() + require("treesitter-context").setup() + end, + } } diff --git a/private_dot_config/nvim/lua/plugin/05_fzf.lua b/private_dot_config/nvim/lua/plugin/05_fzf.lua index 43ea116..e85a34c 100644 --- a/private_dot_config/nvim/lua/plugin/05_fzf.lua +++ b/private_dot_config/nvim/lua/plugin/05_fzf.lua @@ -1,19 +1,31 @@ return { { - 'ibhagwan/fzf-lua', - dependencies = { { 'nvim-mini/mini.icons' }, }, - opts = { + "ibhagwan/fzf-lua", + dependencies = { { "nvim-mini/mini.icons" } }, + epts = { winopts = { preview = { vertical = "down:65%", - flip_columns = 120 - } + flip_columns = 120, + }, }, - files = { git_icons = true, }, + files = { git_icons = true }, }, + -- stylua: ignore keys = { - { "f", "FzfLua global", mode = { "n" }, desc = "Fzf everything" }, - { "fg", "FzfLua global", mode = { "n" }, desc = "Fzf everything" }, + { 'f"', "FzfLua registers", mode = { "n" }, desc = "fzf registers" }, + { "fb", "FzfLua buffers", mode = { "n" }, desc = "fzf buffers" }, + { "fc", "FzfLua commands", mode = { "n" }, desc = "fzf commands" }, + { "fe", "FzfLua changes", mode = { "n" }, desc = "fzf edits" }, + { "ff", "FzfLua files", mode = { "n" }, desc = "fzf files" }, + { "fg", "FzfLua live_grep", mode = { "n" }, desc = "fzf grep" }, + { "fh", "FzfLua command_history", mode = { "n" }, desc = "fzf cmd history" }, + -- fi --> lsp find implementation + { "fk", "FzfLua keymaps", mode = { "n" }, desc = "fzf keymaps" }, + { "fl", "FzfLua blines", mode = { "n" }, desc = "fzf bufferlines" }, + { "fo", "FzfLua oldfiles", mode = { "n" }, desc = "fzf oldfiles" }, + -- fr --> lsp find references + { "fs", "FzfLua", mode = { "n" }, desc = "fzf something else" }, }, }, } diff --git a/private_dot_config/nvim/lua/plugin/15_lsp.lua b/private_dot_config/nvim/lua/plugin/15_lsp.lua index e2f8d12..ec2a1cc 100644 --- a/private_dot_config/nvim/lua/plugin/15_lsp.lua +++ b/private_dot_config/nvim/lua/plugin/15_lsp.lua @@ -1,10 +1,19 @@ return { { - 'mason-org/mason-lspconfig.nvim', + "mason-org/mason-lspconfig.nvim", opts = {}, dependencies = { - { 'mason-org/mason.nvim', opts = {} }, - { 'neovim/nvim-lspconfig' }, - } + { "mason-org/mason.nvim", opts = {} }, + { "neovim/nvim-lspconfig" }, + { + "folke/lazydev.nvim", + ft = "lua", + opts = { + library = { + { path = "${3rd}/luv/library", words = { "vim%.uv" } }, + }, + }, + }, + }, }, } diff --git a/private_dot_config/nvim/lua/plugin/25_git.lua b/private_dot_config/nvim/lua/plugin/25_git.lua new file mode 100644 index 0000000..9849ee1 --- /dev/null +++ b/private_dot_config/nvim/lua/plugin/25_git.lua @@ -0,0 +1,5 @@ +return { + { + 'lewis6991/gitsigns.nvim', + }, +} diff --git a/private_dot_config/nvim/lua/plugin/30_formatting.lua b/private_dot_config/nvim/lua/plugin/30_formatting.lua new file mode 100644 index 0000000..2a925fb --- /dev/null +++ b/private_dot_config/nvim/lua/plugin/30_formatting.lua @@ -0,0 +1,39 @@ +return { + { + "tpope/vim-sleuth", + }, + { + "stevearc/conform.nvim", + event = { "BufWritePre" }, + cmd = { "ConformInfo" }, + keys = { + { + "af", + function() + require("conform").format({ async = true }) + end, + mode = "", + desc = "format buffer", + }, + }, + opts = { + formatters_by_ft = { + lua = { "stylua" }, + python = { "isort", "black" }, + javascript = { "prettierd", "prettier", stop_after_first = true }, + }, + default_format_opts = { + lsp_format = "fallback", + }, + format_on_save = { timeout_ms = 500 }, + formatters = { + shfmt = { + append_args = { "-i", "2" }, + }, + }, + }, + init = function() + vim.o.formatexpr = "v:lua.require'conform'.formatexpr()" + end, + }, +} diff --git a/private_dot_config/nvim/stylua.toml b/private_dot_config/nvim/stylua.toml new file mode 100644 index 0000000..2600da7 --- /dev/null +++ b/private_dot_config/nvim/stylua.toml @@ -0,0 +1,4 @@ +column_width = 80 +indent_type = "Spaces" +quote_style = "AutoPreferDouble" +indent_width = 2