1
0

Added kanto config on Windows

Changed config location for starship on Windows
Updated dots.bat to include patch function
Use patch to strip hostname prefixes when installing
Style change for all caps in dots.bat
This commit is contained in:
2025-10-01 02:25:38 +01:00
parent ce8e8fe6ec
commit 2474ac0fd5
3 changed files with 39 additions and 14 deletions

View File

@@ -1,3 +1,6 @@
-- Load starship -- Set config location to be in %APPDATA% rather than the default %USERPROFILE%\.config
local appdata = os.getenv("APPDATA")
os.setenv("STARSHIP_CONFIG", appdata .. "\\starship.toml")
-- Load starship
load(io.popen('starship init cmd'):read("*a"))() load(io.popen('starship init cmd'):read("*a"))()

View File

@@ -1,6 +1,6 @@
add_newline = false add_newline = false
scan_timeout = 10 scan_timeout = 10
format = "\\[$username$hostname\\] :: $directory $cmd_duration$character" format = "\\[$username$hostname\\] :: $directory $cmd_duration$character"
[line_break] [line_break]
disabled = true disabled = true

View File

@@ -1,5 +1,5 @@
@ECHO OFF @ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION SETLOCAL DISABLEDELAYEDEXPANSION
IF "%1" == "install" ( IF "%1" == "install" (
CALL :Install CALL :Install
@@ -7,30 +7,52 @@ IF "%1" == "install" (
IF "%1" == "pull" ( IF "%1" == "pull" (
CALL :Pull CALL :Pull
) ELSE ( ) ELSE (
echo usage: %0 ^<install^|pull^|diff^> ECHO usage: %0 ^<install^|pull^|diff^>
) )
) )
GOTO :EOF GOTO :EOF
:Install :Install
echo [Info] :: Installing dotfiles ECHO [Info] :: Installing dotfiles
xcopy /E /I /Y /Q "config\nvim" "%LOCALAPPDATA%\nvim" > NUL XCOPY /E /I /Y /Q "config\nvim" "%LOCALAPPDATA%\nvim" > NUL
copy /Y "config\starship.toml" "%APPDATA%\" > NUL COPY /Y "config\starship.toml" "%APPDATA%\" > NUL
copy /Y "config\clink\inputrc" "%LOCALAPPDATA%\.inputrc" > NUL COPY /Y "config\clink\inputrc" "%LOCALAPPDATA%\.inputrc" > NUL
CALL :Patch %APPDATA%\starship.toml
WHERE /q "starship" WHERE /q "starship"
IF %ERRORLEVEL% equ 0 ( IF %ERRORLEVEL% equ 0 (
IF NOT EXIST "%LOCALAPPDATA%\clink" ( MKDIR "%LOCALAPPDATA%\clink" ) IF NOT EXIST "%LOCALAPPDATA%\clink" ( MKDIR "%LOCALAPPDATA%\clink" )
copy "config\clink\starship.lua" "%LOCALAPPDATA%\clink\" > NUL COPY "config\clink\starship.lua" "%LOCALAPPDATA%\clink\" > NUL
) )
GOTO :EOF GOTO :EOF
:Pull :Pull
echo [Info] :: Pulling dotfile changes ECHO [Info] :: Pulling dotfile changes
xcopy /E /I /Y "%LOCALAPPDATA%\nvim" "config\nvim" XCOPY /E /I /Y "%LOCALAPPDATA%\nvim" "config\nvim"
copy /Y "%APPDATA%\starship.toml" "config\" COPY /Y "%LOCALAPPDATA%\.inputrc" "config\clink\inputrc"
copy /Y "%LOCALAPPDATA%\.inputrc" "config\clink\inputrc" GOTO :EOF
:Patch
SET "PREFIX=#%COMPUTERNAME% "
SET "REPLACEMENT="
SET "TEMPFILE=%TEMP%\tmpdots%RANDOM%"
FOR /f "DELIMS=" %%A in ('FINDSTR /N "^" "%1"') DO (
SET "LINE=%%A"
SETLOCAL ENABLEDELAYEDEXPANSION
SET "LINE=!LINE:%PREFIX%=%REPLACEMENT%!"
SET "LINE=!LINE:*:=!"
ECHO:!LINE!>> %TEMPFILE%
ENDLOCAL
)
MOVE /Y %TEMPFILE% %1 > NUL
GOTO :EOF GOTO :EOF