fix(bootstrap): remove hard-coded spellfile option (#2061)

This commit is contained in:
kylo252 2021-12-09 11:51:37 +01:00 committed by GitHub
parent c43ee9aa3a
commit 68cdb62f87
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 62 additions and 48 deletions

View file

@ -72,11 +72,8 @@ function M:init(base_dir)
-- TODO: we need something like this: vim.opt.packpath = vim.opt.rtp
vim.cmd [[let &packpath = &runtimepath]]
vim.cmd("set spellfile=" .. join_paths(self.config_dir, "spell", "en.utf-8.add"))
end
vim.fn.mkdir(get_cache_dir(), "p")
-- FIXME: currently unreliable in unit-tests
if not in_headless then
_G.PLENARY_DEBUG = false

View file

@ -43,6 +43,7 @@ M.load_options = function()
wrap = false, -- display lines as one long line
spell = false,
spelllang = "en",
spellfile = utils.join_paths(get_config_dir(), "spell", "en.utf-8.add"),
scrolloff = 8, -- is one of my fav
sidescrolloff = 8,
}

View file

@ -64,20 +64,8 @@ function main($cliargs) {
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"
}
}
}
verify_lvim_dirs
if (Test-Path "$env:LUNARVIM_RUNTIME_DIR\site\pack\packer\start\packer.nvim") {
Write-Output "Packer already installed"
@ -153,7 +141,7 @@ function check_system_deps() {
function install_nodejs_deps() {
try {
check_system_dep "node"
Invoke-Command npm install -g neovim tree-sitter-cli -ErrorAction Break
Invoke-Command npm install -g neovim tree-sitter-cli -ErrorAction Break
}
catch {
print_missing_dep_msg "$dep"
@ -211,6 +199,29 @@ function setup_shim() {
Copy-Item "$env:LUNARVIM_RUNTIME_DIR\lvim\utils\bin\lvim.ps1" -Destination "$INSTALL_PREFIX\bin\lvim.ps1" -Force
}
function verify_lvim_dirs() {
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"
}
}
}
foreach ($dir in $__lvim_dirs) {
if ((Test-Path "$dir") -eq $false) {
New-Item "$dir" -ItemType Directory
}
}
}
function setup_lvim() {
Write-Output "Installing LunarVim shim"
@ -218,30 +229,26 @@ function setup_lvim() {
Write-Output "Preparing Packer setup"
if ((Test-Path "$env:LUNARVIM_CONFIG_DIR") -eq $false) {
New-Item "$env:LUNARVIM_CONFIG_DIR" -ItemType Directory
}
if (Test-Path "$env:LUNARVIM_CONFIG_DIR\config.lua") {
Remove-Item -Force "$env:LUNARVIM_CONFIG_DIR\config.lua"
}
Out-File -FilePath "$env:LUNARVIM_CONFIG_DIR\config.lua"
Write-Output "Packer setup complete"
Write-Output "Packer setup complete"
__add_separator "80"
__add_separator "80"
Copy-Item "$env:LUNARVIM_RUNTIME_DIR\lvim\utils\installer\config.example.lua" "$env:LUNARVIM_CONFIG_DIR\config.lua"
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
}
$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"
__add_separator "80"
Write-Output "Thank you for installing LunarVim!!"
Write-Output "You can start it by running: $INSTALL_PREFIX\bin\lvim.ps1"
@ -267,15 +274,16 @@ function __add_separator($div_width) {
}
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"'))
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
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."
}
}
else {
Write-Output "Alias is already set and will not be reset."
}
}
main "$args"

View file

@ -107,11 +107,7 @@ function main() {
msg "Backing up old LunarVim configuration"
backup_old_config
if [ "$ARGS_OVERWRITE" -eq 1 ]; then
for dir in "${__lvim_dirs[@]}"; do
[ -d "$dir" ] && rm -rf "$dir"
done
fi
verify_lvim_dirs
if [ -e "$LUNARVIM_RUNTIME_DIR/lvim/init.lua" ]; then
update_lvim
@ -262,11 +258,24 @@ function install_rust_deps() {
echo "All Rust dependencies are successfully installed"
}
function verify_lvim_dirs() {
if [ "$ARGS_OVERWRITE" -eq 1 ]; then
for dir in "${__lvim_dirs[@]}"; do
[ -d "$dir" ] && rm -rf "$dir"
done
fi
for dir in "${__lvim_dirs[@]}"; do
mkdir -p "$dir"
done
}
function backup_old_config() {
for dir in "${__lvim_dirs[@]}"; do
# we create an empty folder for subsequent commands \
# that require an existing directory
mkdir -p "$dir" "$dir.bak"
if [ ! -d "$dir" ]; then
continue
fi
mkdir -p "$dir.bak"
touch "$dir/ignore"
if command -v rsync &>/dev/null; then
rsync --archive -hh --partial --progress --cvs-exclude \
@ -307,7 +316,6 @@ function link_local_lvim() {
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"
}