GithubHelp home page GithubHelp logo

my-oh-my-posh-config's Introduction

My oh-my-posh setup

Step 1 - Install Oh-My-Posh

Official instructions said to use

curl -s https://ohmyposh.dev/install.sh | bash -s

However that didn't work. So used the next suggested command:

curl -s https://ohmyposh.dev/install.sh | bash -s -- -d ~/bin

Also didn't work. Had to specify own directory as such:

curl -s https://ohmyposh.dev/install.sh | bash -s -- -d ~/.local/bin

Step 2 - Install nerdfont

oh-my-posh font install

Picked 'DroidSansM Nerd Font'

Step 3 - Added line to .bashrc

Added the following line

eval "$(oh-my-posh init bash)"

Step 4 - Changed theme

Modified Step 3 to be as follows:

eval "$(oh-my-posh init bash --config ~/.cache/oh-my-posh/themes/powerlevel10k_modern.omp.json)"

Step 5 - Fix VS Code

Fonts not showing up correctly in VS Code. Need to change font to one of the NerdFonts for symbols to show up.

Alt text

Did not work for me. So had to add extra line in settings.json:

"terminal.integrated.gpuAcceleration": "canvas"

More info: ryanoasis/nerd-fonts#831

Step 6 - Modify config file to add code execution time

Make copy of desired base theme config to local folder with appropriate name

~/.config/oh-my-posh/themes/your-theme-config.json

Point oh-my-posh init in .bashrc to configure using own theme

eval "$(oh-my-posh init bash --config ~/.cache/oh-my-posh/themes/your-theme-config.json)"

Add following to right segment of config:

{
 "type": "executiontime",
 "style": "powerline",
 "powerline_symbol": "",
 "foreground": "#ffffff",
 "background": "#8800dd",
 "template": " <#fefefe></> {{ .FormattedMs }} ",
 "properties": {
  "threshold": 500,
  "style": "austin",
  "always_enabled": true
 }
},

Step 7 - Added git segment

Built-in git segment does not have git status.

Add the following:

{
 "type": "git",
 "style": "powerline",
 "powerline_symbol": "",
 "foreground": "#193549",
 "background": "#ffeb3b",
 "background_templates": [
  "{{ if or (.Working.Changed) (.Staging.Changed) }}#FFEB3B{{ end }}",
  "{{ if and (gt .Ahead 0) (gt .Behind 0) }}#FFCC80{{ end }}",
  "{{ if gt .Ahead 0 }}#B388FF{{ end }}",
  "{{ if gt .Behind 0 }}#B388FB{{ end }}"
 ],
 "template": "{{ .UpstreamIcon }}{{ .HEAD }}{{if .BranchStatus }} {{ .BranchStatus }}{{ end }}{{ if .Working.Changed }}  {{ .Working.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Staging.Changed }}  {{ .Staging.String }}{{ end }}{{ if gt .StashCount 0 }}  {{ .StashCount }}{{ end }}",
 "properties": {
  "fetch_status": true,
  "fetch_stash_count": true,
  "fetch_upstream_icon": true,
  "untracked_modes": {
   "/Users/user/Projects/oh-my-posh/": "no"
  }
 }
}

Remove the existing git segment.

Step 8 - Add status

{
"background": "#03DED3",
"background_templates": [
 "{{ if gt .Code 0 }}#E44141{{ end }}"
],
"foreground": "#414141",
"foreground_templates": [
 "{{ if gt .Code 0 }}#D6DEEB{{ end }}"
],
"template": " {{ if gt .Code 0 }}\uf00d{{ else }}\uf00c{{ end }} ",
"type": "status",
"powerline_symbol": "",
"properties": {
 "always_enabled": true
},
"style": "powerline"
}

or (with error reason)

{
 "background": "#03DED3",
 "background_templates": [
  "{{ if gt .Code 0 }}#E44141{{ end }}"
 ],
 "foreground": "#414141",
 "foreground_templates": [
  "{{ if gt .Code 0 }}#D6DEEB{{ end }}"
 ],
 "template": " {{ if eq .Code 0 }}\uf00c{{ else }}\uf071 {{ reason .Code }}{{ end }} ",
 "type": "status",
 "powerline_symbol": "",
 "properties": {
  "always_enabled": true
 },
 "style": "powerline"
}

Final result

Alt text

my-oh-my-posh-config's People

Contributors

joonsunn avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.