Skip to content

Instantly share code, notes, and snippets.

@mlabrkic
Last active April 14, 2022 15:17
Show Gist options
  • Save mlabrkic/0e8f479fbcb57d0d72f50cfd7e0fcb17 to your computer and use it in GitHub Desktop.
Save mlabrkic/0e8f479fbcb57d0d72f50cfd7e0fcb17 to your computer and use it in GitHub Desktop.
"Multi Commander" script: Choose the Neovim configuration (and/or release build), http://multicommander.com/
Warning: there are mistakes!
Choose the Neovim configuration (and/or release build):
stable config (and stable release build)
or
test config (and stable or prerelease (nightly) build)
------------------------------------------------------------
What to do? Where to install Neovim?
Install Neovim in a folder C:\UTILS\Neovim\
Create a stable configuration!
1)
First, rename the 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\
Note: C:\Users\username\AppData\ , it is a hidden folder
You can insert a blank Neovim-stable.txt file into both folders (for labeling purposes).
------------------------------
2)
Second:
Install the development Neovim build (or again stable build) in a folder C:\UTILS\Neovim\
Create a test configuration!
Then, rename the 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\
------------------------------------------------------------
for example
I am currently using a test configuration:
------------------------------
C:\UTILS\
Neovim (Symlink to folder Neovim2)
Neovim1
Neovim2
------------------------------
C:\Users\<username>\AppData\Local\
nvim (Symlink to folder nvim2)
nvim1
nvim2
nvim-data (Symlink to folder nvim-data2)
nvim-data1
nvim-data2
// ############################################################
// "Multi Commander" script:
// MC_Choose_the_Neovim_CONFIG, F12
// Choose the Neovim configuration (and/or release):
// stable config (and stable build) or test config (and stable or prerelease (nightly) build)
// ------------------------------------------------------------
// Ask user for Neovim configuration:
@var $answer = AskText("Type 1 for a stable Neovim config, or 2 for test config.", "1", 0);
// If user canceled, abort
if ( $answer == 0 )
{
break;
}
// ------------------------------------------------------------
// Check if the Symlink folder exists:
@var $env = TranslateEnvString("%USERPROFILE%");
@var $source_folder = $env ^ "AppData\\Local\\nvim\\";
@var $source_folder_data = $env ^ "AppData\\Local\\nvim-data\\";
@var $symlink_exists = FileExists($source_folder);
// Return value: 1 if the path exists and is a file, 2 if the path exists and is a folder,
// 0 if the path does not exist
// ------------------------------
// Delete Symlinks:
// @var $options[] = {"NOPROGRESS", "NODIALOG", "SILENT", "RECYLE"};
@var $options[] = {"NOPROGRESS", "NODIALOG", "SILENT"};
if($symlink_exists == 2)
{
DeleteFile( $source_folder, $options );
DeleteFile( $source_folder_data, $options );
}
// ------------------------------
// Delete Symlink to folder Neovim1 or Neovim2:
@var $neovim = FileExists( "C:\\UTILS\\Neovim\\");
@var $neovim1 = FileExists( "C:\\UTILS\\Neovim1\\");
@var $neovim2 = FileExists( "C:\\UTILS\\Neovim2\\");
if($neovim == 2)
{
if($neovim1 == 2)
{
DeleteFile( "C:\\UTILS\\Neovim\\", $options );
}
else if($neovim2 == 2)
DeleteFile( "C:\\UTILS\\Neovim\\", $options );
}
}
// ------------------------------------------------------------
@var $target_folder;
@var $target_folder_data;
if($answer == 1)
{
// stable release build
MC.Utils.CreateLink ASADMIN LNKTYPE=3 LNKSRC="C:\\UTILS\\Neovim\\" LNKTRG="C:\\UTILS\\Neovim1\\"
// stable config
$target_folder = $env ^ "AppData\\Local\\nvim1\\";
MC.Utils.CreateLink ASADMIN LNKTYPE=3 LNKSRC={$source_folder} LNKTRG={$target_folder}
$target_folder_data = $env ^ "AppData\\Local\\nvim-data1\\";
MC.Utils.CreateLink ASADMIN LNKTYPE=3 LNKSRC={$source_folder_data} LNKTRG={$target_folder_data}
MessageBox("You have selected a stable Neovim configuration!", "nvim1 - stable", 0);
}
else if($answer == 2)
{
// development prerelease (nightly) (or again a stable) build
MC.Utils.CreateLink ASADMIN LNKTYPE=3 LNKSRC="C:\\UTILS\\Neovim\\" LNKTRG="C:\\UTILS\\Neovim2\\"
// test config
$target_folder = $env ^ "AppData\\Local\\nvim2\\";
MC.Utils.CreateLink ASADMIN LNKTYPE=3 LNKSRC={$source_folder} LNKTRG={$target_folder}
$target_folder_data = $env ^ "AppData\\Local\\nvim-data2\\";
MC.Utils.CreateLink ASADMIN LNKTYPE=3 LNKSRC={$source_folder_data} LNKTRG={$target_folder_data}
MessageBox("You have selected a test Neovim configuration!", "nvim2 - test", 0);
}
else
{
//
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment