-
-
Save javafun/8764e48496fcb472fe6b560d00dd1e5d to your computer and use it in GitHub Desktop.
Revisions
-
mh-firouzjah revised this gist
Oct 15, 2021 . 1 changed file with 123 additions and 253 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,255 +1,125 @@ { "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json", "blocks": [ { "alignment": "left", "segments": [ { "foreground": "#4063D8", "properties": { "postfix": "", "prefix": "", "windows": "", "wsl": "", "wsl_separator": " - " }, "style": "diamond", "type": "os" }, { "foreground": "#f3863d", "properties": { "display_host": false, "postfix": "", "prefix": " " }, "style": "diamond", "type": "session" }, { "foreground": "#9FD356", "properties": { "ahead_color": "#f2b25c", "behind_color": "#f06d65", "branch_max_length": 30, "color_background": false, "display_stash_count": true, "display_status": true, "display_upstream_icon": true, "local_changes_color": "#9e81b6", "postfix": "]", "prefix": " [", "staging_color": "#9e81b6", "status_colors_enabled": true, "working_color": "#BD6200" }, "style": "diamond", "type": "git" }, { "foreground": "#5598df", "properties": { "folder_icon": "", "home_icon": "ﳐ", "max_depth": 3, "prefix": " ", "style": "agnoster_short" }, "style": "diamond", "type": "path" } ], "type": "prompt" }, { "alignment": "right", "segments": [ { "properties": { "postfix": "", "time_format": "15:04:05" }, "style": "diamond", "type": "time" }, { "properties": { "charged_color": "#4caf50", "charged_icon": "", "charging_color": "#40c4ff", "charging_icon": "", "color_background": false, "discharging_color": "#ff5722", "discharging_icon": "", "postfix": "", "prefix": " " }, "style": "diamond", "type": "battery" } ], "type": "prompt" }, { "alignment": "left", "newline": true, "segments": [ { "foreground": "#5598df", "properties": { "postfix": "s", "prefix": " ", "style": "dallas", "threshold": 0 }, "style": "diamond", "type": "executiontime" }, { "foreground": "#9FD356", "properties": { "always_enabled": true, "always_numeric": false, "color_background": false, "display_exit_code": true, "error_color": "#E84855", "prefix": " " }, "style": "diamond", "type": "exit" } ], "type": "prompt" } ] } -
mh-firouzjah revised this gist
Jun 7, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ > Theme | History | KeyBinding  in order to make windows powershell more comfortable and add a some theme and features like history binding, auto complete on keypress and so on, if you have used linux teminl wiht `zsh` for example, we are going to make powershell like that as much as we can. -
mh-firouzjah revised this gist
Jun 7, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ > Theme | History | KeyBinding  in order to make windows powershell more comfortable and add a some theme and features like history binding, auto complete on keypress and so on, if you have used linux teminl wiht `zsh` for example, we are going to make powershell like that as much as we can. -
mh-firouzjah revised this gist
Jun 7, 2021 . 2 changed files with 28 additions and 24 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,40 +2,43 @@ > Theme | History | KeyBinding  in order to make windows powershell more comfortable and add a some theme and features like history binding, auto complete on keypress and so on, if you have used linux teminl wiht `zsh` for example, we are going to make powershell like that as much as we can. ## What we will achieve - `Git status information`: [`Posh-Git`](https://github.com/dahlbyk/posh-git) adds Git status information to your prompt as well as tab-completion for Git commands, parameters, remotes, and branch names. - `Theme`: [`Oh-My-Posh`](https://github.com/JanDeDobbeleer/oh-my-posh) provides theme capabilities for your PowerShell prompt. Oh-My-Posh comes with several [built-in themes](https://ohmyposh.dev/docs/themes/). - `History and History Based Prediction`: Predictive IntelliSense is implemented in the PowerShell engine and presented through the [PSReadLine module](https://devblogs.microsoft.com/powershell/announcing-psreadline-2-1-with-predictive-intellisense/#user-content-psreadline-210--history-based-prediction-release). - `Key Bindings for Predictions`: Key bindings control cursor movement and additional features within the prediction. When you type a character the prediction suggestes you last command started with typed character(s). by using Up/Down Arrows you can switch between commands with same start-characters.   ## How we will achieve - Run powershell as an `administrator` and execute following command to `disable the execution policy`, otherwise it wont let you follow next steps - `Set-ExecutionPolicy RemoteSigned` - `Register-PSRepository -Default` # this registers the default repository for PowerShell modules, so we can install packages thats are in next steps - `Install-Module posh-git -Scope CurrentUser` - `Install-Module oh-my-posh -Scope CurrentUser` - `Install-Module -Name PSReadLine -Scope CurrentUser -Force -SkipPublisherCheck` - Now you need to create a profile to set custom settings for powershell, run the following caommand: - `notepad $PROFILE` # this would create/edit file as: "C:\Users\<YOURUSERNAME>\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1" - Now copy the following code and past it in the notepad and save the file. - You may need to install a font that supports the emojis!, I suggest to use [Hack Nerd Font Mono](https://github.com/mh-firouzjaah/coding-fonts/blob/main/coding-fonts/Hack%20Regular%20Nerd%20Font%20Complete%20Mono.ttf) - after downloading the font and install it, right click on powershells top bar and go to properties, click on `Font` tab and select the font. **if youre using `Windows Terminal`:** - open the app, hit `Ctrl` and `,` then click on gear button at down-left side, inside the open jason file search for `"profiles":`, now edit/add `"defaults":` the `fontFace` so that finally sould looks: ```bash ... "profiles": { "defaults": { "fontFace": "Hack Nerd Font Mono", ... @@ -46,21 +49,22 @@ in order to make windows powershell more comfortable and add a some theme and fe **Read more at:** - <https://devblogs.microsoft.com/powershell/announcing-psreadline-2-1-with-predictive-intellisense/> - <https://docs.microsoft.com/en-us/windows/terminal/tutorials/powerline-setup> ### If you prefer to create your custom theme **It is possible to create your own theme for powershell**, in order to do that: - run `Set-PoshPrompt -Theme jandedobbeleer` to set an initial theme, then run `export-PoshTheme -FilePath ~/.oh-my-posh.omp.json` to export the theme at `"C:\Users\<YOURUSERNAME\.oh-my-posh.omp.json"`. - now open that json file `C:\Users\<YOURUSERNAME\.oh-my-posh.omp.json` and customize as you want - run `Set-PoshPrompt -Theme C:\Users\<YOURUSERNAME\.oh-my-posh.omp.json` so your edited theme would be used. - have look at [Nerd Fonts](https://www.nerdfonts.com/cheat-sheet), to find more icons _The json file attached is an example, which I've edited for test perpose._ ## Profile Code ```ps1 Import-Module posh-git Import-Module oh-my-posh @@ -98,4 +102,4 @@ Set-PSReadLineKeyHandler -Key End -ScriptBlock { [Microsoft.PowerShell.PSConsoleReadLine]::AcceptSuggestion($key, $arg) } } ``` LoadingSorry, something went wrong. Reload?Sorry, we cannot display this file.Sorry, this file is invalid so it cannot be displayed. -
mh-firouzjah revised this gist
Jun 2, 2021 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -56,6 +56,7 @@ in order to make windows powershell more comfortable and add a some theme and fe - run `Set-PoshPrompt -Theme jandedobbeleer` to set an initial theme, then run `export-PoshTheme -FilePath ~/.oh-my-posh.omp.json` to export the theme at `"C:\Users\<YOURUSERNAME\.oh-my-posh.omp.json"`. - now open that json file `C:\Users\<YOURUSERNAME\.oh-my-posh.omp.json` and customize as you want - run `Set-PoshPrompt -Theme C:\Users\<YOURUSERNAME\.oh-my-posh.omp.json` so your edited theme would be used. - have look at [Nerd Fonts](https://www.nerdfonts.com/cheat-sheet), to find more icons *The json file attached is an example, which I've edited for test perpose.* -
mh-firouzjah renamed this gist
Jun 2, 2021 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
mh-firouzjah revised this gist
Jun 2, 2021 . 2 changed files with 265 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -49,6 +49,16 @@ in order to make windows powershell more comfortable and add a some theme and fe - <https://devblogs.microsoft.com/powershell/announcing-psreadline-2-1-with-predictive-intellisense/> - <https://docs.microsoft.com/en-us/windows/terminal/tutorials/powerline-setup> ### If you prefer to create your custom theme **It is possible to create your own theme for powershell**, in order to do that: - run `Set-PoshPrompt -Theme jandedobbeleer` to set an initial theme, then run `export-PoshTheme -FilePath ~/.oh-my-posh.omp.json` to export the theme at `"C:\Users\<YOURUSERNAME\.oh-my-posh.omp.json"`. - now open that json file `C:\Users\<YOURUSERNAME\.oh-my-posh.omp.json` and customize as you want - run `Set-PoshPrompt -Theme C:\Users\<YOURUSERNAME\.oh-my-posh.omp.json` so your edited theme would be used. *The json file attached is an example, which I've edited for test perpose.* ## Profile Code: ```ps1 Import-Module posh-git This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,255 @@ { "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json", "blocks": [ { "alignment": "left", "segments": [ { "background": "#f19f86", "foreground": "#ffffff", "leading_diamond": "", "trailing_diamond": "", "properties": { "postfix": " <transparent></>" }, "type": "os", "style": "diamond" }, { "background": "#c386f1", "foreground": "#ffffff", "properties": { "display_host": true, "prefix": "<transparent></> ", "postfix": " <transparent></>" }, "style": "diamond", "type": "session" }, { "type": "root", "style": "diamond", "background": "#ff479c", "foreground": "#ffffff", "properties": { "root_icon": "\uF0E7", "prefix": "<transparent></> ", "postfix": " <transparent></>" } }, { "type": "path", "style": "diamond", "background": "#ff479c", "foreground": "#ffffff", "properties": { "style": "folder", "enable_hyperlink": true, "home_icon": "", "folder_icon": "<#B5B2C2>ﱮ</>", "folder_separator_icon": "/", "prefix": "<transparent></> ", "postfix": " <transparent></>" } }, { "background": "#fffb38", "foreground": "#193549", "properties": { "display_status": true, "display_stash_count": true, "status_colors_enabled": true, "ahead_color": "#89d1dc", "behind_color": "#f17c37", "ahead_and_behind_color": "#f26d50", "local_changes_color": "#ffb648", "stash_count_icon": " ", "prefix": "<transparent></> ", "postfix": " <transparent></>" }, "style": "powerline", "type": "git" }, { "background": "#6CA35E", "foreground": "#ffffff", "properties": { "display_version": true, "prefix": "<transparent></> ", "postfix": " <transparent></>" }, "style": "powerline", "type": "node" }, { "background": "#8ED1F7", "foreground": "#111111", "properties": { "display_version": true, "prefix": "<transparent></> ", "postfix": " <transparent></>" }, "style": "powerline", "type": "go" }, { "background": "#4063D8", "foreground": "#111111", "properties": { "display_version": true, "prefix": "<transparent></> ", "postfix": " <transparent></>" }, "style": "powerline", "type": "julia" }, { "background": "#FFDE57", "foreground": "#111111", "properties": { "display_mode": "files", "display_version": true, "display_virtual_env": false, "prefix": "<transparent></> ", "postfix": " <transparent></>" }, "style": "powerline", "type": "python" }, { "background": "#AE1401", "foreground": "#ffffff", "properties": { "display_mode": "files", "display_version": true, "prefix": "<transparent></> ", "postfix": " <transparent></>" }, "style": "powerline", "type": "ruby" }, { "background": "#FEAC19", "foreground": "#ffffff", "properties": { "display_mode": "files", "display_version": false, "prefix": "<transparent></> ", "postfix": " <transparent></>" }, "style": "powerline", "type": "azfunc" }, { "background_templates": [ "{{if contains \"default\" .Profile}}#FFA400{{end}}", "{{if contains \"jan\" .Profile}}#f1184c{{end}}" ], "foreground": "#ffffff", "properties": { "display_default": false, "prefix": "<transparent></> ", "postfix": " <transparent></>" }, "style": "powerline", "type": "aws" }, { "background": "#ffff66", "foreground": "#111111", "powerline_symbol": "", "properties": { "root_icon": "<transparent></>", "postfix": " <transparent></>" }, "style": "powerline", "type": "root" } ], "type": "prompt" }, { "segments": [ { "background": "#1BD760", "foreground": "#111111", "invert_powerline": true, "powerline_symbol": "", "properties": { "paused_icon": " ", "playing_icon": " ", "prefix": " " }, "style": "powerline", "type": "ytm" }, { "background": "#f36943", "foreground": "#ffffff", "invert_powerline": true, "powerline_symbol": "", "properties": { "battery_icon": "", "charged_color": "#4caf50", "charged_icon": " ", "charging_color": "#40c4ff", "charging_icon": " ", "color_background": true, "discharging_color": "#ff5722", "discharging_icon": " ", "postfix": " " }, "style": "powerline", "type": "battery" }, { "background": "#2e9599", "foreground": "#111111", "invert_powerline": true, "leading_diamond": "", "style": "diamond", "trailing_diamond": "", "type": "time" } ], "type": "prompt", "alignment": "right" }, { "type": "prompt", "alignment": "left", "newline": true, "segments": [ { "background": "#2e9599", "foreground": "#ffffff", "properties": { "always_enabled": true, "prefix": "<transparent></>", "postfix": "<transparent></>" }, "style": "plain", "type": "executiontime" }, { "type": "exit", "style": "diamond", "foreground": "#2e9599", "trailing_diamond": "", "leading_diamond": "", "properties": { "prefix": "", "postfix": "", "always_enabled": true, "error_color": "#ec4646", "display_exit_code": false } } ] } ], "console_title": true, "console_title_style": "template", "console_title_template": "{{ .Shell }} in {{ .Folder }}", "final_space": true } -
mh-firouzjah revised this gist
Jun 2, 2021 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,6 +12,7 @@ in order to make windows powershell more comfortable and add a some theme and fe - `Key Bindings for Predictions`: Key bindings control cursor movement and additional features within the prediction. When you type a character the prediction suggestes you last command started with typed character(s). by using Up/Down Arrows you can switch between commands with same start-characters.   ## How we will achieve -
mh-firouzjah revised this gist
Jun 2, 2021 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,7 +8,8 @@ in order to make windows powershell more comfortable and add a some theme and fe - `Git status information`: [`Posh-Git`](https://github.com/dahlbyk/posh-git) adds Git status information to your prompt as well as tab-completion for Git commands, parameters, remotes, and branch names. - `Theme`: [`Oh-My-Posh`](https://github.com/JanDeDobbeleer/oh-my-posh) provides theme capabilities for your PowerShell prompt. Oh-My-Posh comes with several [built-in themes](https://ohmyposh.dev/docs/themes/). - `History and History Based Prediction`: Predictive IntelliSense is implemented in the PowerShell engine and presented through the [PSReadLine module](https://devblogs.microsoft.com/powershell/announcing-psreadline-2-1-with-predictive-intellisense/#user-content-psreadline-210--history-based-prediction-release). - `Key Bindings for Predictions`: Key bindings control cursor movement and additional features within the prediction. When you type a character the prediction suggestes you last command started with typed character(s). by using Up/Down Arrows you can switch between commands with same start-characters.  -
mh-firouzjah revised this gist
Jun 2, 2021 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,6 +8,7 @@ in order to make windows powershell more comfortable and add a some theme and fe - `Git status information`: [`Posh-Git`](https://github.com/dahlbyk/posh-git) adds Git status information to your prompt as well as tab-completion for Git commands, parameters, remotes, and branch names. - `Theme`: [`Oh-My-Posh`](https://github.com/JanDeDobbeleer/oh-my-posh) provides theme capabilities for your PowerShell prompt. Oh-My-Posh comes with several [built-in themes](https://ohmyposh.dev/docs/themes/). - `History and History Based Prediction`: [Predictive IntelliSense is implemented in the PowerShell engine and presented through the PSReadLine module](https://devblogs.microsoft.com/powershell/announcing-psreadline-2-1-with-predictive-intellisense/#user-content-psreadline-210--history-based-prediction-release).  -
mh-firouzjah revised this gist
Jun 2, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,7 +11,7 @@ in order to make windows powershell more comfortable and add a some theme and fe  ## How we will achieve - Run powershell as an `administrator` and execute following command to `disable the execution policy`, otherwise it wont let you follow next steps - `Set-ExecutionPolicy RemoteSigned` -
mh-firouzjah revised this gist
Jun 2, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,7 +9,7 @@ in order to make windows powershell more comfortable and add a some theme and fe - `Git status information`: [`Posh-Git`](https://github.com/dahlbyk/posh-git) adds Git status information to your prompt as well as tab-completion for Git commands, parameters, remotes, and branch names. - `Theme`: [`Oh-My-Posh`](https://github.com/JanDeDobbeleer/oh-my-posh) provides theme capabilities for your PowerShell prompt. Oh-My-Posh comes with several [built-in themes](https://ohmyposh.dev/docs/themes/).  ## so follow me: -
mh-firouzjah revised this gist
Jun 2, 2021 . 1 changed file with 10 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,16 @@ > Theme | History | KeyBinding in order to make windows powershell more comfortable and add a some theme and features like history binding, auto complete on keypress and so on, if you have used linux teminl wiht `zsh` for example, we are going to make powershell like that as much as we can. ## What we will achieve - `Git status information`: [`Posh-Git`](https://github.com/dahlbyk/posh-git) adds Git status information to your prompt as well as tab-completion for Git commands, parameters, remotes, and branch names. - `Theme`: [`Oh-My-Posh`](https://github.com/JanDeDobbeleer/oh-my-posh) provides theme capabilities for your PowerShell prompt. Oh-My-Posh comes with several [built-in themes](https://ohmyposh.dev/docs/themes/). [!theme-and-git-info](https://docs.microsoft.com/en-us/windows/terminal/images/powerline-powershell.png) ## so follow me: - Run powershell as an `administrator` and execute following command to `disable the execution policy`, otherwise it wont let you follow next steps - `Set-ExecutionPolicy RemoteSigned` -
mh-firouzjah revised this gist
Jun 2, 2021 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -16,7 +16,7 @@ in order to make windows powershell more comfortable and add a some theme and fe - You may need to install a font that supports the emojis!, I suggest to use [Hack Nerd Font Mono](https://github.com/mh-firouzjaah/coding-fonts/blob/main/coding-fonts/Hack%20Regular%20Nerd%20Font%20Complete%20Mono.ttf) - after downloading the font and install it, right click on powershells top bar and go to properties, click on `Font` tab and select the font. **if youre using `Windows Terminal`:** - open the app, hit `Ctrl` and `,` then click on gear button at down-left side, inside the open jason file search for `"profiles":`, now edit/add `"defaults": ` the `fontFace` so that finally sould looks: ```bash @@ -32,7 +32,7 @@ in order to make windows powershell more comfortable and add a some theme and fe ... ``` **Read more at:** - <https://devblogs.microsoft.com/powershell/announcing-psreadline-2-1-with-predictive-intellisense/> - <https://docs.microsoft.com/en-us/windows/terminal/tutorials/powerline-setup> -
mh-firouzjah revised this gist
Jun 2, 2021 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -33,6 +33,7 @@ in order to make windows powershell more comfortable and add a some theme and fe ``` ** Read more at: ** - <https://devblogs.microsoft.com/powershell/announcing-psreadline-2-1-with-predictive-intellisense/> - <https://docs.microsoft.com/en-us/windows/terminal/tutorials/powerline-setup> -
mh-firouzjah revised this gist
Jun 2, 2021 . 1 changed file with 2 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,8 @@ # Better PowerShell > Theme | History | KeyBinding in order to make windows powershell more comfortable and add a some theme and features like history binding, auto complete on keypress and so on, if you have used linux teminl wiht `zsh` for example, we are going to make powershell like that as much as we can. so follow me: - Run powershell as an `administrator` and execute following command to `disable the execution policy`, otherwise it wont let you follow next steps - `Set-ExecutionPolicy RemoteSigned` -
mh-firouzjah revised this gist
Jun 2, 2021 . No changes.There are no files selected for viewing
-
mh-firouzjah revised this gist
Jun 2, 2021 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -16,6 +16,7 @@ follow me: - Now copy the following code and past it in the notepad and save the file. - You may need to install a font that supports the emojis!, I suggest to use [Hack Nerd Font Mono](https://github.com/mh-firouzjaah/coding-fonts/blob/main/coding-fonts/Hack%20Regular%20Nerd%20Font%20Complete%20Mono.ttf) - after downloading the font and install it, right click on powershells top bar and go to properties, click on `Font` tab and select the font. ** if youre using `Windows Terminal`:** - open the app, hit `Ctrl` and `,` then click on gear button at down-left side, inside the open jason file search for `"profiles":`, now edit/add `"defaults": ` the `fontFace` so that finally sould looks: -
mh-firouzjah revised this gist
Jun 2, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,7 @@ follow me: - Now you need to create a profile to set custom settings for powershell, run the following caommand: - `notepad $PROFILE` # this would create/edit file as: "C:\Users\<YOURUSERNAME>\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1" - Now copy the following code and past it in the notepad and save the file. - You may need to install a font that supports the emojis!, I suggest to use [Hack Nerd Font Mono](https://github.com/mh-firouzjaah/coding-fonts/blob/main/coding-fonts/Hack%20Regular%20Nerd%20Font%20Complete%20Mono.ttf) - after downloading the font and install it, right click on powershells top bar and go to properties, click on `Font` tab and select the font. ** if youre using `Windows Terminal`:** -
mh-firouzjah revised this gist
Jun 2, 2021 . 1 changed file with 25 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,18 +2,35 @@ > Theme | History | KeyBinding in order to make windows powershell more comfortable and add a zsh-like theme and feature follow me: - Run powershell as an `administrator` and execute following command to `disable the execution policy`, otherwise it wont let you follow next steps - `Set-ExecutionPolicy RemoteSigned` - `Register-PSRepository -Default` # this registers the default repository for PowerShell modules, so we can install packages thats are in next steps - `Install-Module posh-git -Scope CurrentUser` - `Install-Module oh-my-posh -Scope CurrentUser` - `Install-Module -Name PSReadLine -Scope CurrentUser -Force -SkipPublisherCheck` - Now you need to create a profile to set custom settings for powershell, run the following caommand: - `notepad $PROFILE` # this would create/edit file as: "C:\Users\<YOURUSERNAME>\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1" - Now copy the following code and past it in the notepad and save the file. - You may need to install a font that supports the emojis!, I suggest to use [Hack Nerd Font Mono](https://github.com/mh-firouzjaah/coding-fonts/raw/main/coding-fonts/Hack%20Regular%20Nerd%20Font%20Complete%20Mono.ttf) - after downloading the font and install it, right click on powershells top bar and go to properties, click on `Font` tab and select the font. ** if youre using `Windows Terminal`:** - open the app, hit `Ctrl` and `,` then click on gear button at down-left side, inside the open jason file search for `"profiles":`, now edit/add `"defaults": ` the `fontFace` so that finally sould looks: ```bash ... "profiles": { "defaults": { "fontFace": "Hack Nerd Font Mono", ... }, ... ... ``` ** Read more at: ** - <https://devblogs.microsoft.com/powershell/announcing-psreadline-2-1-with-predictive-intellisense/> -
mh-firouzjah created this gist
Jun 2, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,60 @@ # Better PowerShell on windows > Theme | History | KeyBinding in order to make windows powershell more comfortable and add a zsh-like theme and functionality follow me: - Run powershell as an `administrator` and execute following command to `disable the execution policy`, otherwise it wont let you follow next steps - `Set-ExecutionPolicy RemoteSigned` - `Register-PSRepository -Default` # this registers the default repository for PowerShell modules, so we can install packages thats are in next steps - `Install-Module posh-git -Scope CurrentUser` - `Install-Module oh-my-posh -Scope CurrentUser` - `Install-Module -Name PSReadLine -Scope CurrentUser -Force -SkipPublisherCheck` - Now you need to create a profile to set custom settings for powershell, run the following caommand: - `notepad $PROFILE` # this would create/edit file as: "C:\Users\<YOURUSERNAME>\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1" - Now copy the following code and past it in the notepad and save the file. ** Read more at: ** - <https://devblogs.microsoft.com/powershell/announcing-psreadline-2-1-with-predictive-intellisense/> - <https://docs.microsoft.com/en-us/windows/terminal/tutorials/powerline-setup> ## Profile Code: ```ps1 Import-Module posh-git Import-Module oh-my-posh Set-PoshPrompt -Theme Powerlevel10k_Classic Set-PSReadLineOption -PredictionSource History Set-PSReadlineKeyHandler -Key "Tab" -Function MenuComplete Set-PSReadlineKeyHandler -Key "UpArrow" -Function HistorySearchBackward Set-PSReadlineKeyHandler -Key "DownArrow" -Function HistorySearchForward Set-PSReadLineOption -Colors @{ InlinePrediction = '#898c5b'} Set-PSReadlineOption -HistorySearchCursorMovesToEnd Set-PSReadLineKeyHandler -Key "RightArrow" -ScriptBlock { param($key, $arg) $line = $null $cursor = $null [Microsoft.PowerShell.PSConsoleReadLine]::GetBufferState([ref]$line, [ref]$cursor) if ($cursor -lt $line.Length) { [Microsoft.PowerShell.PSConsoleReadLine]::ForwardChar($key, $arg) } else { [Microsoft.PowerShell.PSConsoleReadLine]::AcceptNextSuggestionWord($key, $arg) } } Set-PSReadLineKeyHandler -Key End -ScriptBlock { param($key, $arg) $line = $null $cursor = $null [Microsoft.PowerShell.PSConsoleReadLine]::GetBufferState([ref]$line, [ref]$cursor) if ($cursor -lt $line.Length) { [Microsoft.PowerShell.PSConsoleReadLine]::EndOfLine($key, $arg) } else { [Microsoft.PowerShell.PSConsoleReadLine]::AcceptSuggestion($key, $arg) } } ```