Skip to content

Instantly share code, notes, and snippets.

@motebaya
Last active April 5, 2024 06:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save motebaya/77da69936621d4274caa30d385b1d100 to your computer and use it in GitHub Desktop.
Save motebaya/77da69936621d4274caa30d385b1d100 to your computer and use it in GitHub Desktop.
personal windows powershell config
# theme
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/craver.omp.json" | Invoke-Expression
# aliases
New-Alias py python310
New-Alias rb ruby
# Omp history
Set-PSReadLineOption -PredictionSource History
Set-PSReadLineOption -PredictionViewStyle ListView
# icons dirs
Import-Module Terminal-Icons
# i prefer using the terminal and controlling all commands without needing administrator
# access like in Linux. RUBY and GIT don't get access to USERPROFILE when i install them,
# so i need to move their default ENV variables. maybe i'll always apply this in other apps too.
# git
$env:GIT_CONFIG_GLOBAL="D:\Software\Git\.gitconfig"
# ruby
$env:GEM_HOME = "D:/Software/RubyWindows/.gem"
$env:GEM_PATH = "$env:GEM_HOME;D:\Software\RubyWindows\3.3.0-1\lib\ruby\gems\3.3.0"
$env:GEM_SPEC_CACHE = "D:\Software\RubyWindows\.cache"
$env:GEMRC = "D:\Software\RubyWindows\.gem\.gemrc"
$env:XDG_CACHE_HOME="D:\Software\RubyWindows\.cache"
$env:RBENV_ROOT = "D:\Software\RubyWindows"
$env:IRB_HISTORY_PATH = "D:\Software\RubyWindows"
$env:IRBRC = "d:\Software\RubyWindows\.irbrc"
$env:BUNDLE_USER_CACHE = "D:\Software\RubyWindows\.bundle-cache"
# nano -> remove from env var, then set function to call nano path directly with custom rcfile too.
function nano { D:\Software\Nano\bin\nano.exe --rcfile 'D:\Software\Nano\.nanorc' $args }
@motebaya
Copy link
Author

motebaya commented Mar 29, 2024

i think need create symbolick for support regex / asterisk wildcard (path\*.nanorc). but it USERPROFILE not readable without admin.

print('\n'.join(map(lambda x: f"include \"D:\\Software\\Nano\\share\\nano\\{x}\"", list(filter(lambda x: x.endswith('.nanorc'), os.listdir('D:\\Software\\Nano\\share\\nano'))))))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment