diff --git a/README.md b/README.md index 6a40af0..b20f766 100644 --- a/README.md +++ b/README.md @@ -37,60 +37,38 @@ rm -rf ~/.local/state/nvim ## NOTES/TODOS +FUTURE +- Make my own session save plugin, I ONLY want window positioning/open buffers saved nothing else. +- Make a new HTTP plugin for running curl commands from .http files + - similar to est-nvim/rest.nvim but support streaming etc and show command output +- Execute selected command and open output into a buffer/popup window? cx +- generate command, like scratch open a popup of things that can be generated. UUID/other stuff? +- https://github.com/mawkler/nvim/blob/06cde9dbaedab2bb36c06025c07589c93d2c6d6b/lua/configs/luasnip.lua#L37-L50 + +- TODO figure out tabs vs spaces thing with arrows vs bars. indent plugin... - Checkout cargo-bloat, cargo-cache, cargo-outdated - memcache sccache - For scratches, just make an input box for custom extension rather than predefined list -- for find files, ignore git, capital F for find all -- better copilot alternatives? Local LLM usage only? etc? -- generate command, like scratch open a popup of things that can be generated. UUID/other stuff? - - https://github.com/mawkler/nvim/blob/06cde9dbaedab2bb36c06025c07589c93d2c6d6b/lua/configs/luasnip.lua#L37-L50 -- TODO learn more about augroup in autocommands. +- TODO learn more about augroup in autocommands, apply to any other auto commands I have +- freaking learn to use surround more often https://github.com/tpope/vim-surround/tree/master - make my own session saving impl - Only save visible buffers/tabs/splits - per branch per directory - something like https://github.com/gennaro-tedesco/nvim-possession/tree/main but fully managed +- copilot? local llm? +- lsp +- null_ls replacements - plugins to install: - - uga-rosa/ccc.nvim - color picker for hex codes etc - - zbirenbaum/copilot.lua - - Does github's work for me now? github/copilot.vim - - zbirenbaum/copilot-cmp - - voldikss/vim-floaterm - - GIT - - lewis6991/gitsigns.nvim - - Neogitorg/neogit ??? remove? I dont use this much... - - kdheepak/lazygit.nvim ?? remove? - - sindrets/diffview.nvim ? as long as this works without the above. - - rest-nvim/rest.nvim - http curl commands - - TODO I want a better alternative to this. One that shows streaming responses/curl as is. Can I just run curl myself easily? - - RRethy/vim-illuminate - show token under cursor throughout file - - lukas-reineke/indent-blankline.nvim - indent lines - - TODO figure out tabs vs spaces thing with arrows vs bars. - LSP stuff... figure out from scratch using kickstart/lazynvim as an example - rust, ts, js, nix, lua, - lvimuser/lsp-inlayhints.nvim L3MON4D3/LuaSnip hrsh7th/nvim-cmp williamboman/mason.nvim folke/neodev.nvim williamboman/mason-lspconfig.nvim neovim/nvim-lspconfig simrat39/rust-tools.nvim Saecki/crates.nvim - how cna we do language specific tooling per project integrated with neovim here? Like different rust versions in current shell etc? - MASON when not nix, otherwise yes - - lnc3l0t/glow.nvim - markdown preview - null_ls replacement?? need a formater replacement, diff between lsp reformat? - cspell? vs built in spell check? - Lets use https://github.com/mfussenegger/nvim-lint - - Almo7aya/openingh.nvim - - tpope/vim-surround - - nvim-telescope/telescope-file-browser.nvim ?? do I want to keep this? - - johmsalas/text-case.nvim - - nvim-treesitter/nvim-treesitter - - mbbill/undotree - - nvim-lua/plenary.nvim - - folke/which-key.nvim - check out - https://github.com/onsails/lspkind.nvim - https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-align.md - -- plugins I decided to remove from my old config - - jinh0/eyeliner.nvim - - David-Kunz/gen.nvim - ollama integration - - Neogitorg/neogit ?? - - kdheepak/lazygit.nvim ?? - - null_ls diff --git a/flake.lock b/flake.lock index f8175ab..1f849e3 100644 --- a/flake.lock +++ b/flake.lock @@ -33,6 +33,22 @@ "type": "indirect" } }, + "nvim_plugin-Almo7aya/openingh.nvim": { + "flake": false, + "locked": { + "lastModified": 1710100117, + "narHash": "sha256-xGQdEO8Fjh4Tmv5WnYJFqaitH0wZnLlbYstwqsO0Oeg=", + "owner": "Almo7aya", + "repo": "openingh.nvim", + "rev": "613c18967d42202f3e2a9ac788caf62a402e7c1a", + "type": "github" + }, + "original": { + "owner": "Almo7aya", + "repo": "openingh.nvim", + "type": "github" + } + }, "nvim_plugin-JoosepAlviste/nvim-ts-context-commentstring": { "flake": false, "locked": { @@ -81,6 +97,22 @@ "type": "github" } }, + "nvim_plugin-RRethy/vim-illuminate": { + "flake": false, + "locked": { + "lastModified": 1713467568, + "narHash": "sha256-o0D1edrsHkaljrzBFZXjdxiK/5ziCGJxM/kYNJgBI1E=", + "owner": "RRethy", + "repo": "vim-illuminate", + "rev": "e522e0dd742a83506db0a72e1ced68c9c130f185", + "type": "github" + }, + "original": { + "owner": "RRethy", + "repo": "vim-illuminate", + "type": "github" + } + }, "nvim_plugin-catppuccin/nvim": { "flake": false, "locked": { @@ -177,6 +209,86 @@ "type": "github" } }, + "nvim_plugin-johmsalas/text-case.nvim": { + "flake": false, + "locked": { + "lastModified": 1708695777, + "narHash": "sha256-ROvmPMB3lMeehFtL7EsHGFkE+ZD9r/ines7yDmB+7Ag=", + "owner": "johmsalas", + "repo": "text-case.nvim", + "rev": "d62c63a4e9a996c7321885937ab89920fca2c1c8", + "type": "github" + }, + "original": { + "owner": "johmsalas", + "repo": "text-case.nvim", + "type": "github" + } + }, + "nvim_plugin-lewis6991/gitsigns.nvim": { + "flake": false, + "locked": { + "lastModified": 1714557033, + "narHash": "sha256-IpYpya8z6e8t9Lf/ZFx97HsnVwaYLZ44D5rCKvOyybA=", + "owner": "lewis6991", + "repo": "gitsigns.nvim", + "rev": "9cafac31a091267838e1e90fd6e083d37611f516", + "type": "github" + }, + "original": { + "owner": "lewis6991", + "repo": "gitsigns.nvim", + "type": "github" + } + }, + "nvim_plugin-lnc3l0t/glow.nvim": { + "flake": false, + "locked": { + "lastModified": 1693233815, + "narHash": "sha256-vdlwkIK2EkFviJmSiOqPWvc15xqJ9F2gHCC4ObJ5Qjk=", + "owner": "lnc3l0t", + "repo": "glow.nvim", + "rev": "5b38fb7b6e806cac62707a4aba8c10c5f14d5bb5", + "type": "github" + }, + "original": { + "owner": "lnc3l0t", + "repo": "glow.nvim", + "type": "github" + } + }, + "nvim_plugin-lukas-reineke/indent-blankline.nvim": { + "flake": false, + "locked": { + "lastModified": 1710388427, + "narHash": "sha256-Xp8ZQBz0in2MX3l0bnLUsSbH0lDPE+QvdmFpBFry5yY=", + "owner": "lukas-reineke", + "repo": "indent-blankline.nvim", + "rev": "3d08501caef2329aba5121b753e903904088f7e6", + "type": "github" + }, + "original": { + "owner": "lukas-reineke", + "repo": "indent-blankline.nvim", + "type": "github" + } + }, + "nvim_plugin-mbbill/undotree": { + "flake": false, + "locked": { + "lastModified": 1713305700, + "narHash": "sha256-UIroW89ALMRdxSkNGU2VPeuXJxR+25wJ+AakRcjwx/s=", + "owner": "mbbill", + "repo": "undotree", + "rev": "56c684a805fe948936cda0d1b19505b84ad7e065", + "type": "github" + }, + "original": { + "owner": "mbbill", + "repo": "undotree", + "type": "github" + } + }, "nvim_plugin-nvim-lua/plenary.nvim": { "flake": false, "locked": { @@ -337,6 +449,70 @@ "type": "github" } }, + "nvim_plugin-sindrets/diffview.nvim": { + "flake": false, + "locked": { + "lastModified": 1700506468, + "narHash": "sha256-3EdnBUka9Rh5Brl6TWpN6GlD9z32mmY3Ip+wyiKob/8=", + "owner": "sindrets", + "repo": "diffview.nvim", + "rev": "3dc498c9777fe79156f3d32dddd483b8b3dbd95f", + "type": "github" + }, + "original": { + "owner": "sindrets", + "repo": "diffview.nvim", + "type": "github" + } + }, + "nvim_plugin-tpope/vim-surround": { + "flake": false, + "locked": { + "lastModified": 1666730476, + "narHash": "sha256-DZE5tkmnT+lAvx/RQHaDEgEJXRKsy56KJY919xiH1lE=", + "owner": "tpope", + "repo": "vim-surround", + "rev": "3d188ed2113431cf8dac77be61b842acb64433d9", + "type": "github" + }, + "original": { + "owner": "tpope", + "repo": "vim-surround", + "type": "github" + } + }, + "nvim_plugin-uga-rosa/ccc.nvim": { + "flake": false, + "locked": { + "lastModified": 1714299582, + "narHash": "sha256-QRq9hQF5vLnOTzQGbOWC2ykMdMsQDlDlb6XC17dJG7Q=", + "owner": "uga-rosa", + "repo": "ccc.nvim", + "rev": "f388f1981d222967c741fe9927edf9ba5fa3bcbe", + "type": "github" + }, + "original": { + "owner": "uga-rosa", + "repo": "ccc.nvim", + "type": "github" + } + }, + "nvim_plugin-voldikss/vim-floaterm": { + "flake": false, + "locked": { + "lastModified": 1712535773, + "narHash": "sha256-wIgcBcdxJsT+qrsC5Boj6hp0xpp5gFeQFhK7yyC5a1o=", + "owner": "voldikss", + "repo": "vim-floaterm", + "rev": "4e28c8dd0271e10a5f55142fb6fe9b1599ee6160", + "type": "github" + }, + "original": { + "owner": "voldikss", + "repo": "vim-floaterm", + "type": "github" + } + }, "nvim_plugin-windwp/nvim-ts-autotag": { "flake": false, "locked": { @@ -357,15 +533,22 @@ "inputs": { "flake-utils": "flake-utils", "nixpkgs": "nixpkgs", + "nvim_plugin-Almo7aya/openingh.nvim": "nvim_plugin-Almo7aya/openingh.nvim", "nvim_plugin-JoosepAlviste/nvim-ts-context-commentstring": "nvim_plugin-JoosepAlviste/nvim-ts-context-commentstring", "nvim_plugin-MunifTanjim/nui.nvim": "nvim_plugin-MunifTanjim/nui.nvim", "nvim_plugin-Pocco81/auto-save.nvim": "nvim_plugin-Pocco81/auto-save.nvim", + "nvim_plugin-RRethy/vim-illuminate": "nvim_plugin-RRethy/vim-illuminate", "nvim_plugin-catppuccin/nvim": "nvim_plugin-catppuccin/nvim", "nvim_plugin-chrisgrieser/nvim-early-retirement": "nvim_plugin-chrisgrieser/nvim-early-retirement", "nvim_plugin-declancm/cinnamon.nvim": "nvim_plugin-declancm/cinnamon.nvim", "nvim_plugin-folke/lazy.nvim": "nvim_plugin-folke/lazy.nvim", "nvim_plugin-folke/noice.nvim": "nvim_plugin-folke/noice.nvim", "nvim_plugin-folke/which-key.nvim": "nvim_plugin-folke/which-key.nvim", + "nvim_plugin-johmsalas/text-case.nvim": "nvim_plugin-johmsalas/text-case.nvim", + "nvim_plugin-lewis6991/gitsigns.nvim": "nvim_plugin-lewis6991/gitsigns.nvim", + "nvim_plugin-lnc3l0t/glow.nvim": "nvim_plugin-lnc3l0t/glow.nvim", + "nvim_plugin-lukas-reineke/indent-blankline.nvim": "nvim_plugin-lukas-reineke/indent-blankline.nvim", + "nvim_plugin-mbbill/undotree": "nvim_plugin-mbbill/undotree", "nvim_plugin-nvim-lua/plenary.nvim": "nvim_plugin-nvim-lua/plenary.nvim", "nvim_plugin-nvim-lualine/lualine.nvim": "nvim_plugin-nvim-lualine/lualine.nvim", "nvim_plugin-nvim-telescope/telescope-fzf-native.nvim": "nvim_plugin-nvim-telescope/telescope-fzf-native.nvim", @@ -376,6 +559,10 @@ "nvim_plugin-preservim/nerdcommenter": "nvim_plugin-preservim/nerdcommenter", "nvim_plugin-rcarriga/nvim-notify": "nvim_plugin-rcarriga/nvim-notify", "nvim_plugin-rmagatti/auto-session": "nvim_plugin-rmagatti/auto-session", + "nvim_plugin-sindrets/diffview.nvim": "nvim_plugin-sindrets/diffview.nvim", + "nvim_plugin-tpope/vim-surround": "nvim_plugin-tpope/vim-surround", + "nvim_plugin-uga-rosa/ccc.nvim": "nvim_plugin-uga-rosa/ccc.nvim", + "nvim_plugin-voldikss/vim-floaterm": "nvim_plugin-voldikss/vim-floaterm", "nvim_plugin-windwp/nvim-ts-autotag": "nvim_plugin-windwp/nvim-ts-autotag" } }, diff --git a/flake.nix b/flake.nix index 48bb1cd..c1bb302 100644 --- a/flake.nix +++ b/flake.nix @@ -87,6 +87,50 @@ url = "github:nvim-tree/nvim-tree.lua"; flake = false; }; + "nvim_plugin-uga-rosa/ccc.nvim" = { + url = "github:uga-rosa/ccc.nvim"; + flake = false; + }; + "nvim_plugin-voldikss/vim-floaterm" = { + url = "github:voldikss/vim-floaterm"; + flake = false; + }; + "nvim_plugin-lewis6991/gitsigns.nvim" = { + url = "github:lewis6991/gitsigns.nvim"; + flake = false; + }; + "nvim_plugin-sindrets/diffview.nvim" = { + url = "github:sindrets/diffview.nvim"; + flake = false; + }; + "nvim_plugin-RRethy/vim-illuminate" = { + url = "github:RRethy/vim-illuminate"; + flake = false; + }; + "nvim_plugin-lukas-reineke/indent-blankline.nvim" = { + url = "github:lukas-reineke/indent-blankline.nvim"; + flake = false; + }; + "nvim_plugin-lnc3l0t/glow.nvim" = { + url = "github:lnc3l0t/glow.nvim"; + flake = false; + }; + "nvim_plugin-Almo7aya/openingh.nvim" = { + url = "github:Almo7aya/openingh.nvim"; + flake = false; + }; + "nvim_plugin-tpope/vim-surround" = { + url = "github:tpope/vim-surround"; + flake = false; + }; + "nvim_plugin-johmsalas/text-case.nvim" = { + url = "github:johmsalas/text-case.nvim"; + flake = false; + }; + "nvim_plugin-mbbill/undotree" = { + url = "github:mbbill/undotree"; + flake = false; + }; }; outputs = { self, nixpkgs, flake-utils, ... } @ inputs: @@ -120,7 +164,7 @@ fzf # search fuzzy # curl # http requests tree-sitter - # glow # markdown renderer + glow # markdown renderer # nodePackages.cspell ]; in diff --git a/init.lua b/init.lua index 7cd2124..ea59429 100644 --- a/init.lua +++ b/init.lua @@ -78,6 +78,7 @@ require("lazy").setup({ change_detection = { enabled = false, }, + defaults = { lazy = true, }, diff --git a/lua/autocommands.lua b/lua/autocommands.lua index 703665b..77d4b2a 100644 --- a/lua/autocommands.lua +++ b/lua/autocommands.lua @@ -9,44 +9,25 @@ vim.api.nvim_create_autocmd("TextYankPost", { end, }) ---function isEmpty() ---return vim.api.nvim_buf_get_name(0) == "" ---or vim.fn.filereadable(vim.api.nvim_buf_get_name(0)) == 0 ---or vim.fn.line("$") == 1 and vim.fn.col("$") == 1 ---end - ---vim.api.nvim_create_autocmd({ "VimEnter" }, { --- callback = function() --- if isEmpty() then --- require('telescope.builtin').find_files() --- end --- end ---}) - +-- TODO is there a better way for these? vim.api.nvim_create_autocmd("BufRead", { pattern = ".env*", command = "set filetype=sh", }) - vim.api.nvim_create_autocmd("BufRead", { pattern = ".*rc", command = "set filetype=sh", }) - vim.api.nvim_create_autocmd("BufRead", { pattern = "Dockerfile.*", command = "set filetype=dockerfile", }) +vim.api.nvim_create_autocmd("BufRead", { + pattern = "*.http", + command = "set filetype=http", +}) -if vim.fn.exists(":CccHighlighterEnable") ~= 0 then - vim.api.nvim_create_autocmd("BufRead", { - callback = function() - vim.cmd.CccHighlighterEnable() - end, - }) -end - --- AUto exit insert mode whenever we switch screens +-- Auto exit insert mode whenever we switch screens vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, { callback = function() if vim.bo.filetype ~= "TelescopePrompt" and vim.bo.filetype ~= nil and vim.bo.filetype ~= "" then @@ -55,18 +36,6 @@ vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, { end, }) -vim.api.nvim_create_autocmd({ "BufEnter" }, { - pattern = "*.http", - command = "set filetype=http", -}) - ---vim.api.nvim_create_autocmd('BufEnter', { --- callback = function () --- local ts_avail, parsers = pcall(require, "nvim-treesitter.parsers") --- if ts_avail and parsers.has_parser() then vim.cmd.TSBufEnable "highlight" end --- end, ---}) - vim.api.nvim_create_autocmd("VimLeavePre", { callback = function() vim.cmd("NvimTreeClose") diff --git a/lua/keymaps.lua b/lua/keymaps.lua index 2da3d3d..586482f 100644 --- a/lua/keymaps.lua +++ b/lua/keymaps.lua @@ -22,23 +22,23 @@ U.keymaps({ { ";", ":", desc = "No shift to enter command mode with semicolon. Alias ; to :", mode = nvx }, { "Q", "", mode = nvx }, -- don't do normal Q quit { "a", "ggVG", desc = "Select all", mode = nvx }, - { "Q", "qa", desc = "Quit all", mode = nvx }, + { "Q", "SessionSaveqa!", desc = "Quit all", mode = nvx }, { "y", '"+y', desc = "Copy to system clipboard", mode = nvx }, { "p", '"+p', desc = "Paste from system clipboard", mode = nvx }, - { "", "nohlsearch", desc = "Clear search on escape" }, - { "", "nohlsearch", desc = "Clear search on return" }, + { "", "nohlsearch", desc = "Clear search on escape" }, + { "", "nohlsearch", desc = "Clear search on return" }, { "|", "vsplit", desc = "Vertical Split" }, { "\\", "split", desc = "Horizontal Split" }, { "", "", desc = "Go back " }, { "J", - ":m '>+1gv=gv", + ":m '>+1gv=gv", desc = "Visually move block down", mode = "v", }, { "K", - ":m '<-2gv=gv", + ":m '<-2gv=gv", desc = "Visually move block up", mode = "v", }, @@ -53,7 +53,7 @@ U.keymaps({ -- * if non empty buffer, we will simply open a new empty buffer unless -- it is in the close always list -- * if empty buffer, then we will quit this buffer - local close_always = { "quickfix", "help", "nofile" } + local close_always = { "quickfix", "help", "nofile", "httpResult" } if U.table_contains(close_always, vim.bo.buftype) or (vim.api.nvim_buf_line_count(0) == 1 and vim.api.nvim_buf_get_lines(0, 0, 1, -1)[1] == "") diff --git a/lua/options.lua b/lua/options.lua index 56855bd..ba69a2d 100644 --- a/lua/options.lua +++ b/lua/options.lua @@ -27,6 +27,9 @@ vim.opt.hlsearch = false -- Wrap lines in files vim.opt.wrap = true +-- Keep signcolumn on by default +vim.opt.signcolumn = "yes" + -- preseve indentation of virtual wrapped lines vim.opt.breakindent = true @@ -49,7 +52,7 @@ vim.opt.undofile = true -- See `:help 'list'` -- and `:help 'listchars'` vim.opt.list = true -vim.opt.listchars = { tab = "» ", trail = "·", nbsp = "␣" } +vim.opt.listchars = { tab = "» ", trail = "·", nbsp = "␣", eol = "↴" } -- TODO REVISIT IF I WANT THESE -- Search settings diff --git a/lua/plugins/color_picker.lua b/lua/plugins/color_picker.lua new file mode 100644 index 0000000..9b43986 --- /dev/null +++ b/lua/plugins/color_picker.lua @@ -0,0 +1,16 @@ +return { + "uga-rosa/ccc.nvim", + event = "BufEnter", + opts = { auto_enable = true, lsp = true, point_char = "󰫢" }, + config = function(_, opts) + require("ccc").setup(opts) + vim.api.nvim_create_autocmd("BufRead", { + callback = function() + vim.cmd.CccHighlighterEnable() + end, + }) + end, + keys = { + { ",p", "CccPick", desc = "Color Picker", mode = { "n", "v", "x" } }, + }, +} diff --git a/lua/plugins/comments_support.lua b/lua/plugins/comments_support.lua index 97cab9f..466877f 100644 --- a/lua/plugins/comments_support.lua +++ b/lua/plugins/comments_support.lua @@ -21,6 +21,6 @@ return { vim.cmd("filetype plugin on") end, keys = { - { "/", "NERDCommenterTogglek", mode = { "n", "x" } }, + { "/", "NERDCommenterTogglek", mode = { "n", "x" }, desc = "Toggle comments on line/selection" }, }, } diff --git a/lua/plugins/editor_lua_line.lua b/lua/plugins/editor_lua_line.lua index 50cf5c6..a8f6124 100644 --- a/lua/plugins/editor_lua_line.lua +++ b/lua/plugins/editor_lua_line.lua @@ -1,4 +1,5 @@ -- TODO checkout https://github.com/nvim-lua/lsp-status.nvim +-- https://www.reddit.com/r/neovim/comments/o4bguk/comment/h2kcjxa/ local function lsp_clients() local clients = {} for _, client in pairs(vim.lsp.buf_get_clients(0)) do @@ -32,16 +33,23 @@ local function langs() return table.concat(l, " • "), " " end -local function latest_message() - return U.safeRequire("noice", function(n) - return n.api.status.message.get_hl - end, U.fnEmptyStr) -end +local last_blame = nil +local last_blame_time = vim.loop.now() +local function gitblame() + local d = vim.b.gitsigns_blame_line_dict -local function latest_message_cond() - return U.safeRequire("noice", function(n) - return n.api.status.message.has - end, U.fnFalse) + if d then + last_blame = d + last_blame_time = vim.loop.now() + elseif vim.loop.now() - last_blame_time <= 2000 then + d = last_blame + end + + if d then + local ok, res = pcall(os.date, "%d %b %y", d.committer_time) + return d.committer .. " - " .. (ok and res or d.committer_time) + end + return "" end return { @@ -61,7 +69,7 @@ return { lualine_c = { { "filename", separator = { right = "" } }, { "reg_recording", icon = { "󰻃" }, color = { fg = "#D37676" } }, - { latest_message, cond = latest_message_cond }, + { gitblame, color = { fg = "#696969" } }, }, lualine_x = { lsp_clients, diff --git a/lua/plugins/floatterm.lua b/lua/plugins/floatterm.lua new file mode 100644 index 0000000..53148b2 --- /dev/null +++ b/lua/plugins/floatterm.lua @@ -0,0 +1,12 @@ +return { + "voldikss/vim-floaterm", + cmd = { "FloatermToggle" }, + keys = { + { + "", + "FloatermToggle", + desc = "Toggle float terminal", + mode = { "n", "i", "v", "x", "c", "t" }, + }, + }, +} diff --git a/lua/plugins/git_diff.lua b/lua/plugins/git_diff.lua new file mode 100644 index 0000000..b7dcc8d --- /dev/null +++ b/lua/plugins/git_diff.lua @@ -0,0 +1,53 @@ +return { + "sindrets/diffview.nvim", + opts = { + diff_binaries = false, + enhanced_diff_hl = true, + git_cmd = { "git" }, + use_icons = true, + icons = { + folder_closed = "", + folder_open = "", + }, + signs = { + fold_closed = "", + fold_open = "", + }, + view = { + merge_tool = { + layout = "diff3_mixed", + disable_diagnostics = true, + }, + }, + file_panel = { + listing_style = "tree", + tree_options = { + flatten_dirs = true, + folder_statuses = "only_folded", + }, + win_config = { + position = "left", + width = 35, + }, + }, + file_history_panel = { + log_options = { + git = { + single_file = { + diff_merges = "combined", + }, + multi_file = { + diff_merges = "first-parent", + }, + }, + }, + win_config = { + position = "bottom", + height = 16, + }, + }, + }, + keys = { + { "gd", "DiffviewOpen", desc = "Opens git diff view." }, + }, +} diff --git a/lua/plugins/git_signs.lua b/lua/plugins/git_signs.lua new file mode 100644 index 0000000..e564ec9 --- /dev/null +++ b/lua/plugins/git_signs.lua @@ -0,0 +1,35 @@ +return { + "lewis6991/gitsigns.nvim", + event = "BufEnter", + dependencies = { "nvim-lua/plenary.nvim" }, + opts = function() + local highlight = U.highlight + highlight("GitGutterAdd", { fg = "#688066", gui = "nocombine" }) + highlight("GitGutterUntracked", { fg = "#688066", gui = "nocombine" }) + highlight("GitGutterChange", { fg = "#666f80", gui = "nocombine" }) + highlight("GitGutterDelete", { fg = "#806666", gui = "nocombine" }) + highlight("GitGutterChangeDelete", { fg = "#806666", gui = "nocombine" }) + + return { + watch_gitdir = { + interval = 100, + }, + signs = { + add = { hl = "GitGutterAdd" }, + change = { hl = "GitGutterChange" }, + delete = { hl = "GitGutterDelete" }, + topdelete = { hl = "GitGutterDelete" }, + changedelete = { hl = "GitGutterChangeDelete" }, + untracked = { hl = "GitGutterUntracked" }, + }, + current_line_blame = true, + current_line_blame_opts = { + delay = 0, + virt_text = false, + }, + } + end, + config = function(_, opts) + require("gitsigns").setup(opts) + end, +} diff --git a/lua/plugins/github_open.lua b/lua/plugins/github_open.lua new file mode 100644 index 0000000..d80790f --- /dev/null +++ b/lua/plugins/github_open.lua @@ -0,0 +1,9 @@ +return { + "Almo7aya/openingh.nvim", + cmd = { "OpenInGHFile", "OpenInGHFileLines" }, + keys = { + { "gf", "OpenInGHFile", desc = "Open in git" }, + { "gf", ":OpenInGHFileLines", desc = "Open in git", mode = { "v", "x" } }, + }, +} + diff --git a/lua/plugins/illuminate.lua b/lua/plugins/illuminate.lua new file mode 100644 index 0000000..6046f0a --- /dev/null +++ b/lua/plugins/illuminate.lua @@ -0,0 +1,9 @@ +-- This plugin will smartly highlight the token under the cursor. +return { + "RRethy/vim-illuminate", + event = "VeryLazy", + opts = {}, + config = function(_, opts) + require("illuminate").configure(opts) + end, +} diff --git a/lua/plugins/indent_indicators.lua b/lua/plugins/indent_indicators.lua new file mode 100644 index 0000000..23b5bed --- /dev/null +++ b/lua/plugins/indent_indicators.lua @@ -0,0 +1,49 @@ +return { + "lukas-reineke/indent-blankline.nvim", + event = "VeryLazy", + opts = { + scope = { + enabled = true, + char = "┊", + show_start = false, + show_end = false, + highlight = { + "IndentBlanklineScope1", + "IndentBlanklineScope2", + "IndentBlanklineScope3", + "IndentBlanklineScope4", + "IndentBlanklineScope5", + }, + }, + indent = { + char = "│", + highlight = { + "IndentBlanklineIndent1", + "IndentBlanklineIndent2", + "IndentBlanklineIndent3", + "IndentBlanklineIndent4", + "IndentBlanklineIndent5", + }, + }, + }, + config = function(_, opts) + U.highlight("NonText", { fg = "#303030", gui = "nocombine" }) + + local hooks = require("ibl.hooks") + hooks.register(hooks.type.HIGHLIGHT_SETUP, function() + vim.api.nvim_set_hl(0, "IndentBlanklineIndent1", { fg = "#915053" }) + vim.api.nvim_set_hl(0, "IndentBlanklineIndent2", { fg = "#A27F3E" }) + vim.api.nvim_set_hl(0, "IndentBlanklineIndent3", { fg = "#6B7F6E" }) + vim.api.nvim_set_hl(0, "IndentBlanklineIndent4", { fg = "#5a74aa" }) + vim.api.nvim_set_hl(0, "IndentBlanklineIndent5", { fg = "#6B6282" }) + + vim.api.nvim_set_hl(0, "IndentBlanklineScope1", { fg = "#CB5D60" }) + vim.api.nvim_set_hl(0, "IndentBlanklineScope2", { fg = "#DEA93F" }) + vim.api.nvim_set_hl(0, "IndentBlanklineScope3", { fg = "#89B790" }) + vim.api.nvim_set_hl(0, "IndentBlanklineScope4", { fg = "#6289E5" }) + vim.api.nvim_set_hl(0, "IndentBlanklineScope5", { fg = "#917DC0" }) + end) + + require("ibl").setup(opts) + end, +} diff --git a/lua/plugins/markdown_glow.lua b/lua/plugins/markdown_glow.lua new file mode 100644 index 0000000..dfea216 --- /dev/null +++ b/lua/plugins/markdown_glow.lua @@ -0,0 +1,10 @@ +return { + "lnc3l0t/glow.nvim", + opts = { + default_type = "keep", + }, + cmd = "Glow", + keys = { + { ",m", "Glow", desc = "Markdown preview" }, + }, +} diff --git a/lua/plugins/session.lua b/lua/plugins/session.lua index 61030f7..adf9368 100644 --- a/lua/plugins/session.lua +++ b/lua/plugins/session.lua @@ -2,7 +2,7 @@ return { "rmagatti/auto-session", lazy = false, init = function() - vim.o.sessionoptions = "blank,buffers,curdir,folds,tabpages,winsize,winpos,terminal,localoptions" + vim.o.sessionoptions = "blank,buffers,curdir,folds,tabpages,winsize,winpos,terminal" end, opts = { auto_session_use_git_branch = true, diff --git a/lua/plugins/surround.lua b/lua/plugins/surround.lua new file mode 100644 index 0000000..b9e1e0c --- /dev/null +++ b/lua/plugins/surround.lua @@ -0,0 +1,4 @@ +return { + "tpope/vim-surround", + event = "VeryLazy", +} diff --git a/lua/plugins/text_case.lua b/lua/plugins/text_case.lua new file mode 100644 index 0000000..4b35e81 --- /dev/null +++ b/lua/plugins/text_case.lua @@ -0,0 +1,25 @@ +return { + "johmsalas/text-case.nvim", + dependencies = { "nvim-telescope/telescope.nvim" }, + cmd = "TextCaseOpenTelescope", + config = function(_, opts) + require("textcase").setup(opts) + require("telescope").load_extension("textcase") + end, + keys = { + { + ",c", + function() + if next(vim.lsp.buf_get_clients()) ~= nil then + -- TODO test that this works + vim.cmd("TextCaseOpenTelescopeLSPChange") + else + vim.cmd("TextCaseOpenTelescope") + end + end, + desc = "Change case of selection", + mode = { "n", "v", "x" }, + silent = true, -- TODO add this to most things.... + }, + }, +} diff --git a/lua/plugins/undotree.lua b/lua/plugins/undotree.lua new file mode 100644 index 0000000..d3d1ccc --- /dev/null +++ b/lua/plugins/undotree.lua @@ -0,0 +1,6 @@ +return { + "mbbill/undotree", + keys = { + { "u", vim.cmd.UndotreeToggle, desc = "Undo Tree Toggle" }, + }, +} diff --git a/lua/plugins/whichkey.lua b/lua/plugins/whichkey.lua index 50ffe1a..f7d186e 100644 --- a/lua/plugins/whichkey.lua +++ b/lua/plugins/whichkey.lua @@ -15,15 +15,15 @@ return { local wk = require("which-key") wk.setup(opts) wk.register({ - ["b"] = { name = "Buffers" }, - ["t"] = { name = "Tabs" }, - -- [","] = { name = "Miscellaneous Tools" }, + ["b"] = { name = "Buffers", mode = { "n", "x", "v", "c" } }, + ["t"] = { name = "Tabs", mode = { "n", "x", "v", "c" } }, + [","] = { name = "Miscellaneous Tools", mode = { "n", "x", "v", "c" } }, -- ["c"] = { name = "Copilot" }, - ["f"] = { name = "Find [Telescope]" }, + ["f"] = { name = "Find [Telescope]", mode = { "n", "x", "v", "c" } }, -- ["fs"] = { name = "Find in Scratches [Telescope]" }, - -- ["g"] = { name = "Git" }, - ["l"] = { name = "LSP" }, - ["lf"] = { name = "LSP Find" }, + ["g"] = { name = "Git", mode = { "n", "x", "v", "c" } }, + ["l"] = { name = "LSP", mode = { "n", "x", "v", "c" } }, + ["lf"] = { name = "LSP Find", mode = { "n", "x", "v", "c" } }, -- ["Q"] = { name = "+Q Quit and remove session" }, -- ["s"] = { name = "Scratch Files" }, -- ["x"] = { name = "Generative AI, Ollama" }, diff --git a/lua/util.lua b/lua/util.lua index 46d0edb..1e481fc 100644 --- a/lua/util.lua +++ b/lua/util.lua @@ -128,6 +128,18 @@ function M.safeRequire(module, func, errorFunc) return nil end +-- TODO remove if not needed +-- local startup_time = vim.loop.now() +-- function M.delayFromStartup(delay, func) +-- local current_time = vim.loop.now() +-- local diff = current_time - startup_time +-- if diff >= delay then +-- func() +-- else +-- vim.defer_fn(func, (delay - diff)) +-- end +-- end + function M.fnFalse() return false end