From a1b65988e72a091334cedfe7ed1d067819f4e1eb Mon Sep 17 00:00:00 2001 From: Kristof Ostir Date: Tue, 19 Apr 2022 19:31:23 +0200 Subject: [PATCH] fix(core): fix Windows install script && update faq --- docs/faq.md | 11 +++++ docs/install.cmd | 86 +++++++++++++++++++++++++++------------ docs/quick-start-guide.md | 7 ++-- 3 files changed, 74 insertions(+), 30 deletions(-) diff --git a/docs/faq.md b/docs/faq.md index 4f95e6c5b..45f36e68a 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -13,6 +13,7 @@ and usage. - [Installation](#installation) - [Where is my old vim configuration?](#where-is-my-old-vim-configuration) - [How to uninstall SpaceVim?](#how-to-uninstall-spacevim) + - [How to perform manual installation?](#how-to-perform-manual-installation) - [Configuration](#configuration) - [Can I try SpaceVim without overwriting my vimrc?](#can-i-try-spacevim-without-overwriting-my-vimrc) - [Why use toml as the default configuration file format?](#why-use-toml-as-the-default-configuration-file-format) @@ -42,6 +43,16 @@ and if you uninstalll SpaceVim, your vimrc will come back. you can run: curl -sLf https://spacevim.org/install.sh | bash -s -- --uninstall ``` +### How to perform manual installation? + +Clone the SpaceVim Github repository to `~/.SpaceVim` and link Vim and Neovim user folder `~/.SpaceVim`. Delete `~/.vimrc`. + +``` +git clone https://github.com/SpaceVim/SpaceVim.git ~/.SpaceVim +ln -s ~/.SpaceVim ~/.vim +ln -s ~/.SpaceVim ~/.config/nvim +``` + ## Configuration ### Can I try SpaceVim without overwriting my vimrc? diff --git a/docs/install.cmd b/docs/install.cmd index 5de76102d..38165cff6 100644 --- a/docs/install.cmd +++ b/docs/install.cmd @@ -1,5 +1,14 @@ @PowerShell -ExecutionPolicy Bypass -Command Invoke-Expression $('$args=@(^&{$args} %*);'+[String]::Join(';',(Get-Content '%~f0') -notmatch '^^@PowerShell.*EOF$')) & goto :EOF +Push-Location ~ + +$app_name = "SpaceVim" +$repo_url = "https://github.com/SpaceVim/SpaceVim.git" +$repo_name = "SpaceVim" +$repo_path = "$HOME\.SpaceVim" +$version= "2.0.0-dev" + +echo "" echo " /###### /## /##/## " echo " /##__ ## | ## | #|__/ " echo " | ## \__/ /###### /###### /####### /######| ## | ##/##/######/#### " @@ -11,14 +20,7 @@ echo " \______/| ##____/ \_______/\_______/\_______/ \_/ |__|__/ |__/ echo " | ## " echo " | ## " echo " |__/ " -echo " version : 2.0.0-dev by : spacevim.org " - -Push-Location ~ - -$app_name = "SpaceVim" -$repo_url = "https://github.com/SpaceVim/SpaceVim.git" -$repo_name = "SpaceVim" -$repo_path = "$HOME\.SpaceVim" +echo " version : $version by : spacevim.org " Function Pause ($Message = "Press any key to continue . . . ") { if ((Test-Path variable:psISE) -and $psISE) { @@ -31,6 +33,7 @@ Function Pause ($Message = "Press any key to continue . . . ") { } } +echo "" echo "==> Starting Testing Procedure..." echo "" sleep 1 @@ -51,58 +54,87 @@ if (Get-Command "git" -ErrorAction SilentlyContinue) { echo "" -echo "==> Testing vim" -if (Get-Command "gvim" -ErrorAction SilentlyContinue) { +echo "==> Testing Vim" +if (Get-Command "vim" -ErrorAction SilentlyContinue) { echo ($(vim --version) -split '\n')[0] echo "[OK] Test successfully. Moving to next..." sleep 1 } else { - echo "[WARNING] Unable to find 'gvim.exe' in your PATH. But installation still can continue..." echo "" - echo "[WARNING] Please install gvim later or make your PATH correctly set! " + echo "[ERROR] Unable to find 'vim.exe' in your PATH" + echo "Please install vim later or make your PATH correctly set!" + echo ">>> Ready to Exit......" Pause + exit } +echo "" echo "<== Testing Procedure Completed. Moving to next..." +echo "" sleep 1 -echo "" -echo "" -if (!(Test-Path "$HOME\.SpaceVim")) { +if (!(Test-Path $HOME\.SpaceVim)) { echo "==> Trying to clone $app_name" git clone $repo_url $repo_path + echo "<== $app_name cloned" } else { echo "==> Trying to update $app_name" Push-Location $repo_path git pull origin master + Pop-Location + echo "<== $app_name updated" +} + +if (Test-Path $HOME/_vimrc) { + mv $HOME/_vimrc $HOME\vimfiles_back + echo "Backing up _vimrc" } echo "" - -if (!(Test-Path "$HOME\vimfiles")) { +echo "==> Trying to install $app_name for Vim" +if (!(Test-Path $HOME\vimfiles)) { + cmd /c mklink /J $HOME\vimfiles $repo_path + echo "[OK] vimfiles created" +} else { + echo "Backing up vimfiles" + if (Test-Path $HOME\vimfiles_back) { + cmd /c rmdir /s /q $HOME\vimfiles_back + } + mv $HOME\vimfiles $HOME\vimfiles_back cmd /c mklink /J $HOME\vimfiles $repo_path -} else { - echo "[OK] vimfiles already exists" - sleep 1 + echo "[OK] vimfiles updated" + sleep 1 } +echo "<== $app_name for Vim installed" echo "" -if (!(Test-Path "$HOME\AppData\Local\nvim")) { - cmd /c mklink /J "$HOME\AppData\Local\nvim" $repo_path +if (Get-Command "nvim" -ErrorAction SilentlyContinue) { + echo "==> Trying to install $app_name for Neovim" + if (!(Test-Path $HOME\AppData\Local\nvim)) { + cmd /c mklink /J "$HOME\AppData\Local\nvim" $repo_path + echo "[OK] nvim created" } else { - echo "[OK] $HOME\AppData\Local\nvim already exists" - sleep 1 + if (Test-Path $HOME\AppData\Local\nvim_back) { + cmd /c rmdir /s /q $HOME\AppData\Local\nvim_back + } + cmd /c rmdir /s /q $HOME\vimfiles_back + mv $HOME\AppData\Local\nvim $HOME\AppData\Local\nvim_back + cmd /c mklink /J $HOME\AppData\Local\nvim $repo_path + echo "[OK] nvim updated" + sleep 1 } + echo "<== $app_name for Neovim installed" +} + +Pop-Location echo "" echo "Almost done!" echo "==============================================================================" -echo "== Open GVim and it will install the plugins automatically ==" +echo "== Open Vim or Neovim and it will install the plugins automatically ==" echo "==============================================================================" echo "" echo "That's it. Thanks for installing $app_name. Enjoy!" echo "" - Pause -# vim:set ft=powershell nowrap: diff --git a/docs/quick-start-guide.md b/docs/quick-start-guide.md index c9a2d4e81..bbc07d114 100644 --- a/docs/quick-start-guide.md +++ b/docs/quick-start-guide.md @@ -11,10 +11,11 @@ configure, and use SpaceVim. It also lists a series of resources for learning Sp If you've never heard of SpaceVim, this is the best place to start. It will give you a good idea of what SpaceVim is like. + - [Installation](#installation) - - [Linux and macOS](#linux-and-macos) +- [Linux and macOS](#linux-and-macos) - [Windows](#windows) - [Run in docker](#run-in-docker) - [Configuration](#configuration) @@ -32,7 +33,7 @@ which are needed for downloading plugins and fonts. If you are using a terminal emulator, you will need to set the font in the terminal configuration. -### Linux and macOS +## Linux and macOS ```bash curl -sLf https://spacevim.org/install.sh | bash @@ -66,7 +67,7 @@ and a C compiler (like `gcc`) to build the dll (see issue [#435](https://github. ### Windows -The easiest way is to download [install.cmd](../install.cmd) and run it as administrator, or install SpaceVim manually. +The easiest way is to download and run [install.cmd](../install.cmd) or install [SpaceVim manually](../faq.md#how-to-perform-manual-installation). The script installs or updates SpaceVim (if it exists) for Vim and Neovim. ## Run in docker