dotfiles

Cross platform dotfiles for linux, mac and windows
git clone git@getsh.org:dotfiles.git
Log | Files | Refs

commit efb61c583d16c31323bbeaef1b009ceb2af32674
parent b57808f58b648bbcf1977c9902d7a216d6f64007
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date:   Wed, 14 Aug 2024 21:56:22 +0530

Fix longstanding clink not injecting on setup.cmd

Move .config/cmd/profile.cmd to .config/profile.cmd for better
performance at startup

Hardcord required packages from packages.txt into setup.txt

Remove setup.ps1 and print the instruction to install scoop from
setup.cmd itself

Remove .config/clink to use default path. Set clink settings from
setup.cmd

Rename .bat files to .cmd

Diffstat:
D.config/clink/clink_settings | 69---------------------------------------------------------------------
D.config/cmd/aliases.bat | 15---------------
A.config/cmd/aliases.cmd | 14++++++++++++++
D.config/cmd/packages.txt | 16----------------
D.config/cmd/profile.cmd | 21---------------------
M.config/cmd/setup.cmd | 44++++++++++++++++++++++++++++++++++----------
D.config/cmd/setup.ps1 | 10----------
A.config/profile.cmd | 23+++++++++++++++++++++++
8 files changed, 71 insertions(+), 141 deletions(-)

diff --git a/.config/clink/clink_settings b/.config/clink/clink_settings @@ -1,69 +0,0 @@ -# name: Command to run when injected -# type: string -clink.autostart = %XDG_CONFIG_HOME%\cmd\profile.cmd - -# name: Auto-update the Clink program files -# type: boolean -clink.autoupdate = False - -# name: Controls what startup logo to show -# type: enum -# options: none,full,short -clink.logo = none - -# name: Argument color -# type: color -color.arg = bold - -# name: Argument info color -# type: color -color.arginfo = yellow - -# name: Shell command completions -# type: color -color.cmd = bold - -# name: Color for < and > redirection symbols -# type: color -color.cmdredir = bold - -# name: Color for & and | command separators -# type: color -color.cmdsep = bold - -# name: Color for comment row -# type: color -color.comment_row = bright white on cyan - -# name: Description completion color -# type: color -color.description = bright cyan - -# name: Doskey completions -# type: color -color.doskey = bold cyan - -# name: Filtered completion color -# type: color -color.filtered = bold - -# name: Flag color -# type: color -color.flag = default - -# name: For user-interaction prompts -# type: color -color.interact = bold - -# name: Message area color -# type: color -color.message = default - -# name: Color for suggestion text -# type: color -color.suggestion = bright black - -# name: Unexpected argument color -# type: color -color.unexpected = default - diff --git a/.config/cmd/aliases.bat b/.config/cmd/aliases.bat @@ -1,15 +0,0 @@ -doskey v=nvim $* -doskey vi=vim $* -doskey n=cd $* -doskey g=git $* -doskey e=%EDITOR% $* -doskey l=lfcd.cmd -doskey ls=dir /B $* -doskey cp=copy $* -doskey m=make $* -doskey mv=move $* -doskey pwd=cd -doskey rm=del $* -doskey clear=cls -doskey lynx=lynx -cfg %USERPROFILE%\.config\lynx\lynx.cfg $* -doskey cat=type $* diff --git a/.config/cmd/aliases.cmd b/.config/cmd/aliases.cmd @@ -0,0 +1,14 @@ +doskey n=cd $* +doskey g=git $* +doskey e=%EDITOR% $* +doskey l=lfcd.cmd +doskey ls=dir /B $* +doskey cp=copy $* +doskey m=make $* +doskey mv=move $* +doskey pwd=cd +doskey rm=del $* +doskey clear=cls +doskey lynx=lynx -cfg %USERPROFILE%\.config\lynx\lynx.cfg $* +doskey cat=type $* +doskey hb=sh %USERPROFILE%\.local\bin\sh\hb $* diff --git a/.config/cmd/packages.txt b/.config/cmd/packages.txt @@ -1,16 +0,0 @@ -7zip -clink -dos2unix -gpg -grep -lf -lynx -make -mingit -mpv -sed -sudo -unzip -uutils -vim -wget diff --git a/.config/cmd/profile.cmd b/.config/cmd/profile.cmd @@ -1,21 +0,0 @@ -@echo off - -cd %USERPROFILE% - -set HOME=%USERPROFILE% -set XDG_CONFIG_HOME=%HOME%/.config -set XDG_DATA_HOME=%HOME%/.local/share -set XDG_CACHE_HOME=%HOME%/.cache -set VISUAL=vim -set EDITOR=%VISUAL% - -set GNUPGHOME=%XDG_DATA_HOME%/gnupg -set GPGHOME=%XDG_DATA_HOME%/gnupg -set PASSWORD_STORE_DIR=%XDG_DATA_HOME%/pass -set PASS_BASE_DIR=%XDG_DATA_HOME%/pass -set NB_PATH=%XDG_DATA_HOME%/notebook - -set PATH=%PATH%;%USERPROFILE%/.local/bin/cmd - -@call %XDG_CONFIG_HOME%/cmd/aliases.bat -@call %XDG_CONFIG_HOME%/cmd/userenv.bat diff --git a/.config/cmd/setup.cmd b/.config/cmd/setup.cmd @@ -1,15 +1,39 @@ -@echo off -powershell %XDG_CONFIG_HOME%\cmd\setup.ps1 -@call %XDG_CONFIG_HOME%\cmd\environment.bat +@echo on -:: Apply config patches -:: TODO Use mklink instead of xcopy, it will prevent overriding changed files in the destination dir. +rem TODO Make this work for Administrator accounts + +where scoop >nul 2>&1 +if not %errorlevel% equ 0 ( +rem Run this in powershell, before + echo Run this in powershell to install scoop and run this script again: + echo Set-ExecutionPolicy RemoteSigned -scope CurrentUser + echo powershell -Command "Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')" + rem Install only the absolute essentials + echo scoop install 7zip clink dos2unix grep gpg lf make mingit mpv sed sudo unzip vim + exit 1 +) + +@call %~dp0\..\profile.cmd + +rem Apply config patches +rem TODO Use mklink instead of xcopy, it will prevent overriding changed files in the destination dir. xcopy /Y %USERPROFILE%\.config\cmd\patch %USERPROFILE%\ /S /E -IF NOT EXIST %USERPROFILE%\.config\vim\vimrc mklink %USERPROFILE%\_vimrc %USERPROFILE%\.config\vim\vimrc +rem IF NOT EXIST %USERPROFILE%\.config\vim\vimrc mklink %USERPROFILE%\_vimrc %USERPROFILE%\.config\vim\vimrc + +if "%SCOOP%" == "" ( + echo "SCOOP variable not set, defaulting to %USERPROFILE%\scoop" + set SCOOP=%USERPROFILE%\scoop +) mkdir %SYSTEMDRIVE%\bin -cp %SCOOP%\apps\busybox\current\busybox.exe %SYSTEMDRIVE%\bin -cp %SCOOP%\shims\sh.* %SYSTEMDRIVE%\bin -:: TODO Report this in scoop and remove this line -rm %SCOOP%\apps\gpg\current\bin\gpgconf.ctl +copy %SCOOP%\apps\busybox\current\busybox.exe %SYSTEMDRIVE%\bin +copy %SCOOP%\shims\sh.* %SYSTEMDRIVE%\bin + +rem TODO Report this in scoop and remove this line +del %SCOOP%\apps\gpg\current\bin\gpgconf.ctl + +call clink autorun install -- clink inject -q +call clink set clink.autostart "%XDG_CONFIG_HOME%\profile.cmd" +call clink set clink.autoupdate off + diff --git a/.config/cmd/setup.ps1 b/.config/cmd/setup.ps1 @@ -1,10 +0,0 @@ -Set-ExecutionPolicy RemoteSigned -scope CurrentUser - -#TODO Make this work for Administrator accounts -Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh') - -# Install the absolute essentials -scoop install $(gc ~/.config/cmd/packages.txt) - -# Setup clink -clink autorun set "clink inject --profile %XDG_CONFIG_HOME%\clink" diff --git a/.config/profile.cmd b/.config/profile.cmd @@ -0,0 +1,23 @@ +@echo off + +cd %USERPROFILE% + +set XDG_ROOT=%1 +if "%XDG_ROOT%" == "" set XDG_ROOT=%USERPROFILE% +set XDG_CONFIG_HOME=%XDG_ROOT%\.config +set XDG_DATA_HOME=%XDG_ROOT%\.local\share +set XDG_CACHE_HOME=%XDG_ROOT%\.cache +set VISUAL=vim +set EDITOR=%VISUAL% + +set GNUPGHOME=%XDG_DATA_HOME%/gnupg +set GPGHOME=%XDG_DATA_HOME%/gnupg +set PASSWORD_STORE_DIR=%XDG_DATA_HOME%/pass +set PASS_BASE_DIR=%XDG_DATA_HOME%/pass + +set FUZZER=fzf + +set PATH=%PATH%;%USERPROFILE%\.local\bin\cmd;%USERPROFILE%\work\spm + +@call %XDG_CONFIG_HOME%\cmd\aliases.cmd +if exist "%XDG_CONFIG_HOME%\cmd\userenv.cmd" @call %XDG_CONFIG_HOME%\cmd\userenv.cmd