aboutsummaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authorjdhao <jdhao@hotmail.com>2023-08-27 23:13:42 +0200
committerjdhao <jdhao@hotmail.com>2023-08-27 23:14:31 +0200
commit1391ca7ff153636476bae6ffbf16aec076e2d191 (patch)
tree9739034aef482a2123514fc049bc91210a4beb5b /lua
parent6a6f8ff5974447fd452f5d8bf20dd090dfdd8ec9 (diff)
feat: switch from packer.nvim to lazy.nvim
Diffstat (limited to 'lua')
-rw-r--r--lua/colorschemes.lua10
-rw-r--r--lua/config/lsp.lua2
-rw-r--r--lua/config/nvim-tree.lua2
-rw-r--r--lua/plugins.lua825
4 files changed, 459 insertions, 380 deletions
diff --git a/lua/colorschemes.lua b/lua/colorschemes.lua
index 46545b3..1395501 100644
--- a/lua/colorschemes.lua
+++ b/lua/colorschemes.lua
@@ -129,16 +129,6 @@ M.rand_colorscheme = function()
return
end
- -- Load the colorscheme, because all the colorschemes are declared as opt plugins, so the colorscheme isn't loaded yet.
- local status = utils.add_pack(M.colorscheme2dir[colorscheme])
-
- if not status then
- local msg = string.format("Colorscheme %s is not installed. Run PackerSync to install.", colorscheme)
- vim.notify(msg, vim.log.levels.ERROR, { title = "nvim-config" })
-
- return
- end
-
-- Load the colorscheme and its settings
M[colorscheme]()
diff --git a/lua/config/lsp.lua b/lua/config/lsp.lua
index a3c5595..7c6fb79 100644
--- a/lua/config/lsp.lua
+++ b/lua/config/lsp.lua
@@ -234,7 +234,7 @@ if utils.executable("lua-language-server") then
-- see also https://github.com/LuaLS/lua-language-server/wiki/Libraries#link-to-workspace .
-- Lua-dev.nvim also has similar settings for lua ls, https://github.com/folke/neodev.nvim/blob/main/lua/neodev/luals.lua .
library = {
- fn.stdpath("data") .. "/site/pack/packer/opt/emmylua-nvim",
+ fn.stdpath("data") .. "/lazy/emmylua-nvim",
fn.stdpath("config"),
},
maxPreload = 2000,
diff --git a/lua/config/nvim-tree.lua b/lua/config/nvim-tree.lua
index 83e93c1..8dd4985 100644
--- a/lua/config/nvim-tree.lua
+++ b/lua/config/nvim-tree.lua
@@ -79,7 +79,7 @@ nvim_tree.setup {
enable = true,
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
exclude = {
- filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" },
+ filetype = { "notify", "qf", "diff", "fugitive", "fugitiveblame" },
buftype = { "nofile", "terminal", "help" },
},
},
diff --git a/lua/plugins.lua b/lua/plugins.lua
index 1171295..e728510 100644
--- a/lua/plugins.lua
+++ b/lua/plugins.lua
@@ -1,396 +1,485 @@
-local api = vim.api
-local fn = vim.fn
-
local utils = require("utils")
--- The root dir to install all plugins. Plugins are under opt/ or start/ sub-directory.
-vim.g.plugin_home = fn.stdpath("data") .. "/site/pack/packer"
+local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
+
+if not vim.loop.fs_stat(lazypath) then
+ vim.fn.system {
+ "git",
+ "clone",
+ "--filter=blob:none",
+ "https://github.com/folke/lazy.nvim.git",
+ "--branch=stable", -- latest stable release
+ lazypath,
+ }
+end
+vim.opt.rtp:prepend(lazypath)
---- Install packer if it has not been installed.
---- Return:
---- true: if this is a fresh install of packer
---- false: if packer has been installed
-local function packer_ensure_install()
- -- Where to install packer.nvim -- the package manager (we make it opt)
- local packer_dir = vim.g.plugin_home .. "/opt/packer.nvim"
+-- check if firenvim is active
+local firenvim_not_active = function()
+ return not vim.g.started_by_firenvim
+end
- if fn.glob(packer_dir) ~= "" then
- return false
- end
+require("lazy").setup {
+ { "onsails/lspkind-nvim", lazy = true },
+ -- auto-completion engine
+ {
+ "hrsh7th/nvim-cmp",
+ dependencies = {
+ "hrsh7th/cmp-nvim-lsp",
+ "hrsh7th/cmp-path",
+ "hrsh7th/cmp-buffer",
+ "hrsh7th/cmp-omni",
+ "hrsh7th/cmp-emoji",
+ "quangnguyen30192/cmp-nvim-ultisnips",
+ },
+ config = function()
+ require("config.nvim-cmp")
+ end,
+ },
- -- Auto-install packer in case it hasn't been installed.
- vim.api.nvim_echo({ { "Installing packer.nvim", "Type" } }, true, {})
+ -- nvim-lsp configuration (it relies on cmp-nvim-lsp, so it should be loaded after cmp-nvim-lsp).
+ {
+ "neovim/nvim-lspconfig",
+ config = function()
+ require("config.lsp")
+ end,
+ },
- local packer_repo = "https://github.com/wbthomason/packer.nvim"
- local install_cmd = string.format("!git clone --depth=1 %s %s", packer_repo, packer_dir)
- vim.cmd(install_cmd)
+ {
+ "nvim-treesitter/nvim-treesitter",
+ enabled = function()
+ if vim.g.is_mac then
+ return true
+ end
+ return false
+ end,
+ event = "BufEnter",
+ build = ":TSUpdate",
+ config = function()
+ require("config.treesitter")
+ end,
+ },
- return true
-end
+ -- Python indent (follows the PEP8 style)
+ { "Vimjas/vim-python-pep8-indent", ft = { "python" } },
+
+ -- Python-related text object
+ { "jeetsukumaran/vim-pythonsense", ft = { "python" } },
+
+ { "machakann/vim-swap", event = "VimEnter" },
+
+ -- IDE for Lisp
+ -- 'kovisoft/slimv'
+ {
+ "vlime/vlime",
+ enabled = function()
+ if utils.executable("sbcl") then
+ return true
+ end
+ return false
+ end,
+ config = function(plugin)
+ vim.opt.rtp:append(plugin.dir .. "/vim")
+ end,
+ ft = { "lisp" },
+ },
-local fresh_install = packer_ensure_install()
+ -- Super fast buffer jump
+ {
+ "phaazon/hop.nvim",
+ event = "VimEnter",
+ config = function()
+ vim.defer_fn(function()
+ require("config.nvim_hop")
+ end, 2000)
+ end,
+ },
--- Load packer.nvim
-vim.cmd("packadd packer.nvim")
+ -- Show match number and index for searching
+ {
+ "kevinhwang91/nvim-hlslens",
+ branch = "main",
+ keys = { "*", "#", "n", "N" },
+ config = function()
+ require("config.hlslens")
+ end,
+ },
+ {
+ "Yggdroot/LeaderF",
+ cmd = "Leaderf",
+ build = function()
+ if not vim.g.is_win then
+ vim.cmd(":LeaderfInstallCExtension")
+ end
+ end,
+ },
+ "nvim-lua/plenary.nvim",
+ {
+ "nvim-telescope/telescope.nvim",
+ cmd = "Telescope",
+ dependencies = {
+ "nvim-telescope/telescope-symbols.nvim",
+ },
+ },
-local packer = require("packer")
-local packer_util = require("packer.util")
+ -- A list of colorscheme plugin you may want to try. Find what suits you.
+ { "navarasu/onedark.nvim" },
+ { "sainnhe/edge" },
+ { "sainnhe/sonokai" },
+ { "sainnhe/gruvbox-material" },
+ { "shaunsingh/nord.nvim" },
+ { "sainnhe/everforest" },
+ { "EdenEast/nightfox.nvim" },
+ { "rebelot/kanagawa.nvim" },
+ { "catppuccin/nvim", name = "catppuccin" },
+ { "rose-pine/neovim", name = "rose-pine" },
+ { "olimorris/onedarkpro.nvim" },
+ { "tanvirtin/monokai.nvim" },
+ { "marko-cerovac/material.nvim" },
+
+ { "nvim-tree/nvim-web-devicons", event = "VimEnter" },
+
+ {
+ "nvim-lualine/lualine.nvim",
+ event = "VimEnter",
+ cond = firenvim_not_active,
+ config = function()
+ require("config.statusline")
+ end,
+ },
--- check if firenvim is active
-local firenvim_not_active = function()
- return not vim.g.started_by_firenvim
-end
+ {
+ "akinsho/bufferline.nvim",
+ event = "VimEnter",
+ cond = firenvim_not_active,
+ config = function()
+ require("config.bufferline")
+ end,
+ },
-packer.startup {
- function(use)
- use { "wbthomason/packer.nvim", opt = true }
-
- use { "onsails/lspkind-nvim", event = "VimEnter" }
- -- auto-completion engine
- use { "hrsh7th/nvim-cmp", after = "lspkind-nvim", config = [[require('config.nvim-cmp')]] }
-
- -- nvim-cmp completion sources
- use { "hrsh7th/cmp-nvim-lsp", after = "nvim-cmp" }
- use { "hrsh7th/cmp-path", after = "nvim-cmp" }
- use { "hrsh7th/cmp-buffer", after = "nvim-cmp" }
- use { "hrsh7th/cmp-omni", after = "nvim-cmp" }
- use { "quangnguyen30192/cmp-nvim-ultisnips", after = { "nvim-cmp", "ultisnips" } }
- if vim.g.is_mac then
- use { "hrsh7th/cmp-emoji", after = "nvim-cmp" }
- end
-
- -- nvim-lsp configuration (it relies on cmp-nvim-lsp, so it should be loaded after cmp-nvim-lsp).
- use { "neovim/nvim-lspconfig", after = "cmp-nvim-lsp", config = [[require('config.lsp')]] }
-
- if vim.g.is_mac then
- use {
- "nvim-treesitter/nvim-treesitter",
- event = "BufEnter",
- run = ":TSUpdate",
- config = [[require('config.treesitter')]],
- }
- end
-
- -- Python indent (follows the PEP8 style)
- use { "Vimjas/vim-python-pep8-indent", ft = { "python" } }
-
- -- Python-related text object
- use { "jeetsukumaran/vim-pythonsense", ft = { "python" } }
-
- use { "machakann/vim-swap", event = "VimEnter" }
-
- -- IDE for Lisp
- if utils.executable("sbcl") then
- -- use 'kovisoft/slimv'
- use { "vlime/vlime", rtp = "vim/", ft = { "lisp" } }
- end
-
- -- Super fast buffer jump
- use {
- "phaazon/hop.nvim",
- event = "VimEnter",
- config = function()
- vim.defer_fn(function()
- require("config.nvim_hop")
- end, 2000)
- end,
- }
-
- -- Show match number and index for searching
- use {
- "kevinhwang91/nvim-hlslens",
- branch = "main",
- keys = { { "n", "*" }, { "n", "#" }, { "n", "n" }, { "n", "N" } },
- config = [[require('config.hlslens')]],
- }
-
- -- File search, tag search and more
- if vim.g.is_win then
- use { "Yggdroot/LeaderF", cmd = "Leaderf" }
- else
- use { "Yggdroot/LeaderF", cmd = "Leaderf", run = ":LeaderfInstallCExtension" }
- end
-
- use {
- "nvim-telescope/telescope.nvim",
- cmd = "Telescope",
- requires = { { "nvim-lua/plenary.nvim" } },
- }
- -- search emoji and other symbols
- use { "nvim-telescope/telescope-symbols.nvim", after = "telescope.nvim" }
-
- -- A list of colorscheme plugin you may want to try. Find what suits you.
- use { "navarasu/onedark.nvim", opt = true }
- use { "sainnhe/edge", opt = true }
- use { "sainnhe/sonokai", opt = true }
- use { "sainnhe/gruvbox-material", opt = true }
- use { "shaunsingh/nord.nvim", opt = true }
- use { "sainnhe/everforest", opt = true }
- use { "EdenEast/nightfox.nvim", opt = true }
- use { "rebelot/kanagawa.nvim", opt = true }
- use { "catppuccin/nvim", as = "catppuccin", opt = true }
- use({ "rose-pine/neovim", as = 'rose-pine', opt = true })
- use { "olimorris/onedarkpro.nvim", opt = true }
- use { "tanvirtin/monokai.nvim", opt = true }
- use { "marko-cerovac/material.nvim", opt = true }
-
- use { "nvim-tree/nvim-web-devicons", event = "VimEnter" }
-
- use {
- "nvim-lualine/lualine.nvim",
- event = "VimEnter",
- cond = firenvim_not_active,
- config = [[require('config.statusline')]],
- }
-
- use { "akinsho/bufferline.nvim", event = "VimEnter",
- cond = firenvim_not_active,
- config = [[require('config.bufferline')]] }
-
- -- fancy start screen
- use { "nvimdev/dashboard-nvim", event = "VimEnter",
- cond = firenvim_not_active,
- config = [[require('config.dashboard-nvim')]]
- }
-
- use {
- "lukas-reineke/indent-blankline.nvim",
- event = "VimEnter",
- config = [[require('config.indent-blankline')]],
- }
-
- -- Highlight URLs inside vim
- use { "itchyny/vim-highlighturl", event = "VimEnter" }
-
- -- notification plugin
- use {
- "rcarriga/nvim-notify",
- event = "BufEnter",
- config = function()
- vim.defer_fn(function()
- require("config.nvim-notify")
- end, 2000)
- end,
- }
-
- -- For Windows and Mac, we can open an URL in the browser. For Linux, it may
- -- not be possible since we maybe in a server which disables GUI.
- if vim.g.is_win or vim.g.is_mac then
- -- open URL in browser
- use { "tyru/open-browser.vim", event = "VimEnter" }
- end
-
- -- Only install these plugins if ctags are installed on the system
- if utils.executable("ctags") then
- -- show file tags in vim window
- use { "liuchengxu/vista.vim", cmd = "Vista" }
- end
-
- -- Snippet engine and snippet template
- use { "SirVer/ultisnips", event = "InsertEnter" }
- use { "honza/vim-snippets", after = "ultisnips" }
-
- -- Automatic insertion and deletion of a pair of characters
- use { "Raimondi/delimitMate", event = "InsertEnter" }
-
- -- Comment plugin
- use { "tpope/vim-commentary", event = "VimEnter" }
-
- -- Multiple cursor plugin like Sublime Text?
- -- use 'mg979/vim-visual-multi'
-
- -- Autosave files on certain events
- use { "907th/vim-auto-save", event = "InsertEnter" }
-
- -- Show undo history visually
- use { "simnalamburt/vim-mundo", cmd = { "MundoToggle", "MundoShow" } }
-
- -- better UI for some nvim actions
- use {'stevearc/dressing.nvim'}
-
- -- Manage your yank history
- use({
- "gbprod/yanky.nvim",
- config = [[require('config.yanky')]]
- })
-
- -- Handy unix command inside Vim (Rename, Move etc.)
- use { "tpope/vim-eunuch", cmd = { "Rename", "Delete" } }
-
- -- Repeat vim motions
- use { "tpope/vim-repeat", event = "VimEnter" }
-
- use { "nvim-zh/better-escape.vim", event = { "InsertEnter" } }
-
- if vim.g.is_mac and utils.executable('xkbswitch') then
- use { "lyokha/vim-xkbswitch", event = { "InsertEnter" } }
- elseif vim.g.is_win then
- use { "Neur1n/neuims", event = { "InsertEnter" } }
- end
-
- -- Auto format tools
- use { "sbdchd/neoformat", cmd = { "Neoformat" } }
-
- -- Git command inside vim
- use { "tpope/vim-fugitive", event = "User InGitRepo", config = [[require('config.fugitive')]] }
-
- -- Better git log display
- use { "rbong/vim-flog", requires = "tpope/vim-fugitive", cmd = { "Flog" } }
-
- use { "christoomey/vim-conflicted", requires = "tpope/vim-fugitive", cmd = { "Conflicted" } }
-
- use {
- "ruifm/gitlinker.nvim",
- requires = "nvim-lua/plenary.nvim",
- event = "User InGitRepo",
- config = [[require('config.git-linker')]],
- }
-
- -- Show git change (change, delete, add) signs in vim sign column
- use { "lewis6991/gitsigns.nvim", config = [[require('config.gitsigns')]] }
-
- -- Better git commit experience
- use { "rhysd/committia.vim", opt = true, setup = [[vim.cmd('packadd committia.vim')]] }
-
- use { "kevinhwang91/nvim-bqf", ft = "qf", config = [[require('config.bqf')]] }
-
- -- Another markdown plugin
- use { "preservim/vim-markdown", ft = { "markdown" } }
-
- -- Faster footnote generation
- use { "vim-pandoc/vim-markdownfootnotes", ft = { "markdown" } }
-
- -- Vim tabular plugin for manipulate tabular, required by markdown plugins
- use { "godlygeek/tabular", cmd = { "Tabularize" } }
-
- -- Markdown previewing (only for Mac and Windows)
- if vim.g.is_win or vim.g.is_mac then
- use {
- "iamcco/markdown-preview.nvim",
- run = "cd app && npm install",
- ft = { "markdown" },
- }
- end
+ -- fancy start screen
+ {
+ "nvimdev/dashboard-nvim",
+ event = "VimEnter",
+ cond = firenvim_not_active,
+ config = function()
+ require("config.dashboard-nvim")
+ end,
+ },
- use { "folke/zen-mode.nvim", cmd = "ZenMode", config = [[require('config.zen-mode')]] }
+ {
+ "lukas-reineke/indent-blankline.nvim",
+ event = "VimEnter",
+ config = function()
+ require("config.indent-blankline")
+ end,
+ },
- if vim.g.is_mac then
- use { "rhysd/vim-grammarous", ft = { "markdown" } }
- end
+ -- Highlight URLs inside vim
+ { "itchyny/vim-highlighturl", event = "VimEnter" },
+
+ -- notification plugin
+ {
+ "rcarriga/nvim-notify",
+ event = "BufEnter",
+ config = function()
+ vim.defer_fn(function()
+ require("config.nvim-notify")
+ end, 2000)
+ end,
+ },
- use { "chrisbra/unicode.vim", event = "VimEnter" }
+ -- For Windows and Mac, we can open an URL in the browser. For Linux, it may
+ -- not be possible since we maybe in a server which disables GUI.
+ {
+ "tyru/open-browser.vim",
+ enabled = function()
+ if vim.g.is_win or vim.g.is_mac then
+ return true
+ else
+ return false
+ end
+ end,
+ event = "VimEnter",
+ },
- -- Additional powerful text object for vim, this plugin should be studied
- -- carefully to use its full power
- use { "wellle/targets.vim", event = "VimEnter" }
+ -- Only install these plugins if ctags are installed on the system
+ -- show file tags in vim window
+ {
+ "liuchengxu/vista.vim",
+ enabled = function()
+ if utils.executable("ctags") then
+ return true
+ else
+ return false
+ end
+ end,
+ cmd = "Vista",
+ },
- -- Plugin to manipulate character pairs quickly
- use { "machakann/vim-sandwich", event = "VimEnter" }
+ -- Snippet engine and snippet template
+ { "SirVer/ultisnips", dependencies = {
+ "honza/vim-snippets",
+ }, event = "InsertEnter" },
- -- Add indent object for vim (useful for languages like Python)
- use { "michaeljsmith/vim-indent-object", event = "VimEnter" }
+ -- Automatic insertion and deletion of a pair of characters
+ { "Raimondi/delimitMate", event = "InsertEnter" },
- -- Only use these plugin on Windows and Mac and when LaTeX is installed
- if utils.executable("latex") then
- use { "lervag/vimtex", ft = { "tex" } }
- end
+ -- Comment plugin
+ { "tpope/vim-commentary", event = "VimEnter" },
- -- Since tmux is only available on Linux and Mac, we only enable these plugins
- -- for Linux and Mac
- if utils.executable("tmux") then
- -- .tmux.conf syntax highlighting and setting check
- use { "tmux-plugins/vim-tmux", ft = { "tmux" } }
- end
+ -- Multiple cursor plugin like Sublime Text?
+ -- 'mg979/vim-visual-multi'
- -- Modern matchit implementation
- use { "andymass/vim-matchup", event = "VimEnter" }
+ -- Autosave files on certain events
+ { "907th/vim-auto-save", event = "InsertEnter" },
- use { "tpope/vim-scriptease", cmd = { "Scriptnames", "Message", "Verbose" } }
+ -- Show undo history visually
+ { "simnalamburt/vim-mundo", cmd = { "MundoToggle", "MundoShow" } },
- -- Asynchronous command execution
- use { "skywind3000/asyncrun.vim", opt = true, cmd = { "AsyncRun" } }
+ -- better UI for some nvim actions
+ { "stevearc/dressing.nvim" },
- use { "cespare/vim-toml", ft = { "toml" }, branch = "main" }
+ -- Manage your yank history
+ {
+ "gbprod/yanky.nvim",
+ config = function()
+ require("config.yanky")
+ end,
+ },
- -- Edit text area in browser using nvim
- if vim.g.is_win or vim.g.is_mac then
- use {
- "glacambre/firenvim",
- run = function()
- fn["firenvim#install"](0)
- end,
- opt = true,
- setup = [[vim.cmd('packadd firenvim')]],
- }
- end
-
- -- Debugger plugin
- if vim.g.is_win or vim.g.is_linux then
- use { "sakhnik/nvim-gdb", run = { "bash install.sh" }, opt = true, setup = [[vim.cmd('packadd nvim-gdb')]] }
- end
-
- -- Session management plugin
- use { "tpope/vim-obsession", cmd = "Obsession" }
-
- if vim.g.is_linux then
- use { "ojroques/vim-oscyank", cmd = { "OSCYank", "OSCYankReg" } }
- end
-
- -- The missing auto-completion for cmdline!
- use { "gelguy/wilder.nvim", opt = true, setup = [[vim.cmd('packadd wilder.nvim')]] }
-
- -- showing keybindings
- use {
- "folke/which-key.nvim",
- event = "VimEnter",
- config = function()
- vim.defer_fn(function()
- require("config.which-key")
- end, 2000)
- end,
- }
-
- -- show and trim trailing whitespaces
- use { "jdhao/whitespace.nvim", event = "VimEnter" }
-
- -- file explorer
- use {
- "nvim-tree/nvim-tree.lua",
- requires = { "nvim-tree/nvim-web-devicons" },
- config = [[require('config.nvim-tree')]],
- }
-
- use { "ii14/emmylua-nvim", ft = "lua" }
-
- use { "j-hui/fidget.nvim", after = "nvim-lspconfig", tag = "legacy", config = [[require('config.fidget-nvim')]] }
- end,
- config = {
- max_jobs = 16,
- compile_path = packer_util.join_paths(fn.stdpath("data"), "site", "lua", "packer_compiled.lua"),
+ -- Handy unix command inside Vim (Rename, Move etc.)
+ { "tpope/vim-eunuch", cmd = { "Rename", "Delete" } },
+
+ -- Repeat vim motions
+ { "tpope/vim-repeat", event = "VimEnter" },
+
+ { "nvim-zh/better-escape.vim", event = { "InsertEnter" } },
+
+ {
+ "lyokha/vim-xkbswitch",
+ enabled = function()
+ if vim.g.is_mac and utils.executable("xkbswitch") then
+ return true
+ end
+ return false
+ end,
+ event = { "InsertEnter" },
},
-}
--- For fresh install, we need to install plugins. Otherwise, we just need to require `packer_compiled.lua`.
-if fresh_install then
- -- We run packer.sync() here, because only after packer.startup, can we know which plugins to install.
- -- So plugin installation should be done after the startup process.
- packer.sync()
-else
- local status, _ = pcall(require, "packer_compiled")
- if not status then
- local msg = "File packer_compiled.lua not found: run PackerSync to fix!"
- vim.notify(msg, vim.log.levels.ERROR, { title = "nvim-config" })
- end
-end
+ {
+ "Neur1n/neuims",
+ enabled = function()
+ if vim.g.is_win then
+ return true
+ end
+ return false
+ end,
+ event = { "InsertEnter" },
+ },
--- Auto-generate packer_compiled.lua file
-api.nvim_create_autocmd({ "BufWritePost" }, {
- pattern = "*/nvim/lua/plugins.lua",
- group = api.nvim_create_augroup("packer_auto_compile", { clear = true }),
- callback = function(ctx)
- local cmd = "source " .. ctx.file
- vim.cmd(cmd)
- vim.cmd("PackerCompile")
- vim.notify("PackerCompile done!", vim.log.levels.INFO, { title = "Nvim-config" })
- end,
-})
+ -- Auto format tools
+ { "sbdchd/neoformat", cmd = { "Neoformat" } },
+
+ -- Git command inside vim
+ {
+ "tpope/vim-fugitive",
+ event = "User InGitRepo",
+ config = function()
+ require("config.fugitive")
+ end,
+ },
+
+ -- Better git log display
+ { "rbong/vim-flog", cmd = { "Flog" } },
+ { "christoomey/vim-conflicted", cmd = { "Conflicted" } },
+ {
+ "ruifm/gitlinker.nvim",
+ event = "User InGitRepo",
+ config = function()
+ require("config.git-linker")
+ end,
+ },
+
+ -- Show git change (change, delete, add) signs in vim sign column
+ {
+ "lewis6991/gitsigns.nvim",
+ config = function()
+ require("config.gitsigns")
+ end,
+ },
+
+ -- Better git commit experience
+ { "rhysd/committia.vim", lazy = true },
+ {
+ "kevinhwang91/nvim-bqf",
+ ft = "qf",
+ config = function()
+ require("config.bqf")
+ end,
+ },
+
+ -- Another markdown plugin
+ { "preservim/vim-markdown", ft = { "markdown" } },
+
+ -- Faster footnote generation
+ { "vim-pandoc/vim-markdownfootnotes", ft = { "markdown" } },
+
+ -- Vim tabular plugin for manipulate tabular, required by markdown plugins
+ { "godlygeek/tabular", cmd = { "Tabularize" } },
+
+ -- Markdown previewing (only for Mac and Windows)
+ {
+ "iamcco/markdown-preview.nvim",
+ enabled = function()
+ if vim.g.is_win or vim.g.is_mac then
+ return true
+ end
+ return false
+ end,
+ build = "cd app && npm install",
+ ft = { "markdown" },
+ },
+
+ {
+ "folke/zen-mode.nvim",
+ cmd = "ZenMode",
+ config = function()
+ require("config.zen-mode")
+ end,
+ },
+
+ {
+ "rhysd/vim-grammarous",
+ enabled = function()
+ if vim.g.is_mac then
+ return true
+ end
+ return false
+ end,
+ ft = { "markdown" },
+ },
+
+ { "chrisbra/unicode.vim", event = "VimEnter" },
+
+ -- Additional powerful text object for vim, this plugin should be studied
+ -- carefully to use its full power
+ { "wellle/targets.vim", event = "VimEnter" },
+
+ -- Plugin to manipulate character pairs quickly
+ { "machakann/vim-sandwich", event = "VimEnter" },
+
+ -- Add indent object for vim (useful for languages like Python)
+ { "michaeljsmith/vim-indent-object", event = "VimEnter" },
+
+ -- Only use these plugin on Windows and Mac and when LaTeX is installed
+ {
+ "lervag/vimtex",
+ enabled = function()
+ if utils.executable("latex") then
+ return true
+ end
+ return false
+ end,
+ ft = { "tex" },
+ },
+
+ -- Since tmux is only available on Linux and Mac, we only enable these plugins
+ -- for Linux and Mac
+ -- .tmux.conf syntax highlighting and setting check
+ {
+ "tmux-plugins/vim-tmux",
+ enabled = function()
+ if utils.executable("tmux") then
+ return true
+ end
+ return false
+ end,
+ ft = { "tmux" },
+ },
+
+ -- Modern matchit implementation
+ { "andymass/vim-matchup", event = "VimEnter" },
+ { "tpope/vim-scriptease", cmd = { "Scriptnames", "Message", "Verbose" } },
+
+ -- Asynchronous command execution
+ { "skywind3000/asyncrun.vim", lazy = true, cmd = { "AsyncRun" } },
+ { "cespare/vim-toml", ft = { "toml" }, branch = "main" },
+
+ -- Edit text area in browser using nvim
+ {
+ "glacambre/firenvim",
+ enabled = function()
+ if vim.g.is_win or vim.g.is_mac then
+ return true
+ end
+ return false
+ end,
+ build = function()
+ vim.fn["firenvim#install"](0)
+ end,
+ lazy = true,
+ },
+
+ -- Debugger plugin
+ {
+ "sakhnik/nvim-gdb",
+ enabled = function()
+ if vim.g.is_win or vim.g.is_linux then
+ return true
+ end
+ return false
+ end,
+ build = { "bash install.sh" },
+ lazy = true,
+ },
+
+ -- Session management plugin
+ { "tpope/vim-obsession", cmd = "Obsession" },
+
+ {
+ "ojroques/vim-oscyank",
+ enabled = function()
+ if vim.g.is_linux then
+ return true
+ end
+ return false
+ end,
+ cmd = { "OSCYank", "OSCYankReg" },
+ },
+
+ -- The missing auto-completion for cmdline!
+ { "gelguy/wilder.nvim" },
+
+ -- showing keybindings
+ {
+ "folke/which-key.nvim",
+ event = "VimEnter",
+ config = function()
+ vim.defer_fn(function()
+ require("config.which-key")
+ end, 2000)
+ end,
+ },
+
+ -- show and trim trailing whitespaces
+ { "jdhao/whitespace.nvim", event = "VimEnter" },
+
+ -- file explorer
+ {
+ "nvim-tree/nvim-tree.lua",
+ dependencies = { "nvim-tree/nvim-web-devicons" },
+ config = function()
+ require("config.nvim-tree")
+ end,
+ },
+
+ { "ii14/emmylua-nvim", ft = "lua" },
+ {
+ "j-hui/fidget.nvim",
+ tag = "legacy",
+ config = function()
+ require("config.fidget-nvim")
+ end,
+ },
+}