From f76340f1452ea42c65d954c922fc07e89b5de772 Mon Sep 17 00:00:00 2001 From: Matei Adriel Date: Wed, 30 Aug 2023 13:08:50 +0300 Subject: [PATCH] Tweaked vim config a bunch --- dotfiles/neovim/README.md | 38 ++++---- dotfiles/neovim/lazy-lock.json | 8 +- dotfiles/neovim/lua/my/plugins/dashboard.lua | 96 ++++++++++++------- dotfiles/neovim/lua/my/plugins/init.lua | 60 +++--------- .../my/plugins/{files.lua => mini-files.lua} | 10 +- .../neovim/lua/my/plugins/mini-operators.lua | 8 ++ .../{surround.lua => mini-surround.lua} | 0 7 files changed, 107 insertions(+), 113 deletions(-) rename dotfiles/neovim/lua/my/plugins/{files.lua => mini-files.lua} (69%) create mode 100644 dotfiles/neovim/lua/my/plugins/mini-operators.lua rename dotfiles/neovim/lua/my/plugins/{surround.lua => mini-surround.lua} (100%) diff --git a/dotfiles/neovim/README.md b/dotfiles/neovim/README.md index a9c1b30..2b43384 100644 --- a/dotfiles/neovim/README.md +++ b/dotfiles/neovim/README.md @@ -66,17 +66,16 @@ I feel like macro recording is a rare thing, so I moved it to `yq/yQ`. This free The `f` namespace contains keybinds which search for a specific filetype. -| Keybind | Description | Plugins | -| ----------- | ------------------------ | ---------------------- | -| C-p | Find files | | -| C-f | Grep in project | | -| C-F | Interactive file broswer | telescope-file-browser | -| \d | Diagnostics | lspconfig | -| \t | Show builtin pickers | | -| \ft | Typescript Files | | -| \fl | Latex Files | | -| \fp | Purescript Files | | -| \fn | Nix Files | | +| Keybind | Description | Plugins | +| ----------- | -------------------- | --------- | +| C-p | Find files | | +| C-f | Grep in project | | +| \d | Diagnostics | lspconfig | +| \t | Show builtin pickers | | +| \ft | Typescript Files | | +| \fl | Latex Files | | +| \fp | Purescript Files | | +| \fn | Nix Files | | ### Cmp @@ -204,13 +203,16 @@ The following keybinds are available only when running inside firenvim: | gc | Comment selection | nvim-comment | | C-g | Open neo[g]it | neogit | | \yg | [Y]ank remote [g]it url | gitlinker | -| cs[a][b] | Change surrounding pair from a to b | vim-surround | -| ds[a] | Delete surrounding pair of a | vim-surround | -| ys[m][a] | Surround the motion m with a | vim-surround | -| S[a] | Surround selected code with a | vim-surround | -| s | Initialize forward [s]earch | leap | -| S | Initialize backwards [s]earch | leap | -| gs | Initialize other window [s]earch | leap | +| r[a][b] | Change surrounding pair from a to b | mini.surround | +| d[a] | Delete surrounding pair of a | mini.surround | +| s[m][a] | Surround the motion m with a | mini.surround | +| s[a] | Surround selected code with a | mini.surround | +| C-F | Interactive file broswer | mini.files | +| s | Flash [s]earch | flash | +| S | Flash treesitter [s]elect | flash | +| r | remote [f]lash | flash | +| R | remote treesitter [f]lash | flash | +| C-s | Toggle flash [s]earch | flash | | C-n | Open filetree | nvim-tree | | \p | [P]aste imge from clipboard | clipboard-image.nvim | | \L | [L]azy ui | lazy.nvim | diff --git a/dotfiles/neovim/lazy-lock.json b/dotfiles/neovim/lazy-lock.json index de0d124..f48df31 100644 --- a/dotfiles/neovim/lazy-lock.json +++ b/dotfiles/neovim/lazy-lock.json @@ -1,7 +1,6 @@ { "LuaSnip": { "branch": "master", "commit": "409535b8fc54c650eb845b0c35e0cc7f08810284" }, - "abbreinder.nvim": { "branch": "main", "commit": "5b2b5ff08a9ada42238d733aeebc6d3d96314d77" }, - "abbremand.nvim": { "branch": "main", "commit": "d633341f632b0b2666dfc6dfe6b9842ba1610a1d" }, + "alpha-nvim": { "branch": "main", "commit": "63a860e7ed3ae41ee92481ea65a48fb35431ae21" }, "catppuccin": { "branch": "main", "commit": "490078b1593c6609e6a50ad5001e7902ea601824" }, "clipboard-image.nvim": { "branch": "main", "commit": "af8fdaad7e6fed0741e18dbf2f57bdc7494adaee" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, @@ -11,14 +10,12 @@ "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, "crates.nvim": { "branch": "main", "commit": "d5caf28aba49e81ac4099426231f3cf3c151013a" }, - "dashboard-nvim": { "branch": "master", "commit": "c17d3210b3dec8798b4fc82a11c542989251f85d" }, "dhall-vim": { "branch": "master", "commit": "68500ef46ff3706f46c99db3be7a0c8abcf6a3ae" }, "dressing.nvim": { "branch": "master", "commit": "6bde51adabba06f7fd4a469885a85f36d78a5f52" }, "fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" }, "flash.nvim": { "branch": "main", "commit": "967117690bd677cb7b6a87f0bc0077d2c0be3a27" }, "github-actions-yaml.vim": { "branch": "master", "commit": "f2f16243447cea174daa6b4a9ffd3ff9213814ef" }, "gitlinker.nvim": { "branch": "master", "commit": "cc59f732f3d043b626c8702cb725c82e54d35c25" }, - "glow.nvim": { "branch": "main", "commit": "8942dfb05794f436af4fbc90a34393f1fd36f361" }, "harpoon": { "branch": "master", "commit": "21f4c47c6803d64ddb934a5b314dcb1b8e7365dc" }, "hydra.nvim": { "branch": "master", "commit": "3ced42c0b6a6c85583ff0f221635a7f4c1ab0dd0" }, "hyprland-vim-syntax": { "branch": "main", "commit": "8488a24b50882da969979103b4d668c70e7995b9" }, @@ -27,7 +24,6 @@ "iron.nvim": { "branch": "master", "commit": "7f876ee3e1f4ea1e5284b1b697cdad5b256e8046" }, "jupytext.vim": { "branch": "master", "commit": "32c1e37b2edf63a7e38d0deb92cc3f1462cc4dcd" }, "kmonad-vim": { "branch": "master", "commit": "37978445197ab00edeb5b731e9ca90c2b141723f" }, - "knap": { "branch": "main", "commit": "503010f541696e99ed5c62f658620e546cebf8b0" }, "kotlin-vim": { "branch": "master", "commit": "53fe045906df8eeb07cb77b078fc93acda6c90b8" }, "lazy.nvim": { "branch": "main", "commit": "dac844ed617dda4f9ec85eb88e9629ad2add5e05" }, "lean.nvim": { "branch": "main", "commit": "67580fab5bed73920fa3fdd712fc8e805c389c3d" }, @@ -36,6 +32,7 @@ "magma-nvim": { "branch": "main", "commit": "ff3deba8a879806a51c005e50782130246143d06" }, "mind.nvim": { "branch": "master", "commit": "002137dd7cf97865ebd01b6a260209d2daf2da66" }, "mini.files": { "branch": "main", "commit": "dea80a8147aa4e3025c34d2e2aaa6f2aeb7b21dd" }, + "mini.operators": { "branch": "main", "commit": "15f137f28412517e2248d39cf0663bd3a87aa24a" }, "mini.surround": { "branch": "main", "commit": "9d1956b576d7051da3a483b251dfc778121c60db" }, "neoconf.nvim": { "branch": "main", "commit": "08f146d53e075055500dca35e93281faff95716b" }, "neodev.nvim": { "branch": "main", "commit": "9a5c0f0de5c15fba52d4fb83d425d3f4fa7abfa1" }, @@ -62,7 +59,6 @@ "rust-tools.nvim": { "branch": "master", "commit": "0cc8adab23117783a0292a0c8a2fbed1005dc645" }, "scrap.nvim": { "branch": "main", "commit": "16db44ae9403ec9c4b140394f294475d1af80a18" }, "smart-splits.nvim": { "branch": "master", "commit": "7aad6019dee974a01333523a5b8e122b7e7da454" }, - "telescope-file-browser.nvim": { "branch": "master", "commit": "ad7b637c72549713b9aaed7c4f9c79c62bcbdff0" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "9bc8237565ded606e6c366a71c64c0af25cd7a50" }, "telescope.nvim": { "branch": "master", "commit": "776b509f80dd49d8205b9b0d94485568236d1192" }, "typst.vim": { "branch": "main", "commit": "6a99324a138c2da69589a8ab2e49375774e43d77" }, diff --git a/dotfiles/neovim/lua/my/plugins/dashboard.lua b/dotfiles/neovim/lua/my/plugins/dashboard.lua index e8e5e77..d385109 100644 --- a/dotfiles/neovim/lua/my/plugins/dashboard.lua +++ b/dotfiles/neovim/lua/my/plugins/dashboard.lua @@ -1,44 +1,66 @@ local env = require("my.helpers.env") local M = { - "glepnir/dashboard-nvim", - event = "VimEnter", - opts = { - theme = "hyper", - config = { - week_header = { enable = true }, - project = { enable = false }, - -- TODO: actually customize these - shortcut = { - { - desc = " Update", - group = "@property", - action = "Lazy update", - key = "u", - }, - { - desc = " Files", - group = "Label", - action = "Telescope find_files", - key = "f", - }, - { - desc = " Apps", - group = "DiagnosticHint", - action = "Telescope app", - key = "a", - }, - { - desc = " dotfiles", - group = "Number", - action = "Telescope dotfiles", - key = "d", - }, - }, - }, - }, + "goolord/alpha-nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + config = function() + local theme = require("alpha.themes.dashboard") + theme.opts.width = 70 + theme.opts.position = "center" + theme.section.buttons.val = {} + + -- See [the header generator](https://patorjk.com/software/taag/#p=display&v=0&f=ANSI%20Shadow&t=NEOVim%20%3A3) + theme.section.header.opts.hl = "AlphaHeader" + theme.section.header.val = [[ +███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ ██████╗ +████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ ██╗╚════██╗ +██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ╚═╝ █████╔╝ +██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ██╗ ╚═══██╗ +██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ╚═╝██████╔╝ +╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ + ]] + + local footer = function() + local version = "🚀 " + .. vim.version().major + .. "." + .. vim.version().minor + .. "." + .. vim.version().patch + local lazy_ok, lazy = pcall(require, "lazy") + if lazy_ok then + local total_plugins = lazy.stats().count .. " Plugins" + local startuptime = ( + math.floor(lazy.stats().startuptime * 100 + 0.5) / 100 + ) + return version + .. " — 🧰 " + .. total_plugins + .. " — 🕐 " + .. startuptime + .. "ms" + else + return version + end + end + + vim.api.nvim_create_autocmd("User", { + pattern = "LazyVimStarted", + callback = function() + theme.section.footer.val = footer() + vim.cmd("AlphaRedraw") + end, + desc = "Footer for Alpha", + }) + + theme.section.footer.opts.hl = "AlphaFooter" + theme.section.header.opts.hl = "AlphaHeader" + theme.section.buttons.opts.hl = "AlphaButton" + + require("alpha").setup(theme.config) + end, + lazy = false, cond = env.vscode.not_active() and env.firenvim.not_active(), - dependencies = { { "nvim-tree/nvim-web-devicons" } }, } return M diff --git a/dotfiles/neovim/lua/my/plugins/init.lua b/dotfiles/neovim/lua/my/plugins/init.lua index d96e412..a8d7b1f 100644 --- a/dotfiles/neovim/lua/my/plugins/init.lua +++ b/dotfiles/neovim/lua/my/plugins/init.lua @@ -96,11 +96,10 @@ return { }, -- Helper libs - { - "nvim-lua/plenary.nvim", - }, - + "nvim-lua/plenary.nvim", "MunifTanjim/nui.nvim", + "nvim-tree/nvim-web-devicons", -- nice looking icons + "mateiadrielrafael/scrap.nvim", -- vim-abolish rewrite { "terrortylor/nvim-comment", @@ -110,9 +109,6 @@ return { end, }, - -- nice looking icons - "nvim-tree/nvim-web-devicons", - { -- easly switch between tmux and vim panes "christoomey/vim-tmux-navigator", @@ -129,14 +125,6 @@ return { cond = env.vscode.not_active() and env.firenvim.not_active(), }, - { - -- smooth scrolling - "psliwka/vim-smoothie", - -- enabled = env.neovide.not_active(), - enabled = false, - event = "VeryLazy", - }, - { -- show progress for lsp stuff "j-hui/fidget.nvim", @@ -162,25 +150,6 @@ return { enabled = false, }, - { - -- reminds you of abbreviations - "0styx0/abbreinder.nvim", - dependencies = "0styx0/abbremand.nvim", - event = "InsertEnter", - }, - - { - -- md preview (in terminal) - "ellisonleao/glow.nvim", - cmd = "Glow", - cond = env.vscode.not_active(), - }, - - { - "frabjous/knap", -- md preview - cond = env.vscode.not_active(), - }, - { -- automatically set options based on current file "tpope/vim-sleuth", @@ -188,15 +157,11 @@ return { cond = env.vscode.not_active(), }, - -- vim-abolish rewrite - "mateiadrielrafael/scrap.nvim", - { - "ruifm/gitlinker.nvim", -- generate permalinks for code + -- generate permalinks for code + "ruifm/gitlinker.nvim", dependencies = { "nvim-lua/plenary.nvim" }, - opts = { - mappings = "yg", - }, + opts = { mappings = "yg" }, init = function() local status, wk = pcall(require, "which-key") @@ -225,15 +190,16 @@ return { -- Live command preview for stuff like :norm { "smjonas/live-command.nvim", - opts = { - commands = { - Norm = { cmd = "norm" }, - }, - }, + config = function() + require("live-command").setup({ + commands = { + Norm = { cmd = "norm" }, + }, + }) + end, event = "VeryLazy", cond = false, }, - { "mbbill/undotree", cmd = "UndotreeToggle", diff --git a/dotfiles/neovim/lua/my/plugins/files.lua b/dotfiles/neovim/lua/my/plugins/mini-files.lua similarity index 69% rename from dotfiles/neovim/lua/my/plugins/files.lua rename to dotfiles/neovim/lua/my/plugins/mini-files.lua index 07eb46b..26b04e1 100644 --- a/dotfiles/neovim/lua/my/plugins/files.lua +++ b/dotfiles/neovim/lua/my/plugins/mini-files.lua @@ -1,9 +1,11 @@ local K = require("my.keymaps") +local env = require("my.helpers.env") local M = { "echasnovski/mini.files", version = "main", - keys = { "" }, + event = "VeryLazy", + cond = env.vscode.not_active() and env.firenvim.not_active(), } function M.config() @@ -11,11 +13,9 @@ function M.config() files.setup({ windows = { - preview = true, - }, - mappings = { - reveal_cwd = "R", + preview = false, }, + mappings = {}, }) K.nmap("", function() diff --git a/dotfiles/neovim/lua/my/plugins/mini-operators.lua b/dotfiles/neovim/lua/my/plugins/mini-operators.lua new file mode 100644 index 0000000..73d3075 --- /dev/null +++ b/dotfiles/neovim/lua/my/plugins/mini-operators.lua @@ -0,0 +1,8 @@ +local M = { + "echasnovski/mini.operators", + version = false, + event = "VeryLazy", + opts = {}, +} + +return M diff --git a/dotfiles/neovim/lua/my/plugins/surround.lua b/dotfiles/neovim/lua/my/plugins/mini-surround.lua similarity index 100% rename from dotfiles/neovim/lua/my/plugins/surround.lua rename to dotfiles/neovim/lua/my/plugins/mini-surround.lua