diff options
Diffstat (limited to 'utils/installer')
-rw-r--r-- | utils/installer/config.example.lua | 13 | ||||
-rw-r--r-- | utils/installer/config_win.example.lua | 11 | ||||
-rwxr-xr-x | utils/installer/install.sh | 51 | ||||
-rwxr-xr-x | utils/installer/install_bin.sh | 3 | ||||
-rwxr-xr-x | utils/installer/uninstall.sh | 11 |
5 files changed, 62 insertions, 27 deletions
diff --git a/utils/installer/config.example.lua b/utils/installer/config.example.lua index 26a50edc..ee599d1b 100644 --- a/utils/installer/config.example.lua +++ b/utils/installer/config.example.lua @@ -10,8 +10,8 @@ an executable -- general lvim.log.level = "warn" -lvim.format_on_save = true -lvim.colorscheme = "onedarker" +lvim.format_on_save = false +lvim.colorscheme = "tokyonight" -- to disable icons and use a minimalist setup, uncomment the following -- lvim.use_icons = false @@ -44,6 +44,10 @@ lvim.keys.normal_mode["<C-s>"] = ":w<cr>" -- }, -- } +-- Change theme settings +-- lvim.builtin.theme.options.dim_inactive = true +-- lvim.builtin.theme.options.style = "storm" + -- Use which-key to add extra bindings with the leader-key prefix -- lvim.builtin.which_key.mappings["P"] = { "<cmd>Telescope projects<CR>", "Projects" } -- lvim.builtin.which_key.mappings["t"] = { @@ -82,13 +86,13 @@ lvim.builtin.treesitter.ensure_installed = { } lvim.builtin.treesitter.ignore_install = { "haskell" } -lvim.builtin.treesitter.highlight.enabled = true +lvim.builtin.treesitter.highlight.enable = true -- generic LSP settings -- -- make sure server will always be installed even if the server is in skipped_servers list -- lvim.lsp.installer.setup.ensure_installed = { --- "sumeko_lua", +-- "sumneko_lua", -- "jsonls", -- } -- -- change UI setting of `LspInstallInfo` @@ -161,7 +165,6 @@ lvim.builtin.treesitter.highlight.enabled = true -- Additional Plugins -- lvim.plugins = { --- {"folke/tokyonight.nvim"}, -- { -- "folke/trouble.nvim", -- cmd = "TroubleToggle", diff --git a/utils/installer/config_win.example.lua b/utils/installer/config_win.example.lua index 872e6270..40cc34e8 100644 --- a/utils/installer/config_win.example.lua +++ b/utils/installer/config_win.example.lua @@ -28,7 +28,7 @@ vim.g.clipboard = { -- general lvim.log.level = "warn" lvim.format_on_save = true -lvim.colorscheme = "onedarker" +lvim.colorscheme = "tokyonight" -- to disable icons and use a minimalist setup, uncomment the following -- lvim.use_icons = false @@ -61,6 +61,10 @@ lvim.keys.normal_mode["<C-s>"] = ":w<cr>" -- }, -- } +-- Change theme settings +-- lvim.builtin.theme.options.dim_inactive = true +-- lvim.builtin.theme.options.style = "storm" + -- Use which-key to add extra bindings with the leader-key prefix -- lvim.builtin.which_key.mappings["P"] = { "<cmd>Telescope projects<CR>", "Projects" } -- lvim.builtin.which_key.mappings["t"] = { @@ -97,13 +101,13 @@ lvim.builtin.treesitter.ensure_installed = { } lvim.builtin.treesitter.ignore_install = { "haskell" } -lvim.builtin.treesitter.highlight.enabled = true +lvim.builtin.treesitter.highlight.enable = true -- generic LSP settings -- -- make sure server will always be installed even if the server is in skipped_servers list -- lvim.lsp.installer.setup.ensure_installed = { --- "sumeko_lua", +-- "sumneko_lua", -- "jsonls", -- } -- -- change UI setting of `LspInstallInfo` @@ -176,7 +180,6 @@ lvim.builtin.treesitter.highlight.enabled = true -- Additional Plugins -- lvim.plugins = { --- {"folke/tokyonight.nvim"}, -- { -- "folke/trouble.nvim", -- cmd = "TroubleToggle", diff --git a/utils/installer/install.sh b/utils/installer/install.sh index 620d46f5..87f60fd4 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -2,20 +2,20 @@ set -eo pipefail #Set branch to master unless specified by the user -declare LV_BRANCH="${LV_BRANCH:-"master"}" -declare -r LV_REMOTE="${LV_REMOTE:-lunarvim/lunarvim.git}" -declare -r INSTALL_PREFIX="${INSTALL_PREFIX:-"$HOME/.local"}" +declare -x LV_BRANCH="${LV_BRANCH:-"master"}" +declare -xr LV_REMOTE="${LV_REMOTE:-lunarvim/lunarvim.git}" +declare -xr 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"}" +declare -xr XDG_DATA_HOME="${XDG_DATA_HOME:-"$HOME/.local/share"}" +declare -xr XDG_CACHE_HOME="${XDG_CACHE_HOME:-"$HOME/.cache"}" +declare -xr 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"}" -declare -r LUNARVIM_CACHE_DIR="${LUNARVIM_CACHE_DIR:-"$XDG_CACHE_HOME/lvim"}" -declare -r LUNARVIM_BASE_DIR="${LUNARVIM_BASE_DIR:-"$LUNARVIM_RUNTIME_DIR/lvim"}" +declare -xr LUNARVIM_RUNTIME_DIR="${LUNARVIM_RUNTIME_DIR:-"$XDG_DATA_HOME/lunarvim"}" +declare -xr LUNARVIM_CONFIG_DIR="${LUNARVIM_CONFIG_DIR:-"$XDG_CONFIG_HOME/lvim"}" +declare -xr LUNARVIM_CACHE_DIR="${LUNARVIM_CACHE_DIR:-"$XDG_CACHE_HOME/lvim"}" +declare -xr LUNARVIM_BASE_DIR="${LUNARVIM_BASE_DIR:-"$LUNARVIM_RUNTIME_DIR/lvim"}" -declare -r LUNARVIM_LOG_LEVEL="${LUNARVIM_LOG_LEVEL:-warn}" +declare -xr LUNARVIM_LOG_LEVEL="${LUNARVIM_LOG_LEVEL:-warn}" declare BASEDIR BASEDIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" @@ -51,7 +51,7 @@ function usage() { echo " -l, --local Install local copy of LunarVim" echo " -y, --yes Disable confirmation prompts (answer yes to all questions)" echo " --overwrite Overwrite previous LunarVim configuration (a backup is always performed first)" - echo " --[no]-install-dependencies Whether to automatically install external dependencies (will prompt by default)" + echo " --[no-]install-dependencies Whether to automatically install external dependencies (will prompt by default)" } function parse_arguments() { @@ -201,11 +201,11 @@ function print_missing_dep_msg() { } function check_neovim_min_version() { - local verify_version_cmd='if !has("nvim-0.7") | cquit | else | quit | endif' + local verify_version_cmd='if !has("nvim-0.8") | 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.7 or higher" + echo "[ERROR]: LunarVim requires at least Neovim v0.8 or higher" exit 1 fi } @@ -395,7 +395,7 @@ function backup_old_config() { function clone_lvim() { msg "Cloning LunarVim configuration" if ! git clone --branch "$LV_BRANCH" \ - --depth 1 "https://github.com/${LV_REMOTE}" "$LUNARVIM_BASE_DIR"; then + "https://github.com/${LV_REMOTE}" "$LUNARVIM_BASE_DIR"; then echo "Failed to clone repository. Installation failed." exit 1 fi @@ -439,12 +439,14 @@ function setup_lvim() { setup_shim - cp "$LUNARVIM_BASE_DIR/utils/installer/config.example.lua" "$LUNARVIM_CONFIG_DIR/config.lua" + create_desktop_file + + [ ! -f "$LUNARVIM_CONFIG_DIR/config.lua" ] \ + && cp "$LUNARVIM_BASE_DIR/utils/installer/config.example.lua" "$LUNARVIM_CONFIG_DIR/config.lua" echo "Preparing Packer setup" "$INSTALL_PREFIX/bin/lvim" --headless \ - -c "lua require('lvim.core.log'):set_level([[$LUNARVIM_LOG_LEVEL]])" \ -c 'autocmd User PackerComplete quitall' \ -c 'PackerSync' @@ -453,6 +455,21 @@ function setup_lvim() { verify_core_plugins } +function create_desktop_file() { + OS="$(uname -s)" + # TODO: Any other OSes that use desktop files? + ([ "$OS" != "Linux" ] || ! command -v xdg-desktop-menu &>/dev/null) && return + echo "Creating desktop file" + + for d in "$LUNARVIM_BASE_DIR"/utils/desktop/*/; do + size_folder=$(basename "$d") + mkdir -p "$XDG_DATA_HOME/icons/hicolor/$size_folder/apps/" + cp "$LUNARVIM_BASE_DIR/utils/desktop/$size_folder/lvim.svg" "$XDG_DATA_HOME/icons/hicolor/$size_folder/apps" + done + + xdg-desktop-menu install --novendor "$LUNARVIM_BASE_DIR/utils/desktop/lvim.desktop" +} + function print_logo() { cat <<'EOF' diff --git a/utils/installer/install_bin.sh b/utils/installer/install_bin.sh index c6ad5181..920f2fd5 100755 --- a/utils/installer/install_bin.sh +++ b/utils/installer/install_bin.sh @@ -26,7 +26,8 @@ function setup_shim() { 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" \ + -e s"#CACHE_DIR_VAR#\"${LUNARVIM_CACHE_DIR}\"#"g \ + -e s"#BASE_DIR_VAR#\"${LUNARVIM_BASE_DIR}\"#"g "$src" \ | tee "$dst" >/dev/null chmod u+x "$dst" diff --git a/utils/installer/uninstall.sh b/utils/installer/uninstall.sh index 8fc8e693..597bbf85 100755 --- a/utils/installer/uninstall.sh +++ b/utils/installer/uninstall.sh @@ -60,12 +60,23 @@ function remove_lvim_bin() { rm -f "$lvim_bin" } +function remove_desktop_file() { + OS="$(uname -s)" + # TODO: Any other OSes that use desktop files? + ([ "$OS" != "Linux" ] || ! command -v xdg-desktop-menu &>/dev/null) && return + echo "Removing desktop file..." + + find "$XDG_DATA_HOME/icons/hicolor" -name "lvim.svg" -type f -delete + xdg-desktop-menu uninstall lvim.desktop +} + function main() { parse_arguments "$@" echo "Removing LunarVim binary..." remove_lvim_bin echo "Removing LunarVim directories..." remove_lvim_dirs + remove_desktop_file echo "Uninstalled LunarVim!" } |