Skip to content

Instantly share code, notes, and snippets.

@rkitover
Last active January 12, 2022 23:11
Show Gist options
  • Save rkitover/b0831d048755c7d034b0a936b2a50604 to your computer and use it in GitHub Desktop.
Save rkitover/b0831d048755c7d034b0a936b2a50604 to your computer and use it in GitHub Desktop.
PowerShell installer script for nano with syntax highlighting on Windows
$erroractionpreference = 'stop'
$releases = 'https://files.lhmouse.com/nano-win/'
ri -r -fo ~/Downloads/nano-installer -ea ignore
mkdir ~/Downloads/nano-installer | out-null
pushd ~/Downloads/nano-installer
curl -sLO ($releases + (
iwr -usebasicparsing $releases | % links |
? href -match '\.7z$' | select -last 1 | % href
))
7z x nano*.7z | out-null
mkdir ~/.local/bin -ea ignore | out-null
cpi -fo pkg_x86_64*/bin/nano.exe ~/.local/bin
mkdir ~/.nano -ea ignore | out-null
git clone https://github.com/scopatz/nanorc *> $null
gci -r nanorc -i *.nanorc | cpi -dest ~/.nano
popd
("include `"" + (($env:USERPROFILE -replace '\\','/') `
-replace '^[^/]+','').tolower() + `
"/.nano/*.nanorc`"") >> ~/.nanorc
gi ~/.nanorc,~/.nano,~/.local/bin/nano.exe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment