Skip to content

Commit

Permalink
better ohmyzsh colors, added bat config, colorized ip cmd alias
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-pmillz committed Feb 19, 2023
1 parent a9b5003 commit a383091
Show file tree
Hide file tree
Showing 7 changed files with 150 additions and 11 deletions.
10 changes: 1 addition & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,11 @@ Table of Contents

## Install

If you have a version of golang >= 16.X you can install with

```shell
go install github.com/mr-pmillz/pimp-my-shell/v2@latest
```

If using an older version of golang

```shell
go get github.com/mr-pmillz/pimp-my-shell/v2@latest
```

### Manual installation
### Manual installation

Download the latest release for your system from [Releases](https://github.com/mr-pmillz/pimp-my-shell/releases)
- or clone the repo and run `go build` to build the binary.
Expand Down
32 changes: 32 additions & 0 deletions extra/extra.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func InstallExtraPackages(osType string, dirs *localio.Directories, packages *lo
if err = localio.EmbedFileCopy("~/.config/lsd/themes/default.yaml", lsdDarkTheme); err != nil {
return err
}
defer lsdDarkTheme.Close()

lsdLightTheme, err := extraConfigs.Open("templates/lsd_light_theme.yaml")
if err != nil {
Expand All @@ -56,6 +57,7 @@ func InstallExtraPackages(osType string, dirs *localio.Directories, packages *lo
if err = localio.EmbedFileCopy("~/.config/lsd/themes/light.yaml", lsdLightTheme); err != nil {
return err
}
defer lsdLightTheme.Close()
// install cowsay
if err := localio.BrewInstallProgram("cowsay", "cowsay", packages); err != nil {
return err
Expand All @@ -76,6 +78,21 @@ func InstallExtraPackages(osType string, dirs *localio.Directories, packages *lo
if err := localio.BrewInstallProgram("bat", "bat", packages); err != nil {
return err
}
// setup bat config
if err := os.MkdirAll(fmt.Sprintf("%s/.config/bat", dirs.HomeDir), 0750); err != nil {
return err
}
batConfig, err := extraConfigs.Open("templates/bat_config")
if err != nil {
return err
}
exists, err := localio.Exists("~/.config/bat/config")
if err == nil && !exists {
if err = localio.EmbedFileCopy("~/.config/bat/config", batConfig); err != nil {
return err
}
}
defer batConfig.Close()
// install fd
if err := localio.BrewInstallProgram("fd", "fd", packages); err != nil {
return err
Expand Down Expand Up @@ -169,6 +186,21 @@ func InstallExtraPackages(osType string, dirs *localio.Directories, packages *lo
if err := localio.AptInstall(packages, "cowsay", "bat", "fd-find"); err != nil {
return err
}
// setup bat config
if err := os.MkdirAll(fmt.Sprintf("%s/.config/bat", dirs.HomeDir), 0750); err != nil {
return err
}
batConfig, err := extraConfigs.Open("templates/bat_config")
if err != nil {
return err
}
exists, err := localio.Exists("~/.config/bat/config")
if err == nil && !exists {
if err = localio.EmbedFileCopy("~/.config/bat/config", batConfig); err != nil {
return err
}
}
defer batConfig.Close()

// add batcat to path as bat
if err := os.MkdirAll(fmt.Sprintf("%s/.local/bin", dirs.HomeDir), 0750); err != nil {
Expand Down
26 changes: 26 additions & 0 deletions extra/templates/bat_config
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# This is `bat`s configuration file. Each line either contains a comment or
# a command-line option that you want to pass to `bat` by default. You can
# run `bat --help` to get a list of all possible configuration options.

# Specify desired highlighting theme (e.g. "TwoDark"). Run `bat --list-themes`
# for a list of all available themes
--theme="Monokai Extended"
#--theme="Monokai Extended Light"

# Enable this to use italic text on the terminal. This is not supported on all
# terminal emulators (like tmux, by default):
#--italic-text=always

# Uncomment the following line to disable automatic paging:
#--paging=never

# Uncomment the following line if you are using less version >= 551 and want to
# enable mouse scrolling support in `bat` when running inside tmux. This might
# disable text selection, unless you press shift.
#--pager="less --RAW-CONTROL-CHARS --quit-if-one-screen --mouse"

# Syntax mappings: map a certain filename pattern to a language.
# Example 1: use the C++ syntax for Arduino .ino files
# Example 2: Use ".gitignore"-style highlighting for ".ignore" files
#--map-syntax "*.ino:C++"
#--map-syntax ".ignore:Git Ignore"
1 change: 1 addition & 0 deletions zsh/templates/darwin/aliases.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ alias gll="git log --all --stat --pretty=tformat:'%Cred%h%Creset -%C(yellow)%d%C
alias gln="git --no-pager log --all --stat --pretty=tformat:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative -n 10"
alias clp="pbcopy < $1"
alias fzfbat="fzf --preview 'bat --style numbers,changes --color=always {}' | head -500"
alias ip='ip --color=auto'
48 changes: 48 additions & 0 deletions zsh/templates/darwin/zshrc_extra.zsh
Original file line number Diff line number Diff line change
@@ -1,3 +1,51 @@
# zsh-syntax-highlighting colors
ZSH_HIGHLIGHT_HIGHLIGHTERS=(
main
brackets
)
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern)
ZSH_HIGHLIGHT_STYLES[default]=none
ZSH_HIGHLIGHT_STYLES[unknown-token]=fg=white,underline
ZSH_HIGHLIGHT_STYLES[reserved-word]=fg=cyan,bold
ZSH_HIGHLIGHT_STYLES[suffix-alias]=fg=green,underline
ZSH_HIGHLIGHT_STYLES[global-alias]=fg=green,bold
ZSH_HIGHLIGHT_STYLES[precommand]=fg=green,underline
ZSH_HIGHLIGHT_STYLES[commandseparator]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[autodirectory]=fg=green,underline
ZSH_HIGHLIGHT_STYLES[path]=bold
ZSH_HIGHLIGHT_STYLES[path_pathseparator]=
ZSH_HIGHLIGHT_STYLES[path_prefix_pathseparator]=
ZSH_HIGHLIGHT_STYLES[globbing]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[history-expansion]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[command-substitution]=none
ZSH_HIGHLIGHT_STYLES[command-substitution-delimiter]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[process-substitution]=none
ZSH_HIGHLIGHT_STYLES[process-substitution-delimiter]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[single-hyphen-option]=fg=magenta
ZSH_HIGHLIGHT_STYLES[double-hyphen-option]=fg=magenta
ZSH_HIGHLIGHT_STYLES[back-quoted-argument]=none
ZSH_HIGHLIGHT_STYLES[back-quoted-argument-delimiter]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[single-quoted-argument]=fg=yellow
ZSH_HIGHLIGHT_STYLES[double-quoted-argument]=fg=yellow
ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]=fg=yellow
ZSH_HIGHLIGHT_STYLES[rc-quote]=fg=magenta
ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[assign]=none
ZSH_HIGHLIGHT_STYLES[redirection]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[comment]=fg=black,bold
ZSH_HIGHLIGHT_STYLES[named-fd]=none
ZSH_HIGHLIGHT_STYLES[numeric-fd]=none
ZSH_HIGHLIGHT_STYLES[arg0]=fg=green
ZSH_HIGHLIGHT_STYLES[bracket-error]=fg=red,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-1]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-2]=fg=green,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-3]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-4]=fg=yellow,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-5]=fg=cyan,bold
ZSH_HIGHLIGHT_STYLES[cursor-matchingbracket]=standout

# Add ~/go/bin to path
[[ ":$PATH:" != *":${HOME}/go/bin:"* ]] && export PATH="${PATH}:$HOME/go/bin"
# Add gsed to path
Expand Down
3 changes: 2 additions & 1 deletion zsh/templates/linux/aliases.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ alias gl="git log --all --graph --pretty=tformat:'%Cred%h%Creset -%C(yellow)%d%C
alias gll="git log --all --stat --pretty=tformat:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"
alias gln="git --no-pager log --all --stat --pretty=tformat:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative -n 10"
alias clp="xclip -selection c -r"
alias fzfbat="fzf --preview 'batcat --style numbers,changes --color=always {}' | head -500"
alias fzfbat="fzf --preview 'bat --style numbers,changes --color=always {}' | head -500"
alias ip='ip --color=auto'
41 changes: 40 additions & 1 deletion zsh/templates/linux/zshrc_extra.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,48 @@ ZSH_HIGHLIGHT_HIGHLIGHTERS=(
main
brackets
)
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern)
ZSH_HIGHLIGHT_STYLES[default]=none
ZSH_HIGHLIGHT_STYLES[unknown-token]=fg=white,underline
ZSH_HIGHLIGHT_STYLES[reserved-word]=fg=cyan,bold
ZSH_HIGHLIGHT_STYLES[suffix-alias]=fg=green,underline
ZSH_HIGHLIGHT_STYLES[global-alias]=fg=green,bold
ZSH_HIGHLIGHT_STYLES[precommand]=fg=green,underline
ZSH_HIGHLIGHT_STYLES[commandseparator]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[autodirectory]=fg=green,underline
ZSH_HIGHLIGHT_STYLES[path]=bold
ZSH_HIGHLIGHT_STYLES[path_pathseparator]=
ZSH_HIGHLIGHT_STYLES[path_prefix_pathseparator]=
ZSH_HIGHLIGHT_STYLES[globbing]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[history-expansion]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[command-substitution]=none
ZSH_HIGHLIGHT_STYLES[command-substitution-delimiter]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[process-substitution]=none
ZSH_HIGHLIGHT_STYLES[process-substitution-delimiter]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[single-hyphen-option]=fg=magenta
ZSH_HIGHLIGHT_STYLES[double-hyphen-option]=fg=magenta

ZSH_HIGHLIGHT_STYLES[back-quoted-argument]=none
ZSH_HIGHLIGHT_STYLES[back-quoted-argument-delimiter]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[single-quoted-argument]=fg=yellow
ZSH_HIGHLIGHT_STYLES[double-quoted-argument]=fg=yellow
ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]=fg=yellow
ZSH_HIGHLIGHT_STYLES[rc-quote]=fg=magenta
ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[assign]=none
ZSH_HIGHLIGHT_STYLES[redirection]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[comment]=fg=black,bold
ZSH_HIGHLIGHT_STYLES[named-fd]=none
ZSH_HIGHLIGHT_STYLES[numeric-fd]=none
ZSH_HIGHLIGHT_STYLES[arg0]=fg=green
ZSH_HIGHLIGHT_STYLES[bracket-error]=fg=red,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-1]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-2]=fg=green,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-3]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-4]=fg=yellow,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-5]=fg=cyan,bold
ZSH_HIGHLIGHT_STYLES[cursor-matchingbracket]=standout
# For linux add ~/.local/bin to path
[[ ":$PATH:" != *":${HOME}/.locaal/bin:"* ]] && export PATH="${PATH}:${HOME}/.local/bin"

Expand Down

0 comments on commit a383091

Please sign in to comment.