GithubHelp home page GithubHelp logo

redsloop / snorin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lastcontinue/snorin

0.0 0.0 0.0 284 KB

"Opinionated" (lazy) port of the Oh-My-Zsh "Sorin" theme for the Fish Shell

License: MIT License

Shell 100.00%

snorin's Introduction

Snorin' ๐Ÿ’ค ๐ŸŸ

Oh-My-Zsh Sorin for Fish!

"Opinionated" (lazy) port of the Oh-My-Zsh "Sorin" theme for the Fish Shell.

default prompt

What? Why? Isn't there already a Sorin theme for Fish?

Yes, in fact, there are two just in the main Fish repo alone (and probably an untold amount in the wild!)

However, I found the one in fish_config to be lacking some features (Git), and the second one too complex to understand what was happending (especially when compairing the source for the oh-my-zsh original), so I started hacking.

Installation

Fisher

fisher add lastcontinue/snorin

Oh-my-fish

omf install https://github.com/lastcontinue/snorin

Features

Puts the Git repo info on the left, on the right it shows Git status git repo info more git repo info

  • new files โœญ
  • modified files โœน
  • removed files โœ–
  • staged files โœš
  • file renamed (might not show up until you stage) โžœ
  • unmerged (usually shows up during merge conflict) โ•
  • mystery condition (something happened1) โ—Š

Variable support

chevron example

snorin_chevrons

by default, this prompt will give you one green โฏ symbol (this is how the Oh-My-Zsh Sorin does it)
However, the "Sorin" themes for Fish usually have three: a red โฏ, a yellow โฏ, and a green โฏ (something like โฏโฏโฏ) .

I decided to let the user chose.
You can have as many โฏ 's as you want with this theme by setting

set snorin_chevrons color1 color2 color3 .. color n

For example, I like the red, yellow, green, so I have mine set as

set -U snorin_chevrons red yellow green

Random Fun

I thought it might be fun to have the ability to have random colors generated for your prompts, so I wrote a little function that uses either jot or shuf (make sure you have at least one of these installed2) to help make some random colors for your prompts. It works like this

snorin_random_chevrons N

(where N is the number of chevrons you want)

For Instance

If you want each new term session/tab to have a different prompt, then make sure that snorin_chevrons isn't set with the -U flag (easist way to do this is do set -e snorin_chevrons and that will unset it, and allow the random script to take over)

Then in your fish_config you can do something like

if type snorin_random_chevrons > /dev/null 2>&1
    snorin_random_chevrons 3 > /dev/null 2>&1
end

(type X will list the definition or location of a function/program if it exists. > /dev/null 2>&1 shoves the output to oblivion, but type will still return with a status that if can check against. This confused me the first few times I saw it.)

That should give each new session/tab a different set of colors (maybe. I only defined 10 colors so duplicates will happen)

This is just a "for instance". There's hundreds of triggering events you could use to have a prompt change colors or number of โฏ. Use your imagination!

sources:
https://github.com/robbyrussell/oh-my-zsh/blob/master/themes/sorin.zsh-theme
fish-shell/fish-shell#2243
(I believe this eventually morphed into this, however I found this shorter version better as inpiration)

Footnotes
1 Based on https://git-scm.com/docs/git-status there's are quite a few cases I didn't code for because I don't come across them very often. I figured โ—Š looked innocent enough. If you come across this a lot, please help me out and file an issue with details or make a PR yourself ๐Ÿ™‡โ€โ™‚๏ธ โ†ฉ

2 Interestingly enough, shuf doesn't do duplicates, whereas jot does. I don't consider this an issue, but this might drive some people crazy โ†ฉ

snorin's People

Contributors

lastcontinue avatar redsloop 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.