From a37f9dab1cba4c9285ed50932e1eba88d5461833 Mon Sep 17 00:00:00 2001 From: Christian Nieves Date: Tue, 16 Jan 2024 22:01:10 -0600 Subject: [PATCH] update plugs save 20ms on load wooooooo --- vim/.vim/lua/plugins/base.lua | 114 +++++++------------------- vim/.vim/lua/plugins/dashboard.lua | 20 +++-- vim/.vim/lua/plugins/firenvim.lua | 38 +++++++++ vim/.vim/lua/plugins/lsp.lua | 1 + vim/.vim/lua/plugins/rust.lua | 5 ++ vim/.vim/lua/plugins/telescope.lua | 126 ++++++++++++++++++----------- vim/.vim/lua/plugins/zen-mode.lua | 2 +- 7 files changed, 165 insertions(+), 141 deletions(-) create mode 100644 vim/.vim/lua/plugins/firenvim.lua diff --git a/vim/.vim/lua/plugins/base.lua b/vim/.vim/lua/plugins/base.lua index 2e2494a..989e765 100644 --- a/vim/.vim/lua/plugins/base.lua +++ b/vim/.vim/lua/plugins/base.lua @@ -1,26 +1,18 @@ local use_google = require("utils").use_google return { - -- "sindrets/diffview.nvim", - { "johmsalas/text-case.nvim" }, + "kdheepak/lazygit.nvim", + "flwyd/vim-conjoin", + "vim-scripts/vcscommand.vim", + "jghauser/mkdir.nvim", + "AndrewRadev/tagalong.vim", { "nvim-lua/plenary.nvim", lazy = false }, { "squk/java-syntax.vim", ft = "java" }, + { "udalov/kotlin-vim", ft = "kotlin" }, + { "ray-x/go.nvim", ft = "go" }, + { "ray-x/guihua.lua", ft = "go" }, + { "andymass/vim-matchup", event = "VimEnter" }, { "squk/gdrama-syntax.vim", dir = vim.fn.expand("$HOME/dev/gdrama-syntax.vim") }, - { - "folke/todo-comments.nvim", - dependencies = { "nvim-lua/plenary.nvim" }, - opts = {}, - }, - { - "mawkler/modicator.nvim", - init = function() - -- These are required for Modicator to work - vim.o.cursorline = true - vim.o.number = true - vim.o.termguicolors = true - end, - opts = {}, - }, { "NvChad/nvim-colorizer.lua", ft = "lua", @@ -29,15 +21,16 @@ return { end, }, { + "andweeb/presence.nvim", cond = not use_google(), config = function() - require("presence").setup({ show_time = false }) + require("presence").setup({ + main_image = "file", + show_time = false, + }) end, }, - { "udalov/kotlin-vim", ft = "kotlin" }, - { "ray-x/go.nvim", ft = "go" }, - { "ray-x/guihua.lua", ft = "go" }, { "rafcamlet/nvim-luapad", config = function() @@ -46,28 +39,24 @@ return { }) end, }, - "kdheepak/lazygit.nvim", - "flwyd/vim-conjoin", - "godlygeek/tabular", - "wesQ3/vim-windowswap", - "cakebaker/scss-syntax.vim", - "vim-scripts/vcscommand.vim", - "jghauser/mkdir.nvim", - "google/vim-searchindex", - "kosayoda/nvim-lightbulb", + { + "kosayoda/nvim-lightbulb", + opts = { + autocmd = { enabled = true }, + virtual_text = { + enabled = true, + text = " 󱐋", + hl = "DiagnosticWarn", + }, + sign = { enabled = false }, + }, + }, { "ntpeters/vim-better-whitespace", config = function() vim.g.better_whitespace_filetypes_blacklist = { "dashboard" } end, }, - "junegunn/fzf.vim", - "AndrewRadev/tagalong.vim", - "tversteeg/registers.nvim", - "jremmen/vim-ripgrep", - "viniciusgerevini/clyde.vim", - { "andymass/vim-matchup", event = "VimEnter" }, - -- Undo tree { "mbbill/undotree", cmd = "UndotreeToggle", @@ -78,19 +67,14 @@ return { { "stevearc/aerial.nvim", opts = {}, - -- Optional dependencies - dependencies = { - "nvim-treesitter/nvim-treesitter", - }, cmd = { "AerialToggle", "AerialOn" }, - keys = { - { "so", ":AerialToggle", desc = "[S]symbols [O]utline" }, - }, + keys = { { "so", ":AerialToggle", desc = "[S]symbols [O]utline" } }, }, { - "rmagatti/auto-session", + "olimorris/persisted.nvim", config = function() - require("auto-session").setup({ log_level = "error" }) + require("persisted").setup({}) + require("telescope").load_extension("persisted") end, }, { @@ -101,42 +85,4 @@ return { end, ft = { "markdown" }, }, - { - "glacambre/firenvim", - - -- Lazy load firenvim - -- Explanation: https://github.com/folke/lazy.nvim/discussions/463#discussioncomment-4819297 - config = function() - vim.g.firenvim_config = { - localSettings = { - [ [[.*]] ] = { - cmdline = "firenvim", - priority = 0, - selector = 'textarea:not([readonly]):not([class="handsontableInput"]), div[role="textbox"]', - takeover = "always", - }, - [ [[.*notion\.so.*]] ] = { - priority = 9, - takeover = "never", - }, - [ [[.*docs\.google\.com.*]] ] = { - priority = 9, - takeover = "never", - }, - [ [[google\.com.*]] ] = { - priority = 9, - takeover = "never", - }, - [ [[twitch\.tv.*]] ] = { - priority = 9, - takeover = "never", - }, - }, - } - end, - lazy = not vim.g.started_by_firenvim, - build = function() - vim.fn["firenvim#install"](0) - end, - }, } diff --git a/vim/.vim/lua/plugins/dashboard.lua b/vim/.vim/lua/plugins/dashboard.lua index 8277fcd..e825928 100644 --- a/vim/.vim/lua/plugins/dashboard.lua +++ b/vim/.vim/lua/plugins/dashboard.lua @@ -10,6 +10,12 @@ return { }, shortcut = { { desc = "󰊳 Update", group = "@property", action = "Lazy update", key = "u" }, + { + desc = "󰦛 cwd session", + group = "Number", + action = "SessionLoad", + key = ".", + }, { icon = " ", icon_hl = "@variable", @@ -19,17 +25,17 @@ return { key = "f", }, { - desc = " Apps", - group = "DiagnosticHint", - action = "Telescope app", - key = "a", - }, - { - desc = " dotfiles", + desc = " dotfiles", group = "Number", action = "lua find_dotfiles()", key = "d", }, + { + desc = " sessions", + group = "Number", + action = "Telescope persisted", + key = "s", + }, }, }, }) diff --git a/vim/.vim/lua/plugins/firenvim.lua b/vim/.vim/lua/plugins/firenvim.lua new file mode 100644 index 0000000..ae4d85d --- /dev/null +++ b/vim/.vim/lua/plugins/firenvim.lua @@ -0,0 +1,38 @@ +return { + "glacambre/firenvim", + + -- Lazy load firenvim + -- Explanation: https://github.com/folke/lazy.nvim/discussions/463#discussioncomment-4819297 + config = function() + vim.g.firenvim_config = { + localSettings = { + [ [[.*]] ] = { + cmdline = "firenvim", + priority = 0, + selector = 'textarea:not([readonly]):not([class="handsontableInput"]), div[role="textbox"]', + takeover = "always", + }, + [ [[.*notion\.so.*]] ] = { + priority = 9, + takeover = "never", + }, + [ [[.*docs\.google\.com.*]] ] = { + priority = 9, + takeover = "never", + }, + [ [[google\.com.*]] ] = { + priority = 9, + takeover = "never", + }, + [ [[twitch\.tv.*]] ] = { + priority = 9, + takeover = "never", + }, + }, + } + end, + lazy = not vim.g.started_by_firenvim, + build = function() + vim.fn["firenvim#install"](0) + end, +} diff --git a/vim/.vim/lua/plugins/lsp.lua b/vim/.vim/lua/plugins/lsp.lua index dd44c4b..f2dcabe 100644 --- a/vim/.vim/lua/plugins/lsp.lua +++ b/vim/.vim/lua/plugins/lsp.lua @@ -26,6 +26,7 @@ return { filetypes = { ignore = { -- filetypes to ignore; empty by default "gdscript", + "rust", }, -- for these filetypes }, } diff --git a/vim/.vim/lua/plugins/rust.lua b/vim/.vim/lua/plugins/rust.lua index 310210b..379c6b3 100644 --- a/vim/.vim/lua/plugins/rust.lua +++ b/vim/.vim/lua/plugins/rust.lua @@ -1,4 +1,9 @@ return { + { + "vxpm/ferris.nvim", + ft = "rust", + }, + { "mrcjkb/rustaceanvim", version = "^3", -- Recommended diff --git a/vim/.vim/lua/plugins/telescope.lua b/vim/.vim/lua/plugins/telescope.lua index f49ba09..41031de 100644 --- a/vim/.vim/lua/plugins/telescope.lua +++ b/vim/.vim/lua/plugins/telescope.lua @@ -65,58 +65,86 @@ if use_google() then end return { - "nvim-telescope/telescope.nvim", - dependencies = {}, - config = function() - require("telescope").setup({ - defaults = { - -- The vertical layout strategy is good to handle long paths like those in - -- google3 repos because you have nearly the full screen to display a file path. - -- The caveat is that the preview area is smaller. - layout_strategy = "vertical", - -- Common paths in google3 repos are collapsed following the example of Cider - -- It is nice to keep this as a user config rather than part of - -- telescope-codesearch because it can be reused by other telescope pickers. - path_display = function(opts, path) - -- Do common substitutions - path = path:gsub("^/google/src/cloud/[^/]+/[^/]+/google3/", "google3/", 1) - path = path:gsub("^google3/java/com/google/", "//j/c/g/", 1) - path = path:gsub("^google3/javatests/com/google/", "//jt/c/g/", 1) - path = path:gsub("^google3/third_party/", "//3p/", 1) - path = path:gsub("^google3/", "//", 1) + { + "johmsalas/text-case.nvim", + dependencies = { "nvim-telescope/telescope.nvim" }, + config = function() + require("textcase").setup({}) + require("telescope").load_extension("textcase") + end, + keys = { + { "t", "TextCaseOpenTelescope", mode = { "n", "v" }, desc = "Telescope" }, + }, + }, + { + "piersolenski/telescope-import.nvim", + dependencies = "nvim-telescope/telescope.nvim", + config = function() + require("telescope").load_extension("import") + end, + keys = { + { "i", ":Telescope import" }, + }, + }, + { + "nvim-telescope/telescope.nvim", + dependencies = {}, + config = function() + require("telescope").setup({ + defaults = { + -- The vertical layout strategy is good to handle long paths like those in + -- google3 repos because you have nearly the full screen to display a file path. + -- The caveat is that the preview area is smaller. + layout_strategy = "vertical", + -- Common paths in google3 repos are collapsed following the example of Cider + -- It is nice to keep this as a user config rather than part of + -- telescope-codesearch because it can be reused by other telescope pickers. + path_display = function(opts, path) + -- Do common substitutions + path = path:gsub("^/google/src/cloud/[^/]+/[^/]+/google3/", "google3/", 1) + path = path:gsub("^google3/java/com/google/", "//j/c/g/", 1) + path = path:gsub("^google3/javatests/com/google/", "//jt/c/g/", 1) + path = path:gsub("^google3/third_party/", "//3p/", 1) + path = path:gsub("^google3/", "//", 1) - -- Do truncation. This allows us to combine our custom display formatter - -- with the built-in truncation. - -- `truncate` handler in transform_path memoizes computed truncation length in opts.__length. - -- Here we are manually propagating this value between new_opts and opts. - -- We can make this cleaner and more complicated using metatables :) - local new_opts = { - path_display = { - truncate = true, + -- Do truncation. This allows us to combine our custom display formatter + -- with the built-in truncation. + -- `truncate` handler in transform_path memoizes computed truncation length in opts.__length. + -- Here we are manually propagating this value between new_opts and opts. + -- We can make this cleaner and more complicated using metatables :) + local new_opts = { + path_display = { + truncate = true, + }, + __length = opts.__length, + } + path = require("telescope.utils").transform_path(new_opts, path) + opts.__length = new_opts.__length + return path + end, + mappings = { + i = { + [""] = function() + require("telescope.actions").cycle_history_next() + end, + [""] = function() + require("telescope.actions").cycle_history_prev() + end, }, - __length = opts.__length, - } - path = require("telescope.utils").transform_path(new_opts, path) - opts.__length = new_opts.__length - return path - end, - mappings = { - i = { - [""] = function() - require("telescope.actions").cycle_history_next() - end, - [""] = function() - require("telescope.actions").cycle_history_prev() - end, }, }, - }, - extensions = { - codesearch = { - experimental = true, -- enable results from google3/experimental + extensions = { + codesearch = { + experimental = true, -- enable results from google3/experimental + }, + persisted = {}, + import = { + -- Add imports to the top of the file keeping the cursor in place + insert_at_top = true, + }, }, - }, - }) - end, - keys = keys, + }) + end, + keys = keys, + }, } diff --git a/vim/.vim/lua/plugins/zen-mode.lua b/vim/.vim/lua/plugins/zen-mode.lua index 109731c..08d3fd0 100644 --- a/vim/.vim/lua/plugins/zen-mode.lua +++ b/vim/.vim/lua/plugins/zen-mode.lua @@ -2,7 +2,7 @@ return { "folke/zen-mode.nvim", opts = { window = { - width = 0.4, + width = 140, }, plugins = { tmux = { enabled = false },