Skip to content

Latest commit

 

History

History
224 lines (168 loc) · 9.08 KB

setup.md

File metadata and controls

224 lines (168 loc) · 9.08 KB

Setting up a fresh Windows machine

Bootstrapping with Scoop and winget

This works fine for Windows 11, where Windows Terminal and winget are already included.

  • Google Drive (no scoop/winget)
  • install Scoop itself (non admin PowerShell):
    • Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
    • irm get.scoop.sh | iex
  • git gud: scoop install git
  • add buckets: scoop bucket add extras, scoop bucket add sysinternals
  • get the goods: scoop install sharpkeys wincompose clink neovim bat less fd ripgrep keepassxc autoruns processhacker eartrumpet mpv.net paint.net screentogif shutup10 oh-my-posh git-aliases fzf psfzf zlocation win32yank
  • software with auto-updates (VS Code, Spotify, PowerToys, Windows Terminal) is better not installed via scoop
  • for things that require admin, e.g. OpenVPN:
    • scoop install sudo
    • sudo scoop install openvpn yes, sudo in PowerShell \o/
  • remaining stuff with winget:
    foreach ($app in @("HermannSchinagl.LinkShellExtension")) { winget install -s winget %app }

Updating PowerShell (pwsh) and Windows Terminal with Scoop

Since scoop is using pwsh internally, you will get errors about running pwsh processes. To fix this, start a Windows PowerShell (powershell.exe) session in Windows Terminal and do scoop update pwsh there (see ScoopInstaller/Main#3572 (comment)).

Similar problem for Windows Terminal: here, closing all Windows Terminal instances, starting conhost (legacy Windows command prompt), and running scoop update windows-terminal there is the solution.

Semi-regular Scoop Cleanups

sudo scoop clean -a  # delete old app versions
scoop cache rm *     # clear scoop cache

Git

  • Git - winget install -s winget git / scoop install git
  • clone dotfiles once for Windows (later again for WSL)
    • in Windows home (C:\Users\<user>)
    • git clone ssh://[email protected]/~yogan/git/priv/env

Keyboard

  • SharpKeys - winget install -s winget sharpkeys / scoop install sharpkeys
    • map <CapsLock><Ctrl>
    • swap <Esc><~>
    • note: PowerToyes has a Keyboard Manager, but that one needs to be running for the mappings to work, and generally does not work for some elevated stuff, like win logon; SharpKeys does some registry stuff that is lower level and works better
  • WinCompose - winget install -s winget wincompose / scoop install wincompose
    • symlink WinCompose.XCompose to .XCompose in %userprofile% (details how to symlink are at the top of WinCompose.XCompose itself)
    • use a env clone in Windows for this; do not link to env within WSL!

System Tools

Link Shell Extension

Link Shell Extension - winget install -s winget HermannSchinagl.LinkShellExtension - to create symlinks, hardlinks, junctions, etc.

clink

clink - winget install -s winget chrisant996.Clink - readline/history for cmd.exe

  • symlink env/clink/settings to C:\Users\<USERNAME>\AppData\Local\clink\
  • create hardlink to env/.inputrc in C:\Users\<USERNAME>\
  • rename hardlinked .inputrc to _inputrc

PowerShell

  • winget install -s winget powershell to install a recent PowerShell
  • prompt and keybindings (incl. ^W/^U etc.) are all in Profile.ps1
  • follow instructions in env/PowerShell/Profile.ps1
  • ^R requires fzf, which is not available via winget
    • either use choco if available, or
    • grab the zipfile from the GitHub releases
      • unzip to e.g. C:\Program Files\Fzf
      • add that to $PATH (system env vars)

Miscellaneous

  • NanaZip 7zip clone with Win11 integration
  • O&O ShutUp10++ - winget install shutup10++ (available from cmd/PS with shutup10 after installation)
    disable a lot of the dubious privacy-violating stuff of Windows 10/11
  • Process Hacker - choco install processhacker
    seems superior to Process Explorer; last release (2.39) is kinda old (2016), project seems to be currently developed as System Informer.
  • Process Explorer - choco install procexp
  • TCPView - choco install tcpview
  • Autoruns - choco install AutoRuns
  • EarTrumpet - winget install -s winget eartrumpet
    nice replacement for Windows volume control/mixer (directly shows controls and current volume level of applications)
  • Rufus create bootable USB drives from .iso images (like with dd on Linux) choco install rufus (note: rufus.exe can be found in C:\ProgramData\chocolatey\bin, it does not get added to the start menu automatically by choco)

Applications

Audio / Video

  • Spotify (winget borken, use installer)
  • Toastify (no winget, use installer) - global keyboard shortcuts and notifications
  • mpv.net - winget install -s winget mpv.net

Graphics / Document Viewers

Vim

  • choco install vim
  • create hardlink to env/.vimrc in $HOME (c:/user/foo/)
  • rename hardlinked .vimrc to _vimrc
  • make junction of env/.vim/ to c:\Program Files\vim\
  • rename .vim to vimfiles (remove old one there)

WSL

See Windows Subsystem for Linux (WSL).

Clone git Repos

To enable working with both Linux (WSL) and Windows programs on the files in my git repositories, they have to be cloned to a Windows path. Cloning and other git operations can be done straight from a WSL shell with WSL git.

cd winhome
git clone ssh://zogan.de/~yogan/git/priv/env
git clone ssh://zogan.de/~yogan/git/priv/docs
cd ; ln -s winhome/env ; ln -s winhome/docs

Useful WSL Utilities

  • xclip-xsel-WSL provides xclip and xsel in WSL so that you can access the Windows clipboard from the command line

Development

VS Code

  • winget install -s winget vscode
  • enable settings sync (pick everything except UI state), log in via GitHub

References

Package Managers

Windows Package Manager aka winget (preview)

The Windows Package Manager was announced at MS Build 2020 and is currently in preview. It could potentially replace Chocolatey in the long run. On Windows 10 Insider, winget is already available. For stable Windows 10, the quickest way to get it is to grab the latest release from GitHub (it's part of AppInstaller, so download the Microsoft.DesktopAppInstaller_GIBBERISH.appxbundle thingy and run that, it's fine).

For winget usage information, just call winget without any arguments. There is search and install, as you would expect, but currently there does not seem to be an update.

Chocolatey

First Time Setup

  • install Chocolatey as described (from Admin cmd or PowerShell)
  • choco should be in %PATH% after installation
    • ProTip™: use which npm package (npm install -g which)
  • Run all future choco commands as admin
  • choco feature enable -n=allowGlobalConfirmation

Usage

It makes sense to always use an elevated (Admin) cmd or PowerShell to work with choco (as we are installing software, this is perfectly fine.)

To install something new:

  • choco search foo
  • choco install foo

List and upgrade locally installed packages.

  • choco list -l
  • choco upgrade all

TODO