1
0
mirror of https://github.com/sameer1612/.dotfiles.git synced 2024-11-19 18:01:53 +02:00

removed opacity and moved back to gruvbox

This commit is contained in:
Sameer Kumar 2024-11-15 15:53:56 +05:30
parent 54648314cc
commit b563283489
5 changed files with 87 additions and 170 deletions

View File

@ -6,6 +6,7 @@ end
abbr -a -- gst "git status"
abbr -a -- gc "git branch | fzf --height=20% --reverse --info=inline | xargs git checkout"
abbr -a -- gpull "git pull"
abbr -a -- gco "git checkout"
abbr -a -- gpush "git push"
abbr -a -- rserver "rails s "
abbr -a -- rconsole "rails c "

View File

@ -1,14 +1,90 @@
function fish_prompt
if test -n "$SSH_TTY"
echo -n (set_color brred)"$USER"(set_color white)'@'(set_color yellow)(prompt_hostname)' '
set -l __last_command_exit_status $status
if not set -q -g __fish_arrow_functions_defined
set -g __fish_arrow_functions_defined
function _git_branch_name
set -l branch (git symbolic-ref --quiet HEAD 2>/dev/null)
if set -q branch[1]
echo (string replace -r '^refs/heads/' '' $branch)
else
echo (git rev-parse --short HEAD 2>/dev/null)
end
end
function _is_git_dirty
not command git diff-index --cached --quiet HEAD -- &>/dev/null
or not command git diff --no-ext-diff --quiet --exit-code &>/dev/null
end
function _is_git_repo
type -q git
or return 1
git rev-parse --git-dir >/dev/null 2>&1
end
function _hg_branch_name
echo (hg branch 2>/dev/null)
end
function _is_hg_dirty
set -l stat (hg status -mard 2>/dev/null)
test -n "$stat"
end
function _is_hg_repo
fish_print_hg_root >/dev/null
end
function _repo_branch_name
_$argv[1]_branch_name
end
function _is_repo_dirty
_is_$argv[1]_dirty
end
function _repo_type
if _is_hg_repo
echo hg
return 0
else if _is_git_repo
echo git
return 0
end
return 1
end
end
echo -n (set_color blue)(prompt_pwd)' '
set -l cyan (set_color -o cyan)
set -l yellow (set_color -o yellow)
set -l red (set_color -o red)
set -l green (set_color -o green)
set -l blue (set_color -o blue)
set -l normal (set_color normal)
set_color -o
set -l arrow_color "$green"
if test $__last_command_exit_status != 0
set arrow_color "$red"
end
set -l arrow "$arrow_color"
if fish_is_root_user
echo -n (set_color red)'# '
set arrow "$arrow_color# "
end
echo -n (set_color red)'❯'(set_color yellow)'❯'(set_color green)'❯ '
set_color normal
set -l cwd $cyan(basename (prompt_pwd))
set -l repo_info
if set -l repo_type (_repo_type)
set -l repo_branch $red(_repo_branch_name $repo_type)
set repo_info "$blue $repo_type:($repo_branch$blue)"
if _is_repo_dirty $repo_type
set -l dirty "$yellow"
set repo_info "$repo_info$dirty"
end
end
echo -n -s $arrow ' '$cwd $repo_info $normal ' '
end

View File

@ -1,161 +1,2 @@
function fish_right_prompt
set -l cmd_status $status
if test $cmd_status -ne 0
echo -n (set_color red)"$cmd_status"
end
if not command -sq git
set_color normal
return
end
# Get the git directory for later use.
# Return if not inside a Git repository work tree.
if not set -l git_dir (command git rev-parse --git-dir 2>/dev/null)
set_color normal
return
end
# Get the current action ("merge", "rebase", etc.)
# and if there's one get the current commit hash too.
set -l commit ''
if set -l action (fish_print_git_action "$git_dir")
set commit (command git rev-parse HEAD 2> /dev/null | string sub -l 7)
end
# Get either the branch name or a branch descriptor.
set -l branch_detached 0
if not set -l branch (command git symbolic-ref --short HEAD 2>/dev/null)
set branch_detached 1
set branch (command git describe --contains --all HEAD 2>/dev/null)
end
# Get the commit difference counts between local and remote.
command git rev-list --count --left-right 'HEAD...@{upstream}' 2>/dev/null \
| read -d \t -l status_ahead status_behind
if test $status -ne 0
set status_ahead 0
set status_behind 0
end
# Get the stash status.
# (git stash list) is very slow. => Avoid using it.
set -l status_stashed 0
if test -f "$git_dir/refs/stash"
set status_stashed 1
else if test -r "$git_dir/commondir"
read -l commondir <"$git_dir/commondir"
if test -f "$commondir/refs/stash"
set status_stashed 1
end
end
# git-status' porcelain v1 format starts with 2 letters on each line:
# The first letter (X) denotes the index state.
# The second letter (Y) denotes the working directory state.
#
# The following table presents the possible combinations:
# * The underscore character denotes whitespace.
# * The cell values stand for the following file states:
# a: added
# d: deleted
# m: modified
# r: renamed
# u: unmerged
# t: untracked
# * Cells with more than one letter signify that both states
# are simultaneously the case. This is possible since the git index
# and working directory operate independently of each other.
# * Cells which are empty are unhandled by this code.
# * T (= type change) is undocumented.
# See Git v1.7.8.2 release notes for more information.
#
# \ Y→
# X \
# ↓ | A | C | D | M | R | T | U | X | B | ? | _
# ----+----+----+----+----+----+----+----+----+----+----+----
# A | u | | ad | am | r | am | u | | | | a
# C | | | ad | am | r | am | u | | | | a
# D | | | u | am | r | am | u | | | | a
# M | | | ad | am | r | am | u | | | | a
# R | r | r | rd | rm | r | rm | ur | r | r | r | r
# T | | | ad | am | r | am | u | | | | a
# U | u | u | u | um | ur | um | u | u | u | u | u
# X | | | | m | r | m | u | | | |
# B | | | | m | r | m | u | | | |
# ? | | | | m | r | m | u | | | t |
# _ | | | d | m | r | m | u | | | |
set -l porcelain_status (command git status --porcelain 2>/dev/null | string sub -l2)
set -l status_added 0
if string match -qr '[ACDMT][ MT]|[ACMT]D' $porcelain_status
set status_added 1
end
set -l status_deleted 0
if string match -qr '[ ACMRT]D' $porcelain_status
set status_deleted 1
end
set -l status_modified 0
if string match -qr '[MT]$' $porcelain_status
set status_modified 1
end
set -l status_renamed 0
if string match -qe R $porcelain_status
set status_renamed 1
end
set -l status_unmerged 0
if string match -qr 'AA|DD|U' $porcelain_status
set status_unmerged 1
end
set -l status_untracked 0
if string match -qe '\?\?' $porcelain_status
set status_untracked 1
end
set_color -o
if test -n "$branch"
if test $branch_detached -ne 0
set_color brmagenta
else
set_color green
end
echo -n " $branch"
end
if test -n "$commit"
echo -n ' '(set_color yellow)"$commit"
end
if test -n "$action"
set_color normal
echo -n (set_color white)':'(set_color -o brred)"$action"
end
if test $status_ahead -ne 0
echo -n ' '(set_color brmagenta)'⬆'
end
if test $status_behind -ne 0
echo -n ' '(set_color brmagenta)'⬇'
end
if test $status_stashed -ne 0
echo -n ' '(set_color cyan)'✭'
end
if test $status_added -ne 0
echo -n ' '(set_color green)'✚'
end
if test $status_deleted -ne 0
echo -n ' '(set_color red)'✖'
end
if test $status_modified -ne 0
echo -n ' '(set_color blue)'✱'
end
if test $status_renamed -ne 0
echo -n ' '(set_color magenta)'➜'
end
if test $status_unmerged -ne 0
echo -n ' '(set_color yellow)'═'
end
if test $status_untracked -ne 0
echo -n ' '(set_color white)'◼'
end
set_color normal
end
function fish_right_prompt
end

View File

@ -6,7 +6,7 @@
local M = {}
M.base46 = {
theme = "everforest",
theme = "gruvchad",
transparency = true,
}

View File

@ -5,7 +5,6 @@ local action = wezterm.action
config = {
window_decorations = "RESIZE",
window_padding = { bottom = 0, right = 0 },
window_background_opacity = 0.95,
color_scheme = "Gruvbox dark, medium (base16)",
font = wezterm.font("VictorMono Nerd Font", { weight = "Regular" }),