summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/bin/lvim2
-rw-r--r--utils/bin/lvim.ps19
-rw-r--r--utils/bin/test_runner.sh20
-rw-r--r--utils/ci/run_commitlint.sh10
-rw-r--r--utils/desktop/lvim.desktop2
-rw-r--r--utils/docker/Dockerfile11
-rw-r--r--utils/docker/Dockerfile.local27
-rw-r--r--utils/docker/Dockerfile.remote27
-rwxr-xr-xutils/docker/script.sh23
-rw-r--r--utils/installer/config.example-no-ts.lua4
-rw-r--r--utils/installer/config.example.lua36
-rwxr-xr-xutils/installer/install-neovim-from-release2
-rw-r--r--utils/installer/install.ps1279
-rwxr-xr-xutils/installer/install.sh277
-rwxr-xr-xutils/installer/install_bin.sh33
-rw-r--r--utils/installer/uninstall.ps11
-rwxr-xr-xutils/installer/uninstall.sh2
-rwxr-xr-xutils/media/demo.pngbin876670 -> 0 bytes
-rwxr-xr-xutils/media/demo1.pngbin0 -> 249203 bytes
-rwxr-xr-xutils/media/demo2.pngbin0 -> 817380 bytes
-rwxr-xr-xutils/media/demo3.pngbin0 -> 491134 bytes
-rwxr-xr-x[-rw-r--r--]utils/media/lunarvim_logo_dark.pngbin37510 -> 90789 bytes
-rw-r--r--utils/vscode_config/settings.json2
23 files changed, 613 insertions, 154 deletions
diff --git a/utils/bin/lvim b/utils/bin/lvim
index 2303be3c..e4cd9c75 100644
--- a/utils/bin/lvim
+++ b/utils/bin/lvim
@@ -1,6 +1,6 @@
#!/bin/sh
export LUNARVIM_RUNTIME_DIR="${LUNARVIM_RUNTIME_DIR:-$HOME/.local/share/lunarvim}"
-export LUNARVIM_CONFIG_DIR="${LUNARVIM_RUNTIME_DIR:-$HOME/.config/lvim}"
+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.ps1 b/utils/bin/lvim.ps1
new file mode 100644
index 00000000..e220e8ec
--- /dev/null
+++ b/utils/bin/lvim.ps1
@@ -0,0 +1,9 @@
+$env:XDG_DATA_HOME = ($env:XDG_DATA_HOME, "$env:APPDATA", 1 -ne $null)[0]
+$env:XDG_CONFIG_HOME = ($env:XDG_CONFIG_HOME, "$LOCALAPPDATA", 1 -ne $null)[0]
+$env:XDG_CACHE_HOME = ($env:XDG_CACHE_HOME, "$TEMP", 1 -ne $null)[0]
+
+$env:LUNARVIM_RUNTIME_DIR = ($env:LUNARVIM_RUNTIME_DIR, "$env:XDG_DATA_HOME\lunarvim", 1 -ne $null)[0]
+$env:LUNARVIM_CONFIG_DIR = ($env:LUNARVIM_CONFIG_DIR, "$env:XDG_CONFIG_HOME\lvim", 1 -ne $null)[0]
+$env:LUNARVIM_CACHE_DIR = ($env:LUNARVIM_CACHE_DIR, "$env:XDG_CACHE_HOME\lvim", 1 -ne $null)[0]
+
+nvim -u "$env:LUNARVIM_RUNTIME_DIR\lvim\init.lua"
diff --git a/utils/bin/test_runner.sh b/utils/bin/test_runner.sh
new file mode 100644
index 00000000..ee138345
--- /dev/null
+++ b/utils/bin/test_runner.sh
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+set -e
+
+export LUNARVIM_CONFIG_DIR="${LUNARVIM_CONFIG_DIR:-"$HOME/.config/lvim"}"
+export LUNARVIM_RUNTIME_DIR="${LUNARVIM_RUNTIME_DIR:-"$HOME/.local/share/lunarvim"}"
+
+export LVIM_TEST_ENV=true
+
+rm -f "$LUNARVIM_CONFIG_DIR/plugin/packer_compiled.lua"
+
+lvim() {
+ # TODO: allow running with a minimal_init.lua
+ nvim -u "$LUNARVIM_RUNTIME_DIR/lvim/tests/minimal_init.lua" --cmd "set runtimepath+=$LUNARVIM_RUNTIME_DIR/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' }"
+fi
diff --git a/utils/ci/run_commitlint.sh b/utils/ci/run_commitlint.sh
new file mode 100644
index 00000000..b752956d
--- /dev/null
+++ b/utils/ci/run_commitlint.sh
@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+set -eo pipefail
+
+REPO_DIR="$(git rev-parse --show-toplevel)"
+HELP_URL="https://github.com/LunarVim/LunarVim/blob/rolling/CONTRIBUTING.md#commit-messages"
+CONFIG="$REPO_DIR/.github/workflows/commitlint.config.js"
+
+if ! npx commitlint --edit --verbose --help-url "$HELP_URL" --config "$CONFIG"; then
+ exit 1
+fi
diff --git a/utils/desktop/lvim.desktop b/utils/desktop/lvim.desktop
index f4a51b10..f570cfae 100644
--- a/utils/desktop/lvim.desktop
+++ b/utils/desktop/lvim.desktop
@@ -4,7 +4,7 @@ GenericName=Text Editor
Comment=An IDE layer for Neovim with sane defaults. Completely free and community driven.
TryExec=lvim
Exec=lvim %F
-Terminal=false
+Terminal=true
Type=Application
Keywords=Text;editor;
Icon=nvim
diff --git a/utils/docker/Dockerfile b/utils/docker/Dockerfile
deleted file mode 100644
index 58760001..00000000
--- a/utils/docker/Dockerfile
+++ /dev/null
@@ -1,11 +0,0 @@
-FROM python:3
-
-SHELL ["/bin/bash", "-c"]
-
-ENV DEBIAN_FRONTEND=noninteractive
-
-COPY script.sh /tmp/script.sh
-
-RUN bash -c "/tmp/script.sh"
-
-ENTRYPOINT ["/bin/bash"]
diff --git a/utils/docker/Dockerfile.local b/utils/docker/Dockerfile.local
new file mode 100644
index 00000000..c219e34f
--- /dev/null
+++ b/utils/docker/Dockerfile.local
@@ -0,0 +1,27 @@
+# To run this file execute:
+# docker build -f <Path to this file> <Path to Lunarvim basedir> -t Lunarvim:local
+
+FROM ubuntu:latest
+
+# Set environment correctly
+ENV DEBIAN_FRONTEND=noninteractive
+ENV PATH="/root/.local/bin:/root/.cargo/bin:/root/.npm-global/bin${PATH}"
+
+# Copy in local directory
+COPY --chown=root:root . /LunarVim
+
+# Install dependencies and LunarVim
+RUN apt update && \
+ apt -y install sudo curl build-essential git fzf python3-dev python3-pip cargo && \
+ curl -fsSL https://deb.nodesource.com/setup_16.x | bash - && \
+ apt update && \
+ apt -y install nodejs && \
+ apt clean && rm -rf /var/lib/apt/lists/* /tmp/* && \
+ /LunarVim/utils/installer/install-neovim-from-release && \
+ /LunarVim/utils/installer/install.sh --local --no-install-dependencies
+
+# Setup LVIM to run on starup
+ENTRYPOINT ["/bin/bash"]
+CMD ["lvim"]
+
+# vim: ft=dockerfile:
diff --git a/utils/docker/Dockerfile.remote b/utils/docker/Dockerfile.remote
new file mode 100644
index 00000000..94765c48
--- /dev/null
+++ b/utils/docker/Dockerfile.remote
@@ -0,0 +1,27 @@
+# To run this file execute:
+# docker build -f Dockerfile.remote . -t Lunarvim:remote
+
+FROM ubuntu:latest
+
+# Build argument to point to correct branch on GitHub
+ARG LV_BRANCH=rolling
+
+# Set environment correctly
+ENV DEBIAN_FRONTEND=noninteractive
+ENV PATH="/root/.local/bin:/root/.cargo/bin:/root/.npm-global/bin${PATH}"
+
+# Install dependencies and LunarVim
+RUN apt update && \
+ apt -y install sudo curl build-essential git fzf python3-dev python3-pip cargo && \
+ curl -fsSL https://deb.nodesource.com/setup_16.x | bash - && \
+ apt update && \
+ apt -y install nodejs && \
+ apt clean && rm -rf /var/lib/apt/lists/* /tmp/* && \
+ curl -LSs https://raw.githubusercontent.com/lunarvim/lunarvim/${LV_BRANCH}/utils/installer/install-neovim-from-release | bash && \
+ LV_BRANCH=${LV_BRANCH} curl -LSs https://raw.githubusercontent.com/lunarvim/lunarvim/${LV_BRANCH}/utils/installer/install.sh | bash -s -- --no-install-dependencies
+
+# Setup LVIM to run on starup
+ENTRYPOINT ["/bin/bash"]
+CMD ["lvim"]
+
+# vim: ft=dockerfile:
diff --git a/utils/docker/script.sh b/utils/docker/script.sh
deleted file mode 100755
index 35257147..00000000
--- a/utils/docker/script.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-
-# Updating the package list
-apt-get update
-
-# Installing dependencies
-apt-get -y install tzdata sudo git nodejs npm git ripgrep fzf ranger curl fonts-hack-ttf
-
-pip3 install ueberzug neovim-remote
-npm install tree-sitter-cli neovim
-
-# Installing Neovim
-mkdir -p /tmp/neovim
-cd /tmp/neovim || exit
-curl -L -o nvim.appimage https://github.com/neovim/neovim/releases/download/nightly/nvim.appimage
-chmod u+x nvim.appimage
-./nvim.appimage --appimage-extract
-mv squashfs-root /usr/local/neovim
-ln -s /usr/local/neovim/usr/bin/nvim /usr/bin/nvim
-rm ./nvim.appimage
-
-# Installing LunarVim
-LVBRANCH=master bash <(curl -s https://raw.githubusercontent.com/lunarvim/lunarvim/rolling/utils/installer/install.sh)
diff --git a/utils/installer/config.example-no-ts.lua b/utils/installer/config.example-no-ts.lua
index aad13fe0..17bb0217 100644
--- a/utils/installer/config.example-no-ts.lua
+++ b/utils/installer/config.example-no-ts.lua
@@ -3,7 +3,7 @@
-- general
lvim.format_on_save = true
lvim.lint_on_save = true
-lvim.colorscheme = "spacegray"
+lvim.colorscheme = "onedarker"
-- keymappings [view all the defaults by pressing <leader>Lk]
lvim.leader = "space"
@@ -43,7 +43,7 @@ lvim.keys.normal_mode["<C-s>"] = ":w<cr>"
-- After changing plugin config exit and reopen LunarVim, Run :PackerInstall :PackerCompile
lvim.builtin.dashboard.active = true
lvim.builtin.terminal.active = true
-lvim.builtin.nvimtree.side = "left"
+lvim.builtin.nvimtree.setup.view.side = "left"
lvim.builtin.nvimtree.show_icons.git = 0
-- if you don't want all the parsers change this to a table of the ones you want
diff --git a/utils/installer/config.example.lua b/utils/installer/config.example.lua
index c2c75fbb..346fac98 100644
--- a/utils/installer/config.example.lua
+++ b/utils/installer/config.example.lua
@@ -11,8 +11,7 @@ an executable
-- general
lvim.log.level = "warn"
lvim.format_on_save = true
-lvim.lint_on_save = true
-lvim.colorscheme = "spacegray"
+lvim.colorscheme = "onedarker"
-- keymappings [view all the defaults by pressing <leader>Lk]
lvim.leader = "space"
@@ -42,21 +41,34 @@ lvim.keys.normal_mode["<C-s>"] = ":w<cr>"
-- name = "+Trouble",
-- r = { "<cmd>Trouble lsp_references<cr>", "References" },
-- f = { "<cmd>Trouble lsp_definitions<cr>", "Definitions" },
--- d = { "<cmd>Trouble lsp_document_diagnostics<cr>", "Diagnosticss" },
+-- d = { "<cmd>Trouble lsp_document_diagnostics<cr>", "Diagnostics" },
-- q = { "<cmd>Trouble quickfix<cr>", "QuickFix" },
-- l = { "<cmd>Trouble loclist<cr>", "LocationList" },
--- w = { "<cmd>Trouble lsp_workspace_diagnostics<cr>", "Diagnosticss" },
+-- w = { "<cmd>Trouble lsp_workspace_diagnostics<cr>", "Diagnostics" },
-- }
-- TODO: User Config for predefined plugins
-- After changing plugin config exit and reopen LunarVim, Run :PackerInstall :PackerCompile
lvim.builtin.dashboard.active = true
lvim.builtin.terminal.active = true
-lvim.builtin.nvimtree.side = "left"
+lvim.builtin.nvimtree.setup.view.side = "left"
lvim.builtin.nvimtree.show_icons.git = 0
-- if you don't want all the parsers change this to a table of the ones you want
-lvim.builtin.treesitter.ensure_installed = "maintained"
+lvim.builtin.treesitter.ensure_installed = {
+ "bash",
+ "c",
+ "javascript",
+ "json",
+ "lua",
+ "python",
+ "typescript",
+ "css",
+ "rust",
+ "java",
+ "yaml",
+}
+
lvim.builtin.treesitter.ignore_install = { "haskell" }
lvim.builtin.treesitter.highlight.enabled = true
@@ -90,24 +102,22 @@ lvim.builtin.treesitter.highlight.enabled = true
-- lvim.lang.python.formatters = {
-- {
-- exe = "black",
--- args = {}
-- }
-- }
-- set an additional linter
-- lvim.lang.python.linters = {
-- {
-- exe = "flake8",
--- args = {}
-- }
-- }
-- Additional Plugins
-- lvim.plugins = {
--- {"folke/tokyonight.nvim"}, {
--- "ray-x/lsp_signature.nvim",
--- config = function() require"lsp_signature".on_attach() end,
--- event = "InsertEnter"
--- }
+-- {"folke/tokyonight.nvim"},
+-- {
+-- "folke/trouble.nvim",
+-- cmd = "TroubleToggle",
+-- },
-- }
-- Autocommands (https://neovim.io/doc/user/autocmd.html)
diff --git a/utils/installer/install-neovim-from-release b/utils/installer/install-neovim-from-release
index a2ba0513..e20a4804 100755
--- a/utils/installer/install-neovim-from-release
+++ b/utils/installer/install-neovim-from-release
@@ -52,7 +52,7 @@ function download_neovim() {
function verify_neovim() {
echo "Verifying the installation.."
- DOWNLOADED_SHA="$(sha256sum "$DOWNLOAD_DIR/$ARCHIVE_NAME.tar.gz" | awk '{print $1}')"
+ DOWNLOADED_SHA="$(openssl dgst -sha256 "$DOWNLOAD_DIR/$ARCHIVE_NAME.tar.gz" | awk '{print $2}')"
if [ "$RELEASE_SHA" != "$DOWNLOADED_SHA" ]; then
echo "Error! checksum mis-match."
diff --git a/utils/installer/install.ps1 b/utils/installer/install.ps1
new file mode 100644
index 00000000..9f861125
--- /dev/null
+++ b/utils/installer/install.ps1
@@ -0,0 +1,279 @@
+$ErrorActionPreference = "Stop" # exit when command fails
+
+# set script variables
+$LV_BRANCH = ($LV_BRANCH, "rolling", 1 -ne $null)[0]
+$LV_REMOTE = ($LV_REMOTE, "lunarvim/lunarvim.git", 1 -ne $null)[0]
+$INSTALL_PREFIX = ($INSTALL_PREFIX, "$HOME\.local", 1 -ne $null)[0]
+
+$env:XDG_DATA_HOME = ($env:XDG_DATA_HOME, "$env:APPDATA", 1 -ne $null)[0]
+$env:XDG_CONFIG_HOME = ($env:XDG_CONFIG_HOME, "$LOCALAPPDATA", 1 -ne $null)[0]
+$env:XDG_CACHE_HOME = ($env:XDG_CACHE_HOME, "$TEMP", 1 -ne $null)[0]
+$env:LUNARVIM_RUNTIME_DIR = ($env:LUNARVIM_RUNTIME_DIR, "$env:XDG_DATA_HOME\lunarvim", 1 -ne $null)[0]
+$env:LUNARVIM_CONFIG_DIR = ($env:LUNARVIM_CONFIG_DIR, "$env:XDG_CONFIG_HOME\lvim", 1 -ne $null)[0]
+$env:LUNARVIM_CACHE_DIR = ($env:LUNARVIM_CACHE_DIR, "$env:XDG_CACHE_HOME\lvim", 1 -ne $null)[0]
+
+
+$__lvim_dirs = (
+ "$env:LUNARVIM_CONFIG_DIR",
+ "$env:LUNARVIM_RUNTIME_DIR",
+ "$env:LUNARVIM_CACHE_DIR"
+)
+
+function main($cliargs) {
+ Write-Output "
+
+ 88\ 88\
+ 88 | \__|
+ 88 |88\ 88\ 888888$\ 888888\ 888888\ 88\ 88\ 88\ 888888\8888\
+ 88 |88 | 88 |88 __88\ \____88\ 88 __88\\88\ 88 |88 |88 _88 _88\
+ 88 |88 | 88 |88 | 88 | 888888$ |88 | \__|\88\88 / 88 |88 / 88 / 88 |
+ 88 |88 | 88 |88 | 88 |88 __88 |88 | \88$ / 88 |88 | 88 | 88 |
+ 88 |\888888 |88 | 88 |\888888$ |88 | \$ / 88 |88 | 88 | 88 |
+ \__| \______/ \__| \__| \_______|\__| \_/ \__|\__| \__| \__|
+
+ "
+
+ __add_separator "80"
+
+ # skip this in a Github workflow
+ if ( $null -eq "$GITHUB_ACTIONS" ) {
+ install_packer
+ setup_shim
+ exit
+ }
+
+ __add_separator "80"
+
+ check_system_deps
+
+ Write-Output "Would you like to check lunarvim's NodeJS dependencies?"
+ $answer = Read-Host "[y]es or [n]o (default: no) "
+ if ("$answer" -eq "y" -or "$answer" -eq "Y") {
+ install_nodejs_deps
+ }
+
+ Write-Output "Would you like to check lunarvim's Python dependencies?"
+ $answer = Read-Host "[y]es or [n]o (default: no) "
+ if ("$answer" -eq "y" -or "$answer" -eq "Y") {
+ install_python_deps
+ }
+
+ __add_separator "80"
+
+ Write-Output "Backing up old LunarVim configuration"
+ backup_old_config
+
+ __add_separator "80"
+
+ if ($cliargs.Contains("--overwrite")) {
+ Write-Output "!!Warning!! -> Removing all lunarvim related config because of the --overwrite flag"
+ $answer = Read-Host "Would you like to continue? [y]es or [n]o "
+ if ("$answer" -ne "y" -and "$answer" -ne "Y") {
+ exit 1
+ }
+
+ foreach ($dir in $__lvim_dirs) {
+ if (Test-Path "$dir") {
+ Remove-Item -Force -Recurse "$dir"
+ }
+ }
+ }
+
+ if (Test-Path "$env:LUNARVIM_RUNTIME_DIR\site\pack\packer\start\packer.nvim") {
+ Write-Output "Packer already installed"
+ }
+ else {
+ install_packer
+ }
+
+ __add_separator "80"
+
+ if (Test-Path "$env:LUNARVIM_RUNTIME_DIR\lvim\init.lua" ) {
+ Write-Output "Updating LunarVim"
+ update_lvim
+ }
+ else {
+ if ($cliargs.Contains("--testing")) {
+ copy_local_lvim_repository
+ }
+ else {
+ clone_lvim
+ }
+ setup_lvim
+ }
+
+ __add_separator "80"
+}
+
+function print_missing_dep_msg($dep) {
+ Write-Output "[ERROR]: Unable to find dependency [$dep]"
+ Write-Output "Please install it first and re-run the installer. Try: $RECOMMEND_INSTALL $dep"
+}
+
+function install_system_package($dep) {
+ if (Get-Command -Name "winget" -ErrorAction SilentlyContinue) {
+ Write-Output "[INFO]: Attempting to install dependency [$dep] with winget"
+ $install_cmd = "winget install --interactive"
+ }
+ elseif (Get-Command -Name "scoop" -ErrorAction SilentlyContinue) {
+ Write-Output "[INFO]: Attempting to install dependency [$dep] with scoop"
+ # TODO: check if it's fine to not run it with --global
+ $install_cmd = "scoop install"
+ }
+ else {
+ print_missing_dep_msg "$dep"
+ exit 1
+ }
+
+ try {
+ Invoke-Command $install_cmd $dep -ErrorAction Stop
+ }
+ catch {
+ print_missing_dep_msg "$dep"
+ exit 1
+ }
+}
+
+function check_system_dep($dep) {
+ try {
+ Get-Command -Name $dep -ErrorAction Stop | Out-Null
+ }
+ catch {
+ install_system_package "$dep"
+ }
+}
+
+function check_system_deps() {
+ Write-Output "[INFO]: Checking dependencies.."
+ check_system_dep "git"
+ check_system_dep "nvim"
+
+}
+
+function install_nodejs_deps() {
+ try {
+ check_system_dep "node"
+ Invoke-Command npm install -g neovim tree-sitter-cli -ErrorAction Break
+ }
+ catch {
+ print_missing_dep_msg "$dep"
+ }
+}
+
+function install_python_deps() {
+ try {
+ check_system_dep "pip"
+ Invoke-Command python -m pip install --user pynvim -ErrorAction Break
+ }
+ catch {
+ print_missing_dep_msg "$dep"
+ }
+}
+
+function backup_old_config() {
+ foreach ($dir in $__lvim_dirs) {
+ # we create an empty folder for subsequent commands \
+ # that require an existing directory
+ if ( Test-Path "$dir") {
+ New-Item "$dir.bak" -ItemType Directory -Force
+ Copy-Item -Recurse "$dir\*" "$dir.bak\."
+ }
+ }
+
+ Write-Output "Backup operation complete"
+}
+
+
+function install_packer() {
+ Invoke-Command -ErrorAction Stop -ScriptBlock { git clone --progress --depth 1 "https://github.com/wbthomason/packer.nvim" "$env:LUNARVIM_RUNTIME_DIR\site\pack\packer\start\packer.nvim" }
+}
+
+function copy_local_lvim_repository() {
+ Write-Output "Copy local LunarVim configuration"
+ Copy-Item -Path "$((Get-Item $PWD).Parent.Parent.FullName)" -Destination "$env:LUNARVIM_RUNTIME_DIR/lvim" -Recurse
+}
+
+function clone_lvim() {
+ Write-Output "Cloning LunarVim configuration"
+ try {
+ Invoke-Command -ErrorAction Stop -ScriptBlock { git clone --progress --branch "$LV_BRANCH" --depth 1 "https://github.com/$LV_REMOTE" "$env:LUNARVIM_RUNTIME_DIR/lvim" }
+ }
+ catch {
+ Write-Output "Failed to clone repository. Installation failed."
+ exit 1
+ }
+}
+
+function setup_shim() {
+ if ((Test-Path "$INSTALL_PREFIX\bin") -eq $false) {
+ New-Item "$INSTALL_PREFIX\bin" -ItemType Directory
+ }
+ Copy-Item "$env:LUNARVIM_RUNTIME_DIR\lvim\utils\bin\lvim.ps1" -Destination "$INSTALL_PREFIX\bin\lvim.ps1" -Force
+}
+
+function setup_lvim() {
+ Write-Output "Installing LunarVim shim"
+
+ setup_shim
+
+ Write-Output "Preparing Packer setup"
+
+ if ((Test-Path "$env:LUNARVIM_CONFIG_DIR") -eq $false) {
+ New-Item "$env:LUNARVIM_CONFIG_DIR" -ItemType Directory
+ }
+
+ Copy-Item "$env:LUNARVIM_RUNTIME_DIR\lvim\utils\installer\config.example-no-ts.lua" `
+ "$env:LUNARVIM_CONFIG_DIR\config.lua"
+
+ Write-Output "Packer setup complete"
+
+ __add_separator "80"
+
+ Copy-Item "$env:LUNARVIM_RUNTIME_DIR\lvim\utils\installer\config.example.lua" "$env:LUNARVIM_CONFIG_DIR\config.lua"
+
+ $answer = Read-Host $(`
+ "Would you like to create an alias inside your Powershell profile?`n" +`
+ "(This enables you to start lvim with the command 'lvim') [y]es or [n]o (default: no)" )
+ if ("$answer" -eq "y" -and "$answer" -eq "Y") {
+ create_alias
+ }
+
+ __add_separator "80"
+
+ Write-Output "Thank you for installing LunarVim!!"
+ Write-Output "You can start it by running: $INSTALL_PREFIX\bin\lvim.ps1"
+ Write-Output "Do not forget to use a font with glyphs (icons) support [https://github.com/ryanoasis/nerd-fonts]"
+}
+
+
+function update_lvim() {
+ try {
+ Invoke-Command git -C "$env:LUNARVIM_RUNTIME_DIR/lvim" status -uno
+ }
+ catch {
+ git -C "$env:LUNARVIM_RUNTIME_DIR/lvim" pull --ff-only --progress -or
+ Write-Output "Unable to guarantee data integrity while updating. Please do that manually instead."
+ exit 1
+ }
+ Write-Output "Your LunarVim installation is now up to date!"
+}
+
+function __add_separator($div_width) {
+ "-" * $div_width
+ Write-Output ""
+}
+
+function create_alias {
+ if($null -eq $(Get-Alias | Select-String "lvim")){
+ Add-Content -Path $PROFILE -Value $(-join @('Set-Alias lvim "', "$INSTALL_PREFIX", '\bin\lvim.ps1"'))
+
+ Write-Output ""
+ Write-Host 'To use the new alias in this window reload your profile with ". $PROFILE".' -ForegroundColor Yellow
+
+ }else {
+ Write-Output "Alias is already set and will not be reset."
+ }
+}
+
+main "$args"
+
diff --git a/utils/installer/install.sh b/utils/installer/install.sh
index ec9813cf..aaee515d 100755
--- a/utils/installer/install.sh
+++ b/utils/installer/install.sh
@@ -2,7 +2,7 @@
set -eo pipefail
#Set branch to master unless specified by the user
-declare -r LV_BRANCH="${LV_BRANCH:-rolling}"
+declare LV_BRANCH="${LV_BRANCH:-"rolling"}"
declare -r LV_REMOTE="${LV_REMOTE:-lunarvim/lunarvim.git}"
declare -r INSTALL_PREFIX="${INSTALL_PREFIX:-"$HOME/.local"}"
@@ -10,16 +10,25 @@ 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"}"
-# TODO: Use a dedicated cache directory #1256
-declare -r NEOVIM_CACHE_DIR="$XDG_CACHE_HOME/nvim"
-
declare -r LUNARVIM_RUNTIME_DIR="${LUNARVIM_RUNTIME_DIR:-"$XDG_DATA_HOME/lunarvim"}"
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)"
+BASEDIR="$(dirname -- "$(dirname -- "$BASEDIR")")"
+readonly BASEDIR
+
+declare ARGS_LOCAL=0
+declare ARGS_OVERWRITE=0
+declare ARGS_INSTALL_DEPENDENCIES=1
declare -a __lvim_dirs=(
"$LUNARVIM_CONFIG_DIR"
"$LUNARVIM_RUNTIME_DIR"
- "$NEOVIM_CACHE_DIR" # for now this is shared with neovim
+ "$LUNARVIM_CACHE_DIR"
)
declare -a __npm_deps=(
@@ -31,84 +40,96 @@ declare -a __pip_deps=(
"pynvim"
)
-function main() {
- cat <<'EOF'
+function usage() {
+ echo "Usage: install.sh [<options>]"
+ echo ""
+ echo "Options:"
+ echo " -h, --help Print this help message"
+ echo " -l, --local Install local copy of LunarVim"
+ echo " --overwrite Overwrite previous LunarVim configuration (a backup is always performed first)"
+ echo " --[no]-install-dependencies Whether to prompt to install external dependencies (will prompt by default)"
+}
- 88\ 88\
- 88 | \__|
- 88 |88\ 88\ 888888$\ 888888\ 888888\ 88\ 88\ 88\ 888888\8888\
- 88 |88 | 88 |88 __88\ \____88\ 88 __88\\88\ 88 |88 |88 _88 _88\
- 88 |88 | 88 |88 | 88 | 888888$ |88 | \__|\88\88 / 88 |88 / 88 / 88 |
- 88 |88 | 88 |88 | 88 |88 __88 |88 | \88$ / 88 |88 | 88 | 88 |
- 88 |\888888 |88 | 88 |\888888$ |88 | \$ / 88 |88 | 88 | 88 |
- \__| \______/ \__| \__| \_______|\__| \_/ \__|\__| \__| \__|
+function parse_arguments() {
+ while [ "$#" -gt 0 ]; do
+ case "$1" in
+ -l | --local)
+ ARGS_LOCAL=1
+ ;;
+ --overwrite)
+ ARGS_OVERWRITE=1
+ ;;
+ --install-dependencies)
+ ARGS_INSTALL_DEPENDENCIES=1
+ ;;
+ --no-install-dependencies)
+ ARGS_INSTALL_DEPENDENCIES=0
+ ;;
+ -h | --help)
+ usage
+ exit 0
+ ;;
+ esac
+ shift
+ done
+}
-EOF
+function msg() {
+ local text="$1"
+ local div_width="80"
+ printf "%${div_width}s\n" ' ' | tr ' ' -
+ printf "%s\n" "$text"
+}
- __add_separator "80"
+function main() {
+ parse_arguments "$@"
- echo "Detecting platform for managing any additional neovim dependencies"
- detect_platform
+ print_logo
- if [ -n "$GITHUB_ACTIONS" ]; then
- install_packer
- setup_lvim
- exit 0
- fi
+ msg "Detecting platform for managing any additional neovim dependencies"
+ detect_platform
check_system_deps
- __add_separator "80"
-
- echo "Would you like to check lunarvim's NodeJS dependencies?"
- read -p "[y]es or [n]o (default: no) : " -r answer
- [ "$answer" != "${answer#[Yy]}" ] && install_nodejs_deps
-
- echo "Would you like to check lunarvim's Python dependencies?"
- read -p "[y]es or [n]o (default: no) : " -r answer
- [ "$answer" != "${answer#[Yy]}" ] && install_python_deps
+ if [ "$ARGS_INSTALL_DEPENDENCIES" -eq 1 ]; then
+ msg "Would you like to install LunarVim's NodeJS dependencies?"
+ read -p "[y]es or [n]o (default: no) : " -r answer
+ [ "$answer" != "${answer#[Yy]}" ] && install_nodejs_deps
- echo "Would you like to check lunarvim's Rust dependencies?"
- read -p "[y]es or [n]o (default: no) : " -r answer
- [ "$answer" != "${answer#[Yy]}" ] && install_rust_deps
+ msg "Would you like to install LunarVim's Python dependencies?"
+ read -p "[y]es or [n]o (default: no) : " -r answer
+ [ "$answer" != "${answer#[Yy]}" ] && install_python_deps
- __add_separator "80"
+ msg "Would you like to install LunarVim's Rust dependencies?"
+ read -p "[y]es or [n]o (default: no) : " -r answer
+ [ "$answer" != "${answer#[Yy]}" ] && install_rust_deps
+ fi
- echo "Backing up old LunarVim configuration"
+ msg "Backing up old LunarVim configuration"
backup_old_config
- __add_separator "80"
-
- case "$@" in
- *--overwrite*)
- echo "!!Warning!! -> Removing all lunarvim related config \
- because of the --overwrite flag"
- read -p "Would you like to continue? [y]es or [n]o : " -r answer
- [ "$answer" == "${answer#[Yy]}" ] && exit 1
- for dir in "${__lvim_dirs[@]}"; do
- [ -d "$dir" ] && rm -rf "$dir"
- done
- ;;
- esac
-
- if [ -e "$LUNARVIM_RUNTIME_DIR/site/pack/packer/start/packer.nvim" ]; then
- echo "Packer already installed"
- else
- install_packer
+ if [ "$ARGS_OVERWRITE" -eq 1 ]; then
+ for dir in "${__lvim_dirs[@]}"; do
+ [ -d "$dir" ] && rm -rf "$dir"
+ done
fi
- __add_separator "80"
+ install_packer
if [ -e "$LUNARVIM_RUNTIME_DIR/lvim/init.lua" ]; then
- echo "Updating LunarVim"
update_lvim
else
- clone_lvim
+ if [ "$ARGS_LOCAL" -eq 1 ]; then
+ link_local_lvim
+ else
+ clone_lvim
+ fi
setup_lvim
fi
- __add_separator "80"
-
+ msg "Thank you for installing LunarVim!!"
+ echo "You can start it by running: $INSTALL_PREFIX/bin/lvim"
+ echo "Do not forget to use a font with glyphs (icons) support [https://github.com/ryanoasis/nerd-fonts]"
}
function detect_platform() {
@@ -136,14 +157,14 @@ function detect_platform() {
}
function print_missing_dep_msg() {
- echo "[ERROR]: Unable to find dependency [$1]"
- echo "Please install it first and re-run the installer. Try: $RECOMMEND_INSTALL $1"
-}
-
-function check_dep() {
- if ! command -v "$1" &>/dev/null; then
- print_missing_dep_msg "$1"
- exit 1
+ if [ "$#" -eq 1 ]; then
+ echo "[ERROR]: Unable to find dependency [$1]"
+ echo "Please install it first and re-run the installer. Try: $RECOMMEND_INSTALL $1"
+ else
+ local cmds
+ cmds=$(for i in "$@"; do echo "$RECOMMEND_INSTALL $i"; done)
+ printf "[ERROR]: Unable to find dependencies [%s]" "$@"
+ printf "Please install any one of the dependencies and re-run the installer. Try: \n%s\n" "$cmds"
fi
}
@@ -158,8 +179,7 @@ function check_system_deps() {
fi
}
-function install_nodejs_deps() {
- check_dep "npm"
+function __install_nodejs_deps_npm() {
echo "Installing node modules with npm.."
for dep in "${__npm_deps[@]}"; do
if ! npm ls -g "$dep" &>/dev/null; then
@@ -167,7 +187,25 @@ function install_nodejs_deps() {
npm install -g "$dep"
fi
done
- echo "All NodeJS dependencies are succesfully installed"
+ echo "All NodeJS dependencies are successfully installed"
+}
+
+function __install_nodejs_deps_yarn() {
+ echo "Installing node modules with yarn.."
+ yarn global add "${__npm_deps[@]}"
+ echo "All NodeJS dependencies are successfully installed"
+}
+
+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
+ eval "__install_nodejs_deps_$pkg_manager"
+ return
+ fi
+ done
+ print_missing_dep_msg "${pkg_managers[@]}"
+ exit 1
}
function install_python_deps() {
@@ -182,27 +220,28 @@ function install_python_deps() {
for dep in "${__pip_deps[@]}"; do
python3 -m pip install --user "$dep"
done
- echo "All Python dependencies are succesfully installed"
+ echo "All Python dependencies are successfully installed"
}
function __attempt_to_install_with_cargo() {
- if ! command -v cargo &>/dev/null; then
+ if command -v cargo &>/dev/null; then
echo "Installing missing Rust dependency with cargo"
cargo install "$1"
else
- echo "[WARN]: Unable to find fd. Make sure to install it to avoid any problems"
+ echo "[WARN]: Unable to find cargo. Make sure to install it to avoid any problems"
+ exit 1
fi
}
# we try to install the missing one with cargo even though it's unlikely to be found
function install_rust_deps() {
- if ! command -v fd &>/dev/null; then
- __attempt_to_install_with_cargo "fd-find"
- fi
- if ! command -v rg &>/dev/null; then
- __attempt_to_install_with_cargo "ripgrep"
- fi
- echo "All Rust dependencies are succesfully installed"
+ local -a deps=("fd::fd-find" "rg::ripgrep")
+ for dep in "${deps[@]}"; do
+ if ! command -v "${dep%%::*}" &>/dev/null; then
+ __attempt_to_install_with_cargo "${dep##*::}"
+ fi
+ done
+ echo "All Rust dependencies are successfully installed"
}
function backup_old_config() {
@@ -233,12 +272,19 @@ function backup_old_config() {
}
function install_packer() {
- git clone --depth 1 https://github.com/wbthomason/packer.nvim \
- "$LUNARVIM_RUNTIME_DIR/site/pack/packer/start/packer.nvim"
+ 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() {
- echo "Cloning LunarVim configuration"
+ msg "Cloning LunarVim configuration"
if ! git clone --branch "$LV_BRANCH" \
--depth 1 "https://github.com/${LV_REMOTE}" "$LUNARVIM_RUNTIME_DIR/lvim"; then
echo "Failed to clone repository. Installation failed."
@@ -246,6 +292,20 @@ function clone_lvim() {
fi
}
+function link_local_lvim() {
+ echo "Linking local LunarVim repo"
+
+ # Detect whether it's a symlink or a folder
+ if [ -d "$LUNARVIM_RUNTIME_DIR/lvim" ]; then
+ echo "Removing old installation files"
+ rm -rf "$LUNARVIM_RUNTIME_DIR/lvim"
+ fi
+
+ mkdir -p "$LUNARVIM_RUNTIME_DIR"
+ echo " - $BASEDIR -> $LUNARVIM_RUNTIME_DIR/lvim"
+ ln -s -f "$BASEDIR" "$LUNARVIM_RUNTIME_DIR/lvim"
+}
+
function setup_shim() {
if [ ! -d "$INSTALL_PREFIX/bin" ]; then
mkdir -p "$INSTALL_PREFIX/bin"
@@ -261,8 +321,24 @@ EOF
chmod +x "$INSTALL_PREFIX/bin/lvim"
}
+function remove_old_cache_files() {
+ local packer_cache="$LUNARVIM_CONFIG_DIR/plugin/packer_compiled.lua"
+ if [ -e "$packer_cache" ]; then
+ msg "Removing old packer cache file"
+ rm -f "$packer_cache"
+ fi
+
+ if [ -e "$LUNARVIM_CACHE_DIR/luacache" ] || [ -e "$LUNARVIM_CACHE_DIR/lvim_cache" ]; then
+ msg "Removing old startup cache file"
+ rm -f "$LUNARVIM_CACHE_DIR/{luacache,lvim_cache}"
+ fi
+}
+
function setup_lvim() {
- echo "Installing LunarVim shim"
+
+ remove_old_cache_files
+
+ msg "Installing LunarVim shim"
setup_shim
@@ -271,31 +347,32 @@ function setup_lvim() {
cp "$LUNARVIM_RUNTIME_DIR/lvim/utils/installer/config.example-no-ts.lua" \
"$LUNARVIM_CONFIG_DIR/config.lua"
- nvim -u "$LUNARVIM_RUNTIME_DIR/lvim/init.lua" --headless \
+ "$INSTALL_PREFIX/bin/lvim" --headless \
-c 'autocmd User PackerComplete quitall' \
-c 'PackerSync'
echo "Packer setup complete"
cp "$LUNARVIM_RUNTIME_DIR/lvim/utils/installer/config.example.lua" "$LUNARVIM_CONFIG_DIR/config.lua"
-
- echo "Thank you for installing LunarVim!!"
- echo "You can start it by running: $INSTALL_PREFIX/bin/lvim"
- echo "Do not forget to use a font with glyphs (icons) support [https://github.com/ryanoasis/nerd-fonts]"
}
function update_lvim() {
- git -C "$LUNARVIM_RUNTIME_DIR/lvim" fetch --quiet
- if ! git -C "$LUNARVIM_RUNTIME_DIR/lvim" diff --quiet "@{upstream}"; then
- git -C "$LUNARVIM_RUNTIME_DIR/lvim" merge --ff-only --progress ||
- echo "Unable to guarantee data integrity while updating. Please do that manually instead." && exit 1
- fi
- echo "Your LunarVim installation is now up to date!"
+ "$INSTALL_PREFIX/bin/lvim" --headless +'LvimUpdate' +q
}
-function __add_separator() {
- local DIV_WIDTH="$1"
- printf "%${DIV_WIDTH}s\n" ' ' | tr ' ' -
+function print_logo() {
+ cat <<'EOF'
+
+ 88\ 88\
+ 88 | \__|
+ 88 |88\ 88\ 888888$\ 888888\ 888888\ 88\ 88\ 88\ 888888\8888\
+ 88 |88 | 88 |88 __88\ \____88\ 88 __88\\88\ 88 |88 |88 _88 _88\
+ 88 |88 | 88 |88 | 88 | 888888$ |88 | \__|\88\88 / 88 |88 / 88 / 88 |
+ 88 |88 | 88 |88 | 88 |88 __88 |88 | \88$ / 88 |88 | 88 | 88 |
+ 88 |\888888 |88 | 88 |\888888$ |88 | \$ / 88 |88 | 88 | 88 |
+ \__| \______/ \__| \__| \_______|\__| \_/ \__|\__| \__| \__|
+
+EOF
}
main "$@"
diff --git a/utils/installer/install_bin.sh b/utils/installer/install_bin.sh
new file mode 100755
index 00000000..2438d5d1
--- /dev/null
+++ b/utils/installer/install_bin.sh
@@ -0,0 +1,33 @@
+#!/usr/bin/env bash
+set -eo pipefail
+
+declare -r 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 -r LUNARVIM_RUNTIME_DIR="${LUNARVIM_RUNTIME_DIR:-"$XDG_DATA_HOME/lunarvim"}"
+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"
+
+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"
+}
+
+setup_shim "$@"
+echo "You can start LunarVim by running: $INSTALL_PREFIX/bin/lvim"
diff --git a/utils/installer/uninstall.ps1 b/utils/installer/uninstall.ps1
new file mode 100644
index 00000000..b362ff5a
--- /dev/null
+++ b/utils/installer/uninstall.ps1
@@ -0,0 +1 @@
+Remove-Item -Path "$HOME/.local/share/lunarvim" -Recurse -Force \ No newline at end of file
diff --git a/utils/installer/uninstall.sh b/utils/installer/uninstall.sh
index 8d9d039a..09923bb1 100755
--- a/utils/installer/uninstall.sh
+++ b/utils/installer/uninstall.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-USER_BIN_DIR="/usr/local/bin"
+USER_BIN_DIR="$HOME/.local/bin"
if [ -d "/data/data/com.termux" ]; then
sudo() {
eval "$@"
diff --git a/utils/media/demo.png b/utils/media/demo.png
deleted file mode 100755
index 08e3dba1..00000000
--- a/utils/media/demo.png
+++ /dev/null
Binary files differ
diff --git a/utils/media/demo1.png b/utils/media/demo1.png
new file mode 100755
index 00000000..f1591dd6
--- /dev/null
+++ b/utils/media/demo1.png
Binary files differ
diff --git a/utils/media/demo2.png b/utils/media/demo2.png
new file mode 100755
index 00000000..9bc613e5
--- /dev/null
+++ b/utils/media/demo2.png
Binary files differ
diff --git a/utils/media/demo3.png b/utils/media/demo3.png
new file mode 100755
index 00000000..29caa338
--- /dev/null
+++ b/utils/media/demo3.png
Binary files differ
diff --git a/utils/media/lunarvim_logo_dark.png b/utils/media/lunarvim_logo_dark.png
index fae8e6af..f605b306 100644..100755
--- a/utils/media/lunarvim_logo_dark.png
+++ b/utils/media/lunarvim_logo_dark.png
Binary files differ
diff --git a/utils/vscode_config/settings.json b/utils/vscode_config/settings.json
index d8a91c0f..2cca67a5 100644
--- a/utils/vscode_config/settings.json
+++ b/utils/vscode_config/settings.json
@@ -362,7 +362,7 @@
},
{
"key": "P",
- "name": "Push",
+ "name": "Pull",
"type": "command",
"command": "git.pull"
},