diff options
author | kylo252 <[email protected]> | 2022-01-03 15:49:07 +0100 |
---|---|---|
committer | kylo252 <[email protected]> | 2022-01-03 15:49:07 +0100 |
commit | e5aa8be8ce54097e4a34220cb2aad114e70f209b (patch) | |
tree | 15e0a3017358b15a0656b6d1f98d2638ae572095 /utils | |
parent | 427ad868d404a254dcbc7d3950946dae0cf205de (diff) | |
parent | 21b41688ee8c5056ffbb2b07df141ce1ccb4b213 (diff) |
Merge branch 'rolling'
Diffstat (limited to 'utils')
-rw-r--r-- | utils/bin/lvim | 6 | ||||
-rw-r--r-- | utils/bin/lvim.template | 7 | ||||
-rw-r--r-- | utils/bin/test_runner.sh | 2 | ||||
-rw-r--r-- | utils/installer/config.example.lua | 5 | ||||
-rwxr-xr-x | utils/installer/install.sh | 38 | ||||
-rwxr-xr-x | utils/installer/install_bin.sh | 46 |
6 files changed, 53 insertions, 51 deletions
diff --git a/utils/bin/lvim b/utils/bin/lvim deleted file mode 100644 index e4cd9c75..00000000 --- a/utils/bin/lvim +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -export LUNARVIM_RUNTIME_DIR="${LUNARVIM_RUNTIME_DIR:-$HOME/.local/share/lunarvim}" -export LUNARVIM_CONFIG_DIR="${LUNARVIM_CONFIG_DIR:-$HOME/.config/lvim}" - -exec nvim -u "$LUNARVIM_RUNTIME_DIR/lvim/init.lua" "$@" diff --git a/utils/bin/lvim.template b/utils/bin/lvim.template new file mode 100644 index 00000000..1b18977d --- /dev/null +++ b/utils/bin/lvim.template @@ -0,0 +1,7 @@ +#!/bin/sh + +export LUNARVIM_RUNTIME_DIR="${LUNARVIM_RUNTIME_DIR:-RUNTIME_DIR_VAR}" +export LUNARVIM_CONFIG_DIR="${LUNARVIM_CONFIG_DIR:-CONFIG_DIR_VAR}" +export LUNARVIM_CACHE_DIR="${LUNARVIM_CACHE_DIR:-CACHE_DIR_VAR}" + +exec nvim -u "$LUNARVIM_RUNTIME_DIR/lvim/init.lua" "$@" diff --git a/utils/bin/test_runner.sh b/utils/bin/test_runner.sh index 6fc6858b..5b7f81ac 100644 --- a/utils/bin/test_runner.sh +++ b/utils/bin/test_runner.sh @@ -18,7 +18,7 @@ lvim() { if [ -n "$1" ]; then lvim --headless -c "lua require('plenary.busted').run('$1')" else - lvim --headless -c "PlenaryBustedDirectory tests/ { minimal_init = './tests/minimal_init.lua' }" + lvim --headless -c "PlenaryBustedDirectory tests/specs { minimal_init = './tests/minimal_init.lua' }" fi rm -rf "$TEST_BASE_DIR" diff --git a/utils/installer/config.example.lua b/utils/installer/config.example.lua index 03906ada..e3d9fa23 100644 --- a/utils/installer/config.example.lua +++ b/utils/installer/config.example.lua @@ -55,6 +55,7 @@ lvim.keys.normal_mode["<C-s>"] = ":w<cr>" -- TODO: User Config for predefined plugins -- After changing plugin config exit and reopen LunarVim, Run :PackerInstall :PackerCompile lvim.builtin.dashboard.active = true +lvim.builtin.notify.active = true lvim.builtin.terminal.active = true lvim.builtin.nvimtree.setup.view.side = "left" lvim.builtin.nvimtree.show_icons.git = 0 @@ -100,9 +101,7 @@ lvim.builtin.treesitter.highlight.enabled = true -- buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc") -- end -- you can overwrite the null_ls setup table (useful for setting the root_dir function) --- lvim.lsp.null_ls.setup = { --- root_dir = require("lspconfig").util.root_pattern("Makefile", ".git", "node_modules"), --- } +-- lvim.lsp.null_ls.setup.root_dir = require("lspconfig").util.root_pattern("Makefile", ".git", "node_modules") -- or if you need something more advanced -- lvim.lsp.null_ls.setup.root_dir = function(fname) -- if vim.bo.filetype == "javascript" then diff --git a/utils/installer/install.sh b/utils/installer/install.sh index 1dc77513..c30f2efe 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -171,12 +171,11 @@ function print_missing_dep_msg() { } function check_neovim_min_version() { - # TODO: consider locking the requirement to 0.6+ - local verify_version_cmd='if !has("nvim-0.5.1") | cquit | else | quit | endif' + local verify_version_cmd='if !has("nvim-0.6.0") | cquit | else | quit | endif' # exit with an error if min_version not found if ! nvim --headless -u NONE -c "$verify_version_cmd"; then - echo "[ERROR]: LunarVim requires at least Neovim v0.5.1 or higher" + echo "[ERROR]: LunarVim requires at least Neovim v0.6.0 or higher" exit 1 fi } @@ -223,19 +222,29 @@ function __install_nodejs_deps_yarn() { function __validate_node_installation() { local pkg_manager="$1" local manager_home - manager_home="$($pkg_manager config get prefix 2>/dev/null)" + + if ! command -v "$pkg_manager" &>/dev/null; then + return 1 + fi + + if [ "$pkg_manager" == "npm" ]; then + manager_home="$(npm config get prefix 2>/dev/null)" + else + manager_home="$(yarn global bin 2>/dev/null)" + fi if [ ! -d "$manager_home" ] || [ ! -w "$manager_home" ]; then - echo "[ERROR] Unable to install without administrative privilages. Please set you NPM_HOME correctly and try again." - exit 1 + echo "[ERROR] Unable to install using [$pkg_manager] without administrative privileges." + return 1 fi + + return 0 } function install_nodejs_deps() { local -a pkg_managers=("yarn" "npm") for pkg_manager in "${pkg_managers[@]}"; do - if command -v "$pkg_manager" &>/dev/null; then - __validate_node_installation "$pkg_manager" + if __validate_node_installation "$pkg_manager"; then eval "__install_nodejs_deps_$pkg_manager" return fi @@ -343,18 +352,7 @@ function link_local_lvim() { } function setup_shim() { - if [ ! -d "$INSTALL_PREFIX/bin" ]; then - mkdir -p "$INSTALL_PREFIX/bin" - fi - cat >"$INSTALL_PREFIX/bin/lvim" <<EOF -#!/bin/sh - -export LUNARVIM_CONFIG_DIR="\${LUNARVIM_CONFIG_DIR:-$LUNARVIM_CONFIG_DIR}" -export LUNARVIM_RUNTIME_DIR="\${LUNARVIM_RUNTIME_DIR:-$LUNARVIM_RUNTIME_DIR}" - -exec nvim -u "\$LUNARVIM_RUNTIME_DIR/lvim/init.lua" "\$@" -EOF - chmod +x "$INSTALL_PREFIX/bin/lvim" + make -C "$LUNARVIM_BASE_DIR" install-bin } function remove_old_cache_files() { diff --git a/utils/installer/install_bin.sh b/utils/installer/install_bin.sh index 2438d5d1..4c649b44 100755 --- a/utils/installer/install_bin.sh +++ b/utils/installer/install_bin.sh @@ -1,33 +1,37 @@ #!/usr/bin/env bash set -eo pipefail -declare -r INSTALL_PREFIX="${INSTALL_PREFIX:-"$HOME/.local"}" +INSTALL_PREFIX="${INSTALL_PREFIX:-"$HOME/.local"}" -declare -r XDG_DATA_HOME="${XDG_DATA_HOME:-"$HOME/.local/share"}" -declare -r XDG_CACHE_HOME="${XDG_CACHE_HOME:-"$HOME/.cache"}" -declare -r XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-"$HOME/.config"}" +XDG_DATA_HOME="${XDG_DATA_HOME:-"$HOME/.local/share"}" +XDG_CACHE_HOME="${XDG_CACHE_HOME:-"$HOME/.cache"}" +XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-"$HOME/.config"}" -declare -r LUNARVIM_RUNTIME_DIR="${LUNARVIM_RUNTIME_DIR:-"$XDG_DATA_HOME/lunarvim"}" -declare -r LUNARVIM_CONFIG_DIR="${LUNARVIM_CONFIG_DIR:-"$XDG_CONFIG_HOME/lvim"}" +LUNARVIM_RUNTIME_DIR="${LUNARVIM_RUNTIME_DIR:-"$XDG_DATA_HOME/lunarvim"}" +LUNARVIM_CONFIG_DIR="${LUNARVIM_CONFIG_DIR:-"$XDG_CONFIG_HOME/lvim"}" +LUNARVIM_CACHE_DIR="${LUNARVIM_CACHE_DIR:-"$XDG_CACHE_HOME/nvim"}" -# TODO: Use a dedicated cache directory #1256 -declare -r LUNARVIM_CACHE_DIR="$XDG_CACHE_HOME/nvim" +LUNARVIM_BASE_DIR="${LUNARVIM_BASE_DIR:-"$LUNARVIM_RUNTIME_DIR/lvim"}" function setup_shim() { - if [ ! -d "$INSTALL_PREFIX/bin" ]; then - mkdir -p "$INSTALL_PREFIX/bin" - fi - cat >"$INSTALL_PREFIX/bin/lvim" <<EOF -#!/bin/sh - -export LUNARVIM_CONFIG_DIR="\${LUNARVIM_CONFIG_DIR:-$LUNARVIM_CONFIG_DIR}" -export LUNARVIM_RUNTIME_DIR="\${LUNARVIM_RUNTIME_DIR:-$LUNARVIM_RUNTIME_DIR}" -export LUNARVIM_CACHE_DIR="\${LUNARVIM_CACHE_DIR:-$LUNARVIM_CACHE_DIR}" - -exec nvim -u "\$LUNARVIM_RUNTIME_DIR/lvim/init.lua" "\$@" -EOF - chmod +x "$INSTALL_PREFIX/bin/lvim" + local src="$LUNARVIM_BASE_DIR/utils/bin/lvim.template" + local dst="$INSTALL_PREFIX/bin/lvim" + + [ ! -d "$INSTALL_PREFIX/bin" ] && mkdir -p "$INSTALL_PREFIX/bin" + + # remove outdated installation so that `cp` doesn't complain + rm -f "$dst" + + cp "$src" "$dst" + + sed -e s"@RUNTIME_DIR_VAR@\"${LUNARVIM_RUNTIME_DIR}\"@"g \ + -e s"@CONFIG_DIR_VAR@\"${LUNARVIM_CONFIG_DIR}\"@"g \ + -e s"@CACHE_DIR_VAR@\"${LUNARVIM_CACHE_DIR}\"@"g "$src" \ + | tee "$dst" >/dev/null + + chmod u+x "$dst" } setup_shim "$@" + echo "You can start LunarVim by running: $INSTALL_PREFIX/bin/lvim" |