forked from ayamir/nvimdots
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: cleanup and minor syntax improvements (ayamir#1217)
* chore: cleanup and minor syntax improvements This commit mainly tackled several minor touch-ups and syntax improvements: - Addressed `luacheck` issues from previous commits. - Added some to-do comments for `_buf_vtext`. - Eliminated redundant/outdated options. - Temporarily removed the ability to install nightly-version configs and updated the names of relevant functions: - `clone_by_https_or_ssh` -> `clone_repo` - Rewrote `dotstutor` to make it more readable. * perf(debugpy): simplify venv detection logic * fixup! chore: cleanup and minor syntax improvements * fixup! Merge branch 'main' into chore/cleanups
- Loading branch information
Showing
9 changed files
with
229 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: lint code | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
luacheck: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: lunarmodules/luacheck@v1 | ||
with: | ||
args: . --std luajit --globals vim _toggle_lazygit _buf_vtext _command_panel _flash_esc_or_noh _debugging --max-line-length 150 --no-config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -282,6 +282,23 @@ function check_nvim_version ([Parameter(Mandatory = $True)][ValidateNotNullOrEmp | |
return ($nvim_version -ge $RequiredVersionMin) | ||
} | ||
|
||
function clone_repo ([Parameter(Mandatory = $True)][ValidateNotNullOrEmpty()] [string]$WithURL) { | ||
if ((check_nvim_version -RequiredVersionMin $REQUIRED_NVIM_VERSION)) { | ||
safe_execute -WithCmd { git clone --progress -b "$env:CCLONE_BRANCH" "$env:CCLONE_ATTR" $WithURL "$env:CCDEST_DIR" } | ||
} elseif ((check_nvim_version -RequiredVersionMin $REQUIRED_NVIM_VERSION_LEGACY)) { | ||
warn -Msg "You have outdated Nvim installed (< $REQUIRED_NVIM_VERSION)." | ||
info -Msg "Automatically redirecting you to the latest compatible version..." | ||
safe_execute -WithCmd { git clone --progress -b "$env:CCLONE_BRANCH_LEGACY" "$env:CCLONE_ATTR" $WithURL "$env:CCDEST_DIR" } | ||
} else { | ||
warn -Msg "You have outdated Nvim installed (< $REQUIRED_NVIM_VERSION_LEGACY)." | ||
_abort -Msg "This Neovim distribution is no longer supported." -Type "NotImplemented" -Info_msg @" | ||
You have a legacy Neovim distribution installed. | ||
Please make sure you have nvim v$REQUIRED_NVIM_VERSION_LEGACY installed at the very least. | ||
"@ | ||
} | ||
} | ||
|
||
function ring_bell { | ||
[System.Console]::beep() | ||
} | ||
|
@@ -353,35 +370,9 @@ You must install Git before installing this Nvim config. See: | |
info -Msg "Fetching in progress..." | ||
|
||
if ($USE_SSH) { | ||
if ((check_nvim_version -RequiredVersionMin $REQUIRED_NVIM_VERSION)) { | ||
safe_execute -WithCmd { git clone --progress -b "$env:CCLONE_BRANCH" "$env:CCLONE_ATTR" '[email protected]:ayamir/nvimdots.git' "$env:CCDEST_DIR" } | ||
} elseif ((check_nvim_version -RequiredVersionMin $REQUIRED_NVIM_VERSION_LEGACY)) { | ||
warn -Msg "You have outdated Nvim installed (< $REQUIRED_NVIM_VERSION)." | ||
info -Msg "Automatically redirecting you to the latest compatible version..." | ||
safe_execute -WithCmd { git clone --progress -b 0.8 "$env:CCLONE_ATTR" '[email protected]:ayamir/nvimdots.git' "$env:CCDEST_DIR" } | ||
} else { | ||
warn -Msg "You have outdated Nvim installed (< $REQUIRED_NVIM_VERSION_LEGACY)." | ||
_abort -Msg "This Neovim distribution is no longer supported." -Type "NotImplemented" -Info_msg @" | ||
You have a legacy Neovim distribution installed. | ||
Please make sure you have nvim v$REQUIRED_NVIM_VERSION_LEGACY installed at the very least. | ||
"@ | ||
} | ||
clone_repo -WithURL '[email protected]:ayamir/nvimdots.git' | ||
} else { | ||
if ((check_nvim_version -RequiredVersionMin $REQUIRED_NVIM_VERSION)) { | ||
safe_execute -WithCmd { git clone --progress -b "$env:CCLONE_BRANCH" "$env:CCLONE_ATTR" 'https://github.com/ayamir/nvimdots.git' "$env:CCDEST_DIR" } | ||
} elseif ((check_nvim_version -RequiredVersionMin $REQUIRED_NVIM_VERSION_LEGACY)) { | ||
warn -Msg "You have outdated Nvim installed (< $REQUIRED_NVIM_VERSION)." | ||
info -Msg "Automatically redirecting you to the latest compatible version..." | ||
safe_execute -WithCmd { git clone --progress -b 0.8 "$env:CCLONE_ATTR" 'https://github.com/ayamir/nvimdots.git' "$env:CCDEST_DIR" } | ||
} else { | ||
warn -Msg "You have outdated Nvim installed (< $REQUIRED_NVIM_VERSION_LEGACY)." | ||
_abort -Msg "This Neovim distribution is no longer supported." -Type "NotImplemented" -Info_msg @" | ||
You have a legacy Neovim distribution installed. | ||
Please make sure you have nvim v$REQUIRED_NVIM_VERSION_LEGACY installed at the very least. | ||
"@ | ||
} | ||
clone_repo -WithURL 'https://github.com/ayamir/nvimdots.git' | ||
} | ||
|
||
safe_execute -WithCmd { Set-Location -Path "$env:CCDEST_DIR" } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -169,6 +169,24 @@ check_nvim_version() { | |
fi | ||
} | ||
|
||
clone_repo() { | ||
if check_nvim_version "${REQUIRED_NVIM_VERSION}"; then | ||
execute "git" "clone" "-b" "main" "${CLONE_ATTR[@]}" "$1" "${DEST_DIR}" | ||
elif check_nvim_version "${REQUIRED_NVIM_VERSION_LEGACY}"; then | ||
warn "You have outdated Nvim installed (< ${REQUIRED_NVIM_VERSION})." | ||
info "Automatically redirecting you to the latest compatible version..." | ||
execute "git" "clone" "-b" "0.8" "${CLONE_ATTR[@]}" "$1" "${DEST_DIR}" | ||
else | ||
warn "You have outdated Nvim installed (< ${REQUIRED_NVIM_VERSION_LEGACY})." | ||
abort "$( | ||
cat <<EOABORT | ||
You have a legacy Neovim distribution installed. | ||
Please make sure you have nvim v${REQUIRED_NVIM_VERSION_LEGACY} installed at the very least. | ||
EOABORT | ||
)" | ||
fi | ||
} | ||
|
||
# Check if both `INTERACTIVE` and `NONINTERACTIVE` are set | ||
# Always use single-quoted strings with `exp` expressions | ||
# shellcheck disable=SC2016 | ||
|
@@ -252,37 +270,9 @@ fi | |
|
||
info "Fetching in progress..." | ||
if [[ "${USE_SSH}" -eq "1" ]]; then | ||
if check_nvim_version "${REQUIRED_NVIM_VERSION}"; then | ||
execute "git" "clone" "-b" "main" "${CLONE_ATTR[@]}" "[email protected]:ayamir/nvimdots.git" "${DEST_DIR}" | ||
elif check_nvim_version "${REQUIRED_NVIM_VERSION_LEGACY}"; then | ||
warn "You have outdated Nvim installed (< ${REQUIRED_NVIM_VERSION})." | ||
info "Automatically redirecting you to the latest compatible version..." | ||
execute "git" "clone" "-b" "0.8" "${CLONE_ATTR[@]}" "[email protected]:ayamir/nvimdots.git" "${DEST_DIR}" | ||
else | ||
warn "You have outdated Nvim installed (< ${REQUIRED_NVIM_VERSION_LEGACY})." | ||
abort "$( | ||
cat <<EOABORT | ||
You have a legacy Neovim distribution installed. | ||
Please make sure you have nvim v${REQUIRED_NVIM_VERSION_LEGACY} installed at the very least. | ||
EOABORT | ||
)" | ||
fi | ||
clone_repo "[email protected]:ayamir/nvimdots.git" | ||
else | ||
if check_nvim_version "${REQUIRED_NVIM_VERSION}"; then | ||
execute "git" "clone" "-b" "main" "${CLONE_ATTR[@]}" "https://github.com/ayamir/nvimdots.git" "${DEST_DIR}" | ||
elif check_nvim_version "${REQUIRED_NVIM_VERSION_LEGACY}"; then | ||
warn "You have outdated Nvim installed (< ${REQUIRED_NVIM_VERSION})." | ||
info "Automatically redirecting you to the latest compatible version..." | ||
execute "git" "clone" "-b" "0.8" "${CLONE_ATTR[@]}" "https://github.com/ayamir/nvimdots.git" "${DEST_DIR}" | ||
else | ||
warn "You have outdated Nvim installed (< ${REQUIRED_NVIM_VERSION_LEGACY})." | ||
abort "$( | ||
cat <<EOABORT | ||
You have a legacy Neovim distribution installed. | ||
Please make sure you have nvim v${REQUIRED_NVIM_VERSION_LEGACY} installed at the very least. | ||
EOABORT | ||
)" | ||
fi | ||
clone_repo "https://github.com/ayamir/nvimdots.git" | ||
fi | ||
|
||
cd "${DEST_DIR}" || return | ||
|
Oops, something went wrong.