Skip to content

Instantly share code, notes, and snippets.

@mlabrkic
Last active December 21, 2022 09:20
Show Gist options
  • Save mlabrkic/d378d4a22e1ef3161201dab1391f253f to your computer and use it in GitHub Desktop.
Save mlabrkic/d378d4a22e1ef3161201dab1391f253f to your computer and use it in GitHub Desktop.
Choose the Neovim CONFIG
:: nvbat_goto_version_2.bat
:: (You need "admin-prompt.lnk" for "nvbat_goto_version_2.bat")
:: OS: Windows 10
:: Copy this bat file to folder C:\UTILS\
:: ---------------------------------------------------------
:: Choose the Neovim CONFIG:
:: / stable release or development prerelease (nightly) /
:: Run: Win-R, admin-prompt
:: ("admin-prompt.lnk", I put it in a folder in my Windows path (for example): C:\UTILS\)
:: Go to nvim1 (stable) config (nv, TAB --> nvbat...):
:: nvbat_goto_version_2.bat 1
:: or,
:: Go to nvim2 (test) config:
:: nvbat_goto_version_2.bat 2
:: ---------------------------------------------------------
:: What to do? Where to install Neovim?
:: Instal Neovim (stable) to folder C:\UTILS\Neovim\
:: Note: C:\Users\username\AppData\ , it is a hidden folder
:: 1)
:: First, rename folders (a stable release):
:: C:\UTILS\Neovim\
:: C:\Users\username\AppData\Local\nvim\
:: C:\Users\username\AppData\Local\nvim-data\
:: to
:: C:\UTILS\Neovim1\
:: C:\Users\username\AppData\Local\nvim1\
:: C:\Users\username\AppData\Local\nvim-data1\
:: ---------------------------
:: 2)
:: Second: install Neovim (test) development prerelease (nightly),
:: or again instal Neovim (stable)
:: + test config
:: Then, rename folders (a development release):
:: C:\UTILS\Neovim\
:: C:\Users\username\AppData\Local\nvim\
:: C:\Users\username\AppData\Local\nvim-data\
:: to
:: C:\UTILS\Neovim2\
:: C:\Users\username\AppData\Local\nvim2\
:: C:\Users\username\AppData\Local\nvim-data2\
:: ---------------------------------------------------------
:: How to open command prompt as administrator (because MKlink):
:: Create "admin-prompt.lnk"
:: https://stackoverflow.com/questions/30480228/run-command-to-open-command-prompt-as-administrator
:: ("admin-prompt.lnk", I put it in a folder in my Windows path (for example): C:\UTILS\)
:: ---------------------------------------------------------
:: MKLINK:
:: https://ss64.com/nt/mklink.html
:: MKLINK [[/D] | [/H] | [/J]] LinkName Target
:: /D Create a Directory symbolic link. (default is file)
:: /H Create a hard link instead of a symbolic link.
:: Examples:
:: mklink "C:\suga\apple" "C:\suga\settings"
:: Link for a file:
:: C:\> MKlink ss64.exe C:\Windows\system32\notepad.exe
:: C:\> Dir
:: C:\> Del ss64.exe
:: Link for a folder:
:: C:\> MKlink /D Apr C:\work\April
:: C:\> Dir
:: C:\> RD Apr
:: RD = rmdir
:: ---------------------------------------------------------
:: Windows Command shell info:
:: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/windows-commands
:: https://ss64.com/nt/
:: /Windows has two command-line shells: the Command shell and PowerShell./
:: Search (open command prompt): Win-S, cmd
:: CD /d %USERPROFILE% "\AppData\Local\"
:: cd nvim-data\site\pack\packer\start\telescope-fzf-native.nvim\
:: ---------------------------------------------------------
:: https://ss64.com/nt/
:: Change Current Directory to the location of this batch file
:: http://ss64.com/nt/cd.html
:: CD /d "%~dp0"
:: Open the command prompt, and type command (CMD /k for development)
:: http://ss64.com/nt/cmd.html
:: https://ss64.com/nt/syntax-args.html
:: CMD /c C:\UTILS\JDK\bin\java -cp Inventory_01_port-1.0-SNAPSHOT.jar;dependency204/* com.mxb.inventory.port.Inventory_01_port %EQUIPMENT% %SLOT% %DESCRIPTION%
:: https://ss64.com/nt/if.html
:: http://steve-jansen.github.io/guides/windows-batch-scripting/part-5-if-then-conditionals.html
:: with a case insensitive comparison: IF /I "%var%"=="hello, world!" (
:: ---------------------------------------------------------
@echo off
set INPUT=%1
RD %USERPROFILE%\AppData\Local\nvim\
RD %USERPROFILE%\AppData\Local\nvim-data\
IF "%INPUT%"=="1" (
:: stable release build
MKlink /D %USERPROFILE%\AppData\Local\nvim\ %USERPROFILE%\AppData\Local\nvim1\
MKlink /D %USERPROFILE%\AppData\Local\nvim-data\ %USERPROFILE%\AppData\Local\nvim-data1\
ECHO "nvim1 - stable"
) ELSE IF "%INPUT%"=="2" (
:: development prerelease (nightly) build
MKlink /D %USERPROFILE%\AppData\Local\nvim\ %USERPROFILE%\AppData\Local\nvim2\
MKlink /D %USERPROFILE%\AppData\Local\nvim-data\ %USERPROFILE%\AppData\Local\nvim-data2\
ECHO "nvim2 - test"
)
@mlabrkic
Copy link
Author

Before using this script, you should make a backup of the Neovim config folder.

Be sure to "exit" Neovim, and only then run this script!
As I remember, Neovim config folder was deleted a couple of times...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment