- Merge sunbather dark/light into one background-aware color scheme - Fold uninstall.sh into install.sh as a subcommand; drop clone logic - Inline bash_tools/ helpers; remove fct and odict - Remove TPM, tmux-sensible, and tmux-fuzzback; tmux has no plugins now - Remove vim-repeat, vim-fugitive, vim-gitgutter, vim-tmux-navigator, and moonfly; everforest is the default dark theme - Fetch vim-plug via git instead of curl; require git, not curl - Guard termguicolors on Windows consoles without VT support and set nomore before the vimrc loads so headless installs cannot hang - Fall back to sunbather when a color scheme fails to load, without overwriting the saved preference - Append config/vim to runtimepath so netrw stops writing into the repo - Fix .editorconfig Python indent; trim .gitignore; update CI and README Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NBfsAH6iJg9inkNLKq11YC
This commit is contained in:
+8
-34
@@ -1,18 +1,14 @@
|
||||
"""Install the Vim 9 configuration on Windows."""
|
||||
|
||||
from pathlib import Path
|
||||
from shutil import which
|
||||
from shutil import copyfile, which
|
||||
import subprocess
|
||||
import tempfile
|
||||
import time
|
||||
import urllib.request
|
||||
|
||||
|
||||
HOME = Path.home()
|
||||
SCRIPT_PATH = Path(__file__).resolve().parent
|
||||
DEFAULT_APP_PATH = HOME / ".dotfiles"
|
||||
APP_PATH = SCRIPT_PATH if (SCRIPT_PATH / ".git").exists() else DEFAULT_APP_PATH
|
||||
REPO_URL = "https://github.com/Donaldttt/dotfiles.git"
|
||||
REPO_BRANCH = "main"
|
||||
APP_PATH = Path(__file__).resolve().parent
|
||||
VIM_PATH = HOME / "vimfiles"
|
||||
VIMRC = HOME / "_vimrc"
|
||||
|
||||
@@ -26,26 +22,6 @@ def require(program):
|
||||
raise SystemExit(f"Error: {program} must be installed.")
|
||||
|
||||
|
||||
def ensure_repo():
|
||||
if (APP_PATH / ".git").exists():
|
||||
return
|
||||
if APP_PATH.exists():
|
||||
raise SystemExit(f"Error: {APP_PATH} exists but is not a Git repository.")
|
||||
print(f"Cloning dotfiles into {APP_PATH}...")
|
||||
run(
|
||||
[
|
||||
"git",
|
||||
"clone",
|
||||
"--branch",
|
||||
REPO_BRANCH,
|
||||
"--depth",
|
||||
"1",
|
||||
REPO_URL,
|
||||
str(APP_PATH),
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
def check_vim_version():
|
||||
result = subprocess.run(
|
||||
["vim", "--clean", "-Nu", "NONE", "-n", "-es", "+if v:version < 900 | cquit | endif", "+qall"]
|
||||
@@ -57,10 +33,9 @@ def check_vim_version():
|
||||
def install_vim_plug():
|
||||
target = VIM_PATH / "autoload" / "plug.vim"
|
||||
target.parent.mkdir(parents=True, exist_ok=True)
|
||||
urllib.request.urlretrieve(
|
||||
"https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim",
|
||||
target,
|
||||
)
|
||||
with tempfile.TemporaryDirectory() as temp:
|
||||
run(["git", "clone", "--depth", "1", "--quiet", "https://github.com/junegunn/vim-plug", temp])
|
||||
copyfile(Path(temp) / "plug.vim", target)
|
||||
|
||||
|
||||
def install_vimrc():
|
||||
@@ -77,10 +52,9 @@ def main():
|
||||
require("git")
|
||||
require("vim")
|
||||
check_vim_version()
|
||||
ensure_repo()
|
||||
install_vimrc()
|
||||
install_vim_plug()
|
||||
run(["vim", "-Nu", str(APP_PATH / ".vimrc"), "+set nomore", "+PlugInstall --sync", "+qall"])
|
||||
install_vimrc()
|
||||
run(["vim", "-Nu", str(APP_PATH / ".vimrc"), "-n", "-es", "--cmd", "set nomore", "+PlugInstall --sync", "+qall"])
|
||||
print("Vim configuration installed.")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user