From f803a2741892cbb647106318642a62a20625d7d7 Mon Sep 17 00:00:00 2001 From: gwbeip Date: Mon, 28 Apr 2025 10:31:47 +0800 Subject: [PATCH] many changes --- README.md | 16 ++++++++++++++-- pwsh/HowToUse.md | 33 ++++++++++++++++++++++++++++----- starship/starship.toml | 2 +- wsl/README.md | 6 ++++++ zsh/install_ohmyzsh.sh | 2 +- 5 files changed, 50 insertions(+), 9 deletions(-) create mode 100644 wsl/README.md diff --git a/README.md b/README.md index dbac3af..84a9ce7 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,19 @@ [![State-of-the-art Shitcode](https://img.shields.io/static/v1?label=State-of-the-art&message=Shitcode&color=7B5804)](https://github.com/trekhleb/state-of-the-art-shitcode) -Automatically configure terminal according to my habits. +Automatically configure terminals according to my habits. ## For `ZSH` Using `Oh-My-ZSH` framework to manage plugins, and `Starship` to customize prompt. +Changes: +`Oh-My-ZSH` is installed at `$HOME/.oh-my-zsh`; +`$HOME/.zshrc` is linked to `zsh/zshrc`; +`$HOME/.config/starship.toml` is linked to `starship/starship.toml`; + +Required software: +`git`; `fzf`; `zoxide`; `python`; `starship` + ```shell git clone https://gitea.meip.work/gwbeip/TerminalPolyjuice.git $HOME/.TerminalPolyjuice cd $HOME/.TerminalPolyjuice/zsh @@ -14,4 +22,8 @@ zsh polyjuice.sh install_ohmyzsh config_starship check ``` `zsh/zshenv` contains some useful `$PATH` -`zsh/p10k.zsh` includes the configuration for execution time when using `powerlevel10k` \ No newline at end of file + +`zsh/p10k.zsh` includes the configuration for execution time when using `powerlevel10k` + +## For `powershell` + diff --git a/pwsh/HowToUse.md b/pwsh/HowToUse.md index 06f2bf1..f8effef 100644 --- a/pwsh/HowToUse.md +++ b/pwsh/HowToUse.md @@ -1,10 +1,33 @@ +# Install `PSReadLine` +Execute following the instruction in powershell to install `PSReadLine` and enable `IntelliSense` +```powershell +Install-Module -Name PSReadLine -AllowClobber -Force +Set-PSReadLineOption -PredictionSource History +``` + # Emacs mode +Add the following line into `$PROFILE` +```powershell Set-PSReadLineOption -EditMode Emacs +``` + +# Command Not Found +Add the following line into `$PROFILE` +```powershell +Import-Module -Name Microsoft.WinGet.CommandNotFound +``` + +# Starship +Create symbolic link `$HOME\.config\starship.toml` point to `$HOME\.TerminalPolyjuice\starship\starship.toml` + +```powershell +New-Item -ItemType SymbolicLink -Path "$HOME\.config\starship.toml" -Target "$HOME\.TerminalPolyjuice\starship\starship.toml" +``` # Oh-My-Posh Copy *.omp.json to `$env:POSH_THEMES_PATH` -Edit $PROFILE and add `oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/powerlevel10k_rainbow_eip.omp.json" | Invoke-Expression` at the top. - -# Command Not Found -Import-Module -Name Microsoft.WinGet.CommandNotFound - +Edit $PROFILE and add +```powershell +oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/powerlevel10k_rainbow_eip.omp.json" | Invoke-Expression +``` +at the top. diff --git a/starship/starship.toml b/starship/starship.toml index b4301fb..0571c1a 100644 --- a/starship/starship.toml +++ b/starship/starship.toml @@ -1,4 +1,4 @@ -# "$schema" = 'https://starship.rs/config-schema.json' +"$schema" = 'https://starship.rs/config-schema.json' format = """ [](color_orange)\ diff --git a/wsl/README.md b/wsl/README.md new file mode 100644 index 0000000..b42e126 --- /dev/null +++ b/wsl/README.md @@ -0,0 +1,6 @@ +# Disable adding windows path to WSL +edit `/etc/wsl.conf` and add: +```toml +[interop] +appendWindowsPath = false +``` \ No newline at end of file diff --git a/zsh/install_ohmyzsh.sh b/zsh/install_ohmyzsh.sh index 06056cb..356a577 100644 --- a/zsh/install_ohmyzsh.sh +++ b/zsh/install_ohmyzsh.sh @@ -122,7 +122,7 @@ fi # copying $HOME/.zshrc current_dir=$(dirname $(realpath "$0")) -if $(file "$HOME/.zshrc"); then +if [ -f "$HOME/.zshrc" ]; then if $(file "$HOME/.zshrc" | grep -q "symbolic link") ; then if [[ $(readlink "$HOME/.zshrc") != "$current_dir/zshrc" ]]; then ln -sf "$current_dir/zshrc" "$HOME/.zshrc"