diff --git a/README.md b/README.md index 1cdebc3..fa02a9e 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/extra/extra.go b/extra/extra.go index 3ef738f..264f4c3 100644 --- a/extra/extra.go +++ b/extra/extra.go @@ -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 { @@ -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 @@ -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 @@ -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 { diff --git a/extra/templates/bat_config b/extra/templates/bat_config new file mode 100644 index 0000000..50108ac --- /dev/null +++ b/extra/templates/bat_config @@ -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" diff --git a/zsh/templates/darwin/aliases.zsh b/zsh/templates/darwin/aliases.zsh index caef467..c093d4b 100644 --- a/zsh/templates/darwin/aliases.zsh +++ b/zsh/templates/darwin/aliases.zsh @@ -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' diff --git a/zsh/templates/darwin/zshrc_extra.zsh b/zsh/templates/darwin/zshrc_extra.zsh index 82bb251..92f5f48 100644 --- a/zsh/templates/darwin/zshrc_extra.zsh +++ b/zsh/templates/darwin/zshrc_extra.zsh @@ -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 diff --git a/zsh/templates/linux/aliases.zsh b/zsh/templates/linux/aliases.zsh index 474c189..18ca2d8 100644 --- a/zsh/templates/linux/aliases.zsh +++ b/zsh/templates/linux/aliases.zsh @@ -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' diff --git a/zsh/templates/linux/zshrc_extra.zsh b/zsh/templates/linux/zshrc_extra.zsh index e8bfafc..21fcc17 100644 --- a/zsh/templates/linux/zshrc_extra.zsh +++ b/zsh/templates/linux/zshrc_extra.zsh @@ -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"