![]() Not colors over certain areas, but rather, the terminal colors themselves. Many modern terminal emulators support use of codes to set colors in the terminal. This is all fairly well documented, and if you didn't want to do it in a theme file, you can do it via Fish's web configuration interface. You can set these via variables, most prefixed fish_color. Fish supports expressing colors in hex, and, provided your terminal emulator supports it, will directly print components of its "ui" in the colors you specify. In my older version of the theme, I was using one of the base16-shell color scripts, but found they have a non-trivial runtime impact, and don't play nicely with older curses apps. Fish gives you a function to print rprompt, so I just overrode this function and made it print the date.įinally, I hard-coded some color support into the theme. The right hand side of the prompt is even more trivial. This is trivial enough to wrap in a small function, and so I did. The VCS prompt has the ability to show you the current branch, ref, or sha, but getting it to display both a ref and a sha is still impossible. Fish gives you a lot of useful little primitives for printing a prompt, such as a truncated pwd, utilities for displaying user and host name (I don't use either, I find them useless noise), and a very good VCS prompt. The rest of the prompt was pretty easy to make. Other sub-commands of the string command were used, and gave me a satisfactory output. Implementing the printing of these in a style that fit my theme was fairly easy. Pipestatus is similar to the plain ol' status variable, except it's a fish list (an array) of exit codes, one for each pipe. Fish also gained a new feature, called pipestatus. This command takes a string and number, and repeats the string the number of times. In the time since that theme was written and ported to fish, fish has gained the string repeat command. Later, I added a section, using box drawing characters, to display non-zero exit codes. I liked that a lot, and so for my theme (at the time, zsh based), I copied it. The first version of the separator didn't have a command status, and was a fixed color, but upon seeing a shell theme from a former coworker, he had short (5 hyphens) separators between commands, colored depending on the exit status of the previous command. The command separators were created using the unix jot command, with some math to calculate the width needed to print the separator. ![]() The old zsh theme is lost to time, but when I initially ported it to fish, certain features the current fish shell has did not exist. Years ago, when I wrote the first version of my theme, it was mostly a "port" of a theme I'd previously used on Zsh. There were also some things that just didn't ever work right, worked but weren't ever of any use, or just were irrelevant with the ongoing changes to fish: Ability to support variable color themes.A display of the current git hash in the prompt.Looking at my existing theme, there were some things I wanted to keep: I still wanted the theme to be roughly the same as before, but faster, leaner, and more predictably stable. This time, I had a few days off, so I decided that it was a good time to do some cleaning, removing old features, rewriting new ones to use fish builtins, and adding support to features that Fish has grown since the theme was first created. Historically, when a new version of the shell has been released, I've updated my prompt/theme to accommodate the new changes, but rarely made significant changes to how the underlying prompt was built. Around the new year, the Fish team released a new update, 3.6, that brought with it many new features, and some breaking changes.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |