diff options
author | kylo252 <[email protected]> | 2021-11-27 15:22:43 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-11-27 15:22:43 +0100 |
commit | 24be0ef1ef36b8cc725655e920104e9676b72f25 (patch) | |
tree | 4b36a186c893844d6db4b99c5ed553179858f3d0 | |
parent | 044b53a6fed7ed2c477870883857a9742a2e1b98 (diff) |
chore: bump core-plugins version (#1989)
-rw-r--r-- | lua/lvim/core/nvimtree.lua | 4 | ||||
-rw-r--r-- | lua/lvim/plugin-loader.lua | 17 | ||||
-rw-r--r-- | lua/lvim/plugins.lua | 76 | ||||
-rw-r--r-- | lua/lvim/utils/init.lua | 32 | ||||
-rwxr-xr-x | utils/installer/install.sh | 19 |
5 files changed, 86 insertions, 62 deletions
diff --git a/lua/lvim/core/nvimtree.lua b/lua/lvim/core/nvimtree.lua index 08a73cdb..1fc93aea 100644 --- a/lua/lvim/core/nvimtree.lua +++ b/lua/lvim/core/nvimtree.lua @@ -29,6 +29,8 @@ function M.config() custom_only = false, }, }, + hide_dotfiles = false, + ignore = { ".git", "node_modules", ".cache" }, }, show_icons = { git = 1, @@ -37,9 +39,7 @@ function M.config() folder_arrows = 1, tree_width = 30, }, - ignore = { ".git", "node_modules", ".cache" }, quit_on_open = 0, - hide_dotfiles = 1, git_hl = 1, root_folder_modifier = ":t", allow_resize = 1, diff --git a/lua/lvim/plugin-loader.lua b/lua/lvim/plugin-loader.lua index ab7613c8..1ad4266b 100644 --- a/lua/lvim/plugin-loader.lua +++ b/lua/lvim/plugin-loader.lua @@ -1,12 +1,12 @@ local plugin_loader = {} +local in_headless = #vim.api.nvim_list_uis() == 0 + local utils = require "lvim.utils" local Log = require "lvim.core.log" -- we need to reuse this outside of init() local compile_path = get_config_dir() .. "/plugin/packer_compiled.lua" -local _, packer = pcall(require, "packer") - function plugin_loader.init(opts) opts = opts or {} @@ -18,10 +18,16 @@ function plugin_loader.init(opts) vim.cmd "packadd packer.nvim" end + local log_level = in_headless and "debug" or "warn" + if lvim.log and lvim.log.level then + log_level = lvim.log.level + end + + local _, packer = pcall(require, "packer") packer.init { package_root = package_root, compile_path = compile_path, - log = { level = "warn" }, + log = { level = log_level }, git = { clone_timeout = 300 }, max_jobs = 50, display = { @@ -59,6 +65,11 @@ end function plugin_loader.load(configurations) Log:debug "loading plugins configuration" + local packer_available, packer = pcall(require, "packer") + if not packer_available then + Log:warn "skipping loading plugins until Packer is installed" + return + end local status_ok, _ = xpcall(function() packer.startup(function(use) for _, plugins in ipairs(configurations) do diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua index 8af96e6e..6a131390 100644 --- a/lua/lvim/plugins.lua +++ b/lua/lvim/plugins.lua @@ -1,53 +1,53 @@ local commit = { - packer = "7f62848f3a92eac61ae61def5f59ddb5e2cc6823", - lsp_config = "903a1fbca91b74e6fbc905366ce38364b9d7ba98", - nlsp_settings = "29f49afe27b43126d45a05baf3161a28b929f2f1", - null_ls = "cf2bc3185af066cb25f1bf6faa99727e2c47ef77", - fix_cursor_hold = "0e4e22d21975da60b0fd2d302285b3b603f9f71e", - lsp_installer = "37d9326f4ca4093b04eabdb697fec3764e226f88", - nvim_notify = "ee79a5e2f8bde0ebdf99880a98d1312da83a3caa", - structlog = "6f1403a192791ff1fa7ac845a73de9e860f781f1", - popup = "f91d80973f80025d4ed00380f2e06c669dfda49d", - plenary = "96e821e8001c21bc904d3c15aa96a70c11462c5f", - telescope = "078a48db9e0720b07bfcb8b59342c5305a1d1fdc", - telescope_fzf_native = "59e38e1661ffdd586cb7fc22ca0b5a05c7caf988", - nvim_cmp = "ca6386854982199a532150cf3bd711395475ebd2", - friendly_snippets = "94f1d917435c71bc6494d257afa90d4c9449aed2", - autopairs = "f858ab38b532715dbaf7b2773727f8622ba04322", - treesitter = "47cfda2c6711077625c90902d7722238a8294982", - context_commentstring = "159c5b9a2cdb8a8fe342078b7ac8139de76bad62", - nvim_tree = "f92b7e7627c5a36f4af6814c408211539882c4f3", - gitsigns = "61a81b0c003de3e12555a5626d66fb6a060d8aca", - which_key = "d3032b6d3e0adb667975170f626cb693bfc66baa", - comment = "620445b87a0d1640fac6991f9c3338af8dec1884", - project = "3a1f75b18f214064515ffba48d1eb7403364cc6a", - nvim_web_devicons = "ee101462d127ed6a5561ce9ce92bfded87d7d478", - lualine = "3f5cdc51a08c437c7705e283eebd4cf9fbb18f80", barbar = "6e638309efcad2f308eb9c5eaccf6f62b794bbab", - dap = "dd778f65dc95323f781f291fb7c5bf3c17d057b1", - dap_install = "dd09e9dd3a6e29f02ac171515b8a089fb82bb425", - toggleterm = "5f9ba91157a25be5ee7395fbc11b1a8f25938365", - luasnip = "bab7cc2c32fba00776d2f2fc4704bed4eee2d082", + cmp_buffer = "a706dc69c49110038fe570e5c9c33d6d4f67015b", cmp_luasnip = "16832bb50e760223a403ffa3042859845dd9ef9d", - cmp_buffer = "d1ca295ce584ec80763a6dc043080874b57ccffc", - cmp_nvim_lsp = "accbe6d97548d8d3471c04d512d36fa61d0e4be8", - cmp_path = "97661b00232a2fe145fe48e295875bc3299ed1f7", + cmp_nvim_lsp = "134117299ff9e34adde30a735cd8ca9cf8f3db81", cmp_nvim_lua = "d276254e7198ab7d00f117e88e223b4bd8c02d21", + cmp_path = "81518cf6ae29f5f0c79cd47770ae90ff5225ee13", + comment = "a6e1c127fa7f19ec4e3edbffab1aacb2852b6db3", + dapinstall = "dd09e9dd3a6e29f02ac171515b8a089fb82bb425", + fixcursorhold = "0e4e22d21975da60b0fd2d302285b3b603f9f71e", + friendly_snippets = "0806607c4c49b6823cf4155cf0c30bc28934dea2", + gitsigns = "95845ef39ce0a98f68cdfdcf7dd586c5e965acc7", + lualine = "cf75e1af5a1cafaa0866cf8a11632f48b430115d", + luasnip = "f400b978b1dbca96e9e190b7009c415c09b8924c", + nlsp_settings = "1e75ac7733f6492b501a7594870cf75c4ee23e81", + null_ls = "b07ce47f02c7b12ad65bfb4da215c6380228a959", + nvim_autopairs = "fba2503bd8cd0d8861054523aae39c4ac0680c07", + nvim_cmp = "ca6386854982199a532150cf3bd711395475ebd2", + nvim_dap = "4e8bb7ca12dc8ca6f7a500cbb4ecea185665c7f1", + nvim_lsp_installer = "52183c68baf9019c8241b1abf33ba0b6594ab3c8", + nvim_lspconfig = "b53f89c16bcc8052aa56d3a903fcad3aaa774041", + nvim_notify = "54375b724637eb6f29085c582318ae1fd042e717", + nvim_tree = "5d8453dfbd34ab00cb3e8ce39660f9a54cdd35f3", + nvim_treesitter = "47cfda2c6711077625c90902d7722238a8294982", + nvim_ts_context_commentstring = "9f5e422e1030e7073e593ad32c5354aa0bcb0176", + nvim_web_devicons = "8df4988ecf8599fc1f8f387bbf2eae790e4c5ffb", + packer = "7f62848f3a92eac61ae61def5f59ddb5e2cc6823", + plenary = "1c31adb35fcebe921f65e5c6ff6d5481fa5fa5ac", + popup = "b7404d35d5d3548a82149238289fa71f7f6de4ac", + project = "71d0e23dcfc43cfd6bb2a97dc5a7de1ab47a6538", + structlog = "6f1403a192791ff1fa7ac845a73de9e860f781f1", + telescope = "b415e862bf248d66c40e242de4a0c76c68e278f1", + telescope_fzf_native = "b8662b076175e75e6497c59f3e2799b879d7b954", + toggleterm = "265bbff68fbb8b2a5fb011272ec469850254ec9f", + which_key = "d3032b6d3e0adb667975170f626cb693bfc66baa", } return { -- Packer can manage itself as an optional plugin { "wbthomason/packer.nvim", commit = commit.packer }, - { "neovim/nvim-lspconfig", commit = commit.lsp_config }, + { "neovim/nvim-lspconfig", commit = commit.nvim_lspconfig }, { "tamago324/nlsp-settings.nvim", commit = commit.nlsp_settings }, { "jose-elias-alvarez/null-ls.nvim", commit = commit.null_ls, }, - { "antoinemadec/FixCursorHold.nvim", commit = commit.fix_cursor_hold }, -- Needed while issue https://github.com/neovim/neovim/issues/12587 is still open + { "antoinemadec/FixCursorHold.nvim", commit = commit.fixcursorhold }, -- Needed while issue https://github.com/neovim/neovim/issues/12587 is still open { "williamboman/nvim-lsp-installer", - commit = commit.lsp_installer, + commit = commit.nvim_lsp_installer, }, { "rcarriga/nvim-notify", @@ -121,7 +121,7 @@ return { -- Autopairs { "windwp/nvim-autopairs", - commit = commit.autopairs, + commit = commit.nvim_autopairs, -- event = "InsertEnter", config = function() require("lvim.core.autopairs").setup() @@ -141,7 +141,7 @@ return { }, { "JoosepAlviste/nvim-ts-context-commentstring", - commit = commit.context_commentstring, + commit = commit.nvim_ts_context_commentstring, event = "BufReadPost", }, @@ -228,7 +228,7 @@ return { -- Debugging { "mfussenegger/nvim-dap", - commit = commit.dap, + commit = commit.nvim_dap, -- event = "BufWinEnter", config = function() require("lvim.core.dap").setup() @@ -239,7 +239,7 @@ return { -- Debugger management { "Pocco81/DAPInstall.nvim", - commit = commit.dap_install, + commit = commit.dapinstall, -- event = "BufWinEnter", -- event = "BufRead", disable = not lvim.builtin.dap.active, diff --git a/lua/lvim/utils/init.lua b/lua/lvim/utils/init.lua index bf04e149..d7affd4b 100644 --- a/lua/lvim/utils/init.lua +++ b/lua/lvim/utils/init.lua @@ -174,6 +174,34 @@ function utils.log_contains(query) return false end -return utils +function utils.generate_plugins_sha(output) + local list = {} + output = output or "commits.lua" + + local function git_cmd(args) + local Job = require "plenary.job" + local stderr = {} + local stdout, ret = Job + :new({ + command = "git", + args = args, + on_stderr = function(_, data) + table.insert(stderr, data) + end, + }) + :sync() + return ret, stdout + end --- TODO: find a new home for these autocommands + for name, plugin in pairs(_G.packer_plugins) do + local retval, latest_sha = git_cmd { "-C", plugin.path, "rev-parse", "@{-1}" } + if retval == 0 then + -- replace dashes, remove postfixes and use lowercase + local normalize_name = (name:gsub("-", "_"):gsub("%.%S+", "")):lower() + list[normalize_name] = latest_sha[1] + end + end + utils.write_file(output, "local commits = " .. vim.inspect(list), "w") +end + +return utils diff --git a/utils/installer/install.sh b/utils/installer/install.sh index e7631999..b6b7bc31 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -14,7 +14,6 @@ declare -r LUNARVIM_RUNTIME_DIR="${LUNARVIM_RUNTIME_DIR:-"$XDG_DATA_HOME/lunarvi declare -r LUNARVIM_CONFIG_DIR="${LUNARVIM_CONFIG_DIR:-"$XDG_CONFIG_HOME/lvim"}" # TODO: Use a dedicated cache directory #1256 declare -r LUNARVIM_CACHE_DIR="$XDG_CACHE_HOME/nvim" -declare -r LUNARVIM_PACK_DIR="$LUNARVIM_RUNTIME_DIR/site/pack" declare BASEDIR BASEDIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" @@ -114,8 +113,6 @@ function main() { done fi - install_packer - if [ -e "$LUNARVIM_RUNTIME_DIR/lvim/init.lua" ]; then update_lvim else @@ -280,18 +277,6 @@ function backup_old_config() { echo "Backup operation complete" } -function install_packer() { - if [ -e "$LUNARVIM_PACK_DIR/packer/start/packer.nvim" ]; then - msg "Packer already installed" - else - if ! git clone --depth 1 "https://github.com/wbthomason/packer.nvim" \ - "$LUNARVIM_PACK_DIR/packer/start/packer.nvim"; then - msg "Failed to clone Packer. Installation failed." - exit 1 - fi - fi -} - function clone_lvim() { msg "Cloning LunarVim configuration" if ! git clone --branch "$LV_BRANCH" \ @@ -351,10 +336,10 @@ function setup_lvim() { setup_shim - echo "Preparing Packer setup" - cp "$LUNARVIM_RUNTIME_DIR/lvim/utils/installer/config.example.lua" "$LUNARVIM_CONFIG_DIR/config.lua" + echo "Preparing Packer setup" + "$INSTALL_PREFIX/bin/lvim" --headless \ -c 'autocmd User PackerComplete quitall' \ -c 'PackerSync' |