switch to rose pine to cover both light and dark themes
This commit is contained in:
@@ -18,4 +18,4 @@ family = "jetbrainsmono nerd font"
|
|||||||
style = "Regular"
|
style = "Regular"
|
||||||
|
|
||||||
[general]
|
[general]
|
||||||
import = ["~/.config/alacritty/dracula.toml"]
|
import = ["~/.config/alacritty/colors/rose-pine.toml"]
|
||||||
|
|||||||
75
alacritty/.config/alacritty/colors/rose-pine-dawn.toml
Normal file
75
alacritty/.config/alacritty/colors/rose-pine-dawn.toml
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
# Colors section of "Alacritty - TOML configuration file format"
|
||||||
|
# https://github.com/alacritty/alacritty/blob/master/extra/man/alacritty.5.scd#colors
|
||||||
|
|
||||||
|
[colors.primary]
|
||||||
|
foreground = "#575279"
|
||||||
|
background = "#faf4ed"
|
||||||
|
dim_foreground = "#797593"
|
||||||
|
bright_foreground = "#575279"
|
||||||
|
|
||||||
|
[colors.cursor]
|
||||||
|
text = "#575279"
|
||||||
|
cursor = "#cecacd"
|
||||||
|
|
||||||
|
[colors.vi_mode_cursor]
|
||||||
|
text = "#575279"
|
||||||
|
cursor = "#cecacd"
|
||||||
|
|
||||||
|
[colors.search.matches]
|
||||||
|
foreground = "#797593"
|
||||||
|
background = "#f2e9e1"
|
||||||
|
|
||||||
|
[colors.search.focused_match]
|
||||||
|
foreground = "#faf4ed"
|
||||||
|
background = "#d7827e"
|
||||||
|
|
||||||
|
[colors.hints.start]
|
||||||
|
foreground = "#797593"
|
||||||
|
background = "#fffaf3"
|
||||||
|
|
||||||
|
[colors.hints.end]
|
||||||
|
foreground = "#9893a5"
|
||||||
|
background = "#fffaf3"
|
||||||
|
|
||||||
|
[colors.line_indicator]
|
||||||
|
foreground = "None"
|
||||||
|
background = "None"
|
||||||
|
|
||||||
|
[colors.footer_bar]
|
||||||
|
foreground = "#575279"
|
||||||
|
background = "#fffaf3"
|
||||||
|
|
||||||
|
[colors.selection]
|
||||||
|
text = "#575279"
|
||||||
|
background = "#dfdad9"
|
||||||
|
|
||||||
|
[colors.normal]
|
||||||
|
black = "#f2e9e1"
|
||||||
|
red = "#b4637a"
|
||||||
|
green = "#286983"
|
||||||
|
yellow = "#ea9d34"
|
||||||
|
blue = "#56949f"
|
||||||
|
magenta = "#907aa9"
|
||||||
|
cyan = "#d7827e"
|
||||||
|
white = "#575279"
|
||||||
|
|
||||||
|
[colors.bright]
|
||||||
|
black = "#9893a5"
|
||||||
|
red = "#b4637a"
|
||||||
|
green = "#286983"
|
||||||
|
yellow = "#ea9d34"
|
||||||
|
blue = "#56949f"
|
||||||
|
magenta = "#907aa9"
|
||||||
|
cyan = "#d7827e"
|
||||||
|
white = "#575279"
|
||||||
|
|
||||||
|
[colors.dim]
|
||||||
|
black = "#9893a5"
|
||||||
|
red = "#b4637a"
|
||||||
|
green = "#286983"
|
||||||
|
yellow = "#ea9d34"
|
||||||
|
blue = "#56949f"
|
||||||
|
magenta = "#907aa9"
|
||||||
|
cyan = "#d7827e"
|
||||||
|
white = "#575279"
|
||||||
|
|
||||||
75
alacritty/.config/alacritty/colors/rose-pine.toml
Normal file
75
alacritty/.config/alacritty/colors/rose-pine.toml
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
# Colors section of "Alacritty - TOML configuration file format"
|
||||||
|
# https://github.com/alacritty/alacritty/blob/master/extra/man/alacritty.5.scd#colors
|
||||||
|
|
||||||
|
[colors.primary]
|
||||||
|
foreground = "#e0def4"
|
||||||
|
background = "#191724"
|
||||||
|
dim_foreground = "#908caa"
|
||||||
|
bright_foreground = "#e0def4"
|
||||||
|
|
||||||
|
[colors.cursor]
|
||||||
|
text = "#e0def4"
|
||||||
|
cursor = "#524f67"
|
||||||
|
|
||||||
|
[colors.vi_mode_cursor]
|
||||||
|
text = "#e0def4"
|
||||||
|
cursor = "#524f67"
|
||||||
|
|
||||||
|
[colors.search.matches]
|
||||||
|
foreground = "#908caa"
|
||||||
|
background = "#26233a"
|
||||||
|
|
||||||
|
[colors.search.focused_match]
|
||||||
|
foreground = "#191724"
|
||||||
|
background = "#ebbcba"
|
||||||
|
|
||||||
|
[colors.hints.start]
|
||||||
|
foreground = "#908caa"
|
||||||
|
background = "#1f1d2e"
|
||||||
|
|
||||||
|
[colors.hints.end]
|
||||||
|
foreground = "#6e6a86"
|
||||||
|
background = "#1f1d2e"
|
||||||
|
|
||||||
|
[colors.line_indicator]
|
||||||
|
foreground = "None"
|
||||||
|
background = "None"
|
||||||
|
|
||||||
|
[colors.footer_bar]
|
||||||
|
foreground = "#e0def4"
|
||||||
|
background = "#1f1d2e"
|
||||||
|
|
||||||
|
[colors.selection]
|
||||||
|
text = "#e0def4"
|
||||||
|
background = "#403d52"
|
||||||
|
|
||||||
|
[colors.normal]
|
||||||
|
black = "#26233a"
|
||||||
|
red = "#eb6f92"
|
||||||
|
green = "#31748f"
|
||||||
|
yellow = "#f6c177"
|
||||||
|
blue = "#9ccfd8"
|
||||||
|
magenta = "#c4a7e7"
|
||||||
|
cyan = "#ebbcba"
|
||||||
|
white = "#e0def4"
|
||||||
|
|
||||||
|
[colors.bright]
|
||||||
|
black = "#6e6a86"
|
||||||
|
red = "#eb6f92"
|
||||||
|
green = "#31748f"
|
||||||
|
yellow = "#f6c177"
|
||||||
|
blue = "#9ccfd8"
|
||||||
|
magenta = "#c4a7e7"
|
||||||
|
cyan = "#ebbcba"
|
||||||
|
white = "#e0def4"
|
||||||
|
|
||||||
|
[colors.dim]
|
||||||
|
black = "#6e6a86"
|
||||||
|
red = "#eb6f92"
|
||||||
|
green = "#31748f"
|
||||||
|
yellow = "#f6c177"
|
||||||
|
blue = "#9ccfd8"
|
||||||
|
magenta = "#c4a7e7"
|
||||||
|
cyan = "#ebbcba"
|
||||||
|
white = "#e0def4"
|
||||||
|
|
||||||
@@ -1,17 +1,17 @@
|
|||||||
-- Bootstrap lazy.nvim
|
-- Bootstrap lazy.nvim
|
||||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||||
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||||
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||||
if vim.v.shell_error ~= 0 then
|
if vim.v.shell_error ~= 0 then
|
||||||
vim.api.nvim_echo({
|
vim.api.nvim_echo({
|
||||||
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||||
{ out, "WarningMsg" },
|
{ out, "WarningMsg" },
|
||||||
{ "\nPress any key to exit..." },
|
{ "\nPress any key to exit..." },
|
||||||
}, true, {})
|
}, true, {})
|
||||||
vim.fn.getchar()
|
vim.fn.getchar()
|
||||||
os.exit(1)
|
os.exit(1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
vim.opt.rtp:prepend(lazypath)
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
@@ -23,19 +23,19 @@ vim.g.maplocalleader = "\\"
|
|||||||
|
|
||||||
-- Setup lazy.nvim
|
-- Setup lazy.nvim
|
||||||
require("lazy").setup({
|
require("lazy").setup({
|
||||||
spec = {
|
spec = {
|
||||||
-- import your plugins
|
-- import your plugins
|
||||||
{ import = "plugins" },
|
{ import = "plugins" },
|
||||||
},
|
},
|
||||||
-- Configure any other settings here. See the documentation for more details.
|
-- Configure any other settings here. See the documentation for more details.
|
||||||
-- colorscheme that will be used when installing plugins.
|
-- colorscheme that will be used when installing plugins.
|
||||||
install = { colorscheme = { "dracula" } },
|
install = { colorscheme = { "rose-pine" } },
|
||||||
-- automatically check for plugin updates
|
-- automatically check for plugin updates
|
||||||
checker = {
|
checker = {
|
||||||
enabled = false,
|
enabled = false,
|
||||||
concurrency = nil,
|
concurrency = nil,
|
||||||
notify = false,
|
notify = false,
|
||||||
frequency = 3600,
|
frequency = 3600,
|
||||||
check_pinned = false,
|
check_pinned = false,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,30 +1,29 @@
|
|||||||
return {
|
return {
|
||||||
{ -- colorscheme
|
{
|
||||||
"Mofiqul/dracula.nvim",
|
"zaldih/themery.nvim",
|
||||||
lazy = false,
|
lazy = false,
|
||||||
name = "dracula",
|
|
||||||
priority = 1000,
|
|
||||||
config = function()
|
config = function()
|
||||||
local dracula = require("dracula")
|
require("themery").setup({
|
||||||
dracula.setup({
|
-- add the config here
|
||||||
colors = {
|
themes = { "rose-pine-dawn", "rose-pine-main" }, -- Your list of installed colorschemes.
|
||||||
visual = "#5a5e77",
|
livePreview = true, -- Apply theme while picking. Default to true.
|
||||||
},
|
|
||||||
-- show the '~' characters after the end of buffers
|
|
||||||
show_end_of_buffer = true, -- default false
|
|
||||||
-- use transparent background
|
|
||||||
transparent_bg = false, -- default false
|
|
||||||
-- set custom lualine background color
|
|
||||||
lualine_bg_color = "#44475a", -- default nil
|
|
||||||
-- set italic comment
|
|
||||||
italic_comment = true, -- default false
|
|
||||||
-- overrides the default highlights with table see `:h synIDattr`
|
|
||||||
overrides = {
|
|
||||||
CursorLine = { bg = "#3e4153" },
|
|
||||||
CursorLineNr = { fg = "DarkOrange", bold = true },
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
vim.cmd([[colorscheme dracula-soft]])
|
vim.keymap.set("n", "<leader>tt", function()
|
||||||
|
local themery = require("themery")
|
||||||
|
local currentTheme = themery.getCurrentTheme()
|
||||||
|
if currentTheme and currentTheme.name == "rose-pine-dawn" then
|
||||||
|
themery.setThemeByName("rose-pine-main", true)
|
||||||
|
else
|
||||||
|
themery.setThemeByName("rose-pine-dawn", true)
|
||||||
|
end
|
||||||
|
end, { noremap = true, desc = "Alternate between light and dark mode" })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rose-pine/neovim",
|
||||||
|
name = "rose-pine",
|
||||||
|
config = function()
|
||||||
|
-- vim.cmd("colorscheme rose-pine")
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
-- highlight color hex codes
|
-- highlight color hex codes
|
||||||
@@ -44,7 +43,7 @@ return {
|
|||||||
options = {
|
options = {
|
||||||
section_separators = "",
|
section_separators = "",
|
||||||
component_separators = "",
|
component_separators = "",
|
||||||
theme = "dracula-nvim",
|
theme = "rose-pine",
|
||||||
},
|
},
|
||||||
-- extensions = { "neo-tree", "lazy", "fzf" },
|
-- extensions = { "neo-tree", "lazy", "fzf" },
|
||||||
extensions = { "fugitive", "lazy" },
|
extensions = { "fugitive", "lazy" },
|
||||||
|
|||||||
61
scripts/hcf/rose_pine_switch
Executable file
61
scripts/hcf/rose_pine_switch
Executable file
@@ -0,0 +1,61 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Script to switch the alacritty theme between rose-pine and rose-pine-dawn
|
||||||
|
#
|
||||||
|
# ./rose_pine_switch
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
case "$(uname -s)" in
|
||||||
|
Linux*)
|
||||||
|
sed_command="sed -i"
|
||||||
|
;;
|
||||||
|
Darwin*)
|
||||||
|
sed_command="sed -i ''"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unknown platform"
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
|
||||||
|
esac
|
||||||
|
|
||||||
|
function switch_alacritty_colors() {
|
||||||
|
local config_file
|
||||||
|
config_file="$DOTFILES/alacritty/.config/alacritty/alacritty.toml"
|
||||||
|
if ! grep -q 'colors' "$config_file"; then
|
||||||
|
echo "Error, could not find import from colors directory"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
if grep -q 'dawn' "$config_file"; then
|
||||||
|
$sed_command 's/rose-pine-dawn\.toml/rose-pine.toml/g' "$config_file"
|
||||||
|
else
|
||||||
|
$sed_command 's/rose-pine\.toml/rose-pine-dawn.toml/g' "$config_file"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function switch_tmux_colors() {
|
||||||
|
local config_file
|
||||||
|
config_file="$DOTFILES/tmux/.tmux.conf"
|
||||||
|
if ! grep -q 'rose_pine_variant' "$config_file"; then
|
||||||
|
echo "Error, could not find rose pine settings in config file"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
if grep -q '@rose_pine_variant '\''dawn'\''' "$config_file"; then
|
||||||
|
$sed_command 's/rose_pine_variant '\''dawn'\''/rose_pine_variant '\''main'\''/g' "$config_file"
|
||||||
|
tmux source-file ~/.tmux.conf
|
||||||
|
else
|
||||||
|
$sed_command 's/rose_pine_variant '\''main'\''/rose_pine_variant '\''dawn'\''/g' "$config_file"
|
||||||
|
tmux source-file ~/.tmux.conf
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function switch_colors() {
|
||||||
|
# Only work if the DOTFILES variable is set
|
||||||
|
if [ -n "$DOTFILES" ]; then
|
||||||
|
switch_alacritty_colors
|
||||||
|
switch_tmux_colors
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
switch_colors
|
||||||
@@ -41,7 +41,7 @@ set -g history-limit 50000
|
|||||||
set -ga terminal-overrides ',*:smcup@:rmcup@'
|
set -ga terminal-overrides ',*:smcup@:rmcup@'
|
||||||
|
|
||||||
set-option -g default-shell $SHELL
|
set-option -g default-shell $SHELL
|
||||||
set -g default-command "$SHELL -i"
|
set-option -g allow-rename off
|
||||||
|
|
||||||
set-option -sa terminal-features ',alacritty:RGB'
|
set-option -sa terminal-features ',alacritty:RGB'
|
||||||
set-option -ga terminal-features ",alacritty:usstyle"
|
set-option -ga terminal-features ",alacritty:usstyle"
|
||||||
@@ -54,15 +54,16 @@ set -g default-terminal "alacritty"
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
set -g @plugin 'dracula/tmux'
|
set -g @plugin 'rose-pine/tmux'
|
||||||
|
set -g @rose_pine_variant 'main' # Options are 'main', 'moon' or 'dawn'
|
||||||
|
|
||||||
set -g @dracula-plugins "git weather time continuum battery"
|
set -g @rose_pine_date_time '%Y-%m-%d %H:%M '
|
||||||
set -g @dracula-show-fahrenheit false
|
set -g @rose_pine_directory 'on'
|
||||||
set -g @dracula-fixed-location "Madrid"
|
set -g @rose_pine_disable_active_window_menu 'on'
|
||||||
set -g @dracula-show-powerline false
|
set -g @rose_pine_status_left_prepend_section '#{tmux_mode_indicator}'
|
||||||
set -g @dracula-transparent-powerline-bg true
|
|
||||||
set -g @dracula-military-time true
|
# bind F5 to theme switch
|
||||||
set -g @dracula-day-month true
|
bind-key . run-shell "$DOTFILES/scripts/hcf/rose_pine_switch"
|
||||||
|
|
||||||
set -g @plugin 'ofirgall/tmux-window-name'
|
set -g @plugin 'ofirgall/tmux-window-name'
|
||||||
|
|
||||||
@@ -89,7 +90,6 @@ set -g @resurrect-dir '~/.tmux/resurrect/'
|
|||||||
set -g @continuum-save-interval '15'
|
set -g @continuum-save-interval '15'
|
||||||
set -g @continuum-restore 'on'
|
set -g @continuum-restore 'on'
|
||||||
set -g @continuum-boot 'on'
|
set -g @continuum-boot 'on'
|
||||||
set -g @dracula-continuum-mode countdown
|
|
||||||
|
|
||||||
### tmux-resurrect
|
### tmux-resurrect
|
||||||
set -g @resurrect-save 'S' # prefix + Shift-s - save
|
set -g @resurrect-save 'S' # prefix + Shift-s - save
|
||||||
|
|||||||
@@ -11,7 +11,10 @@ alias fgrep='fgrep --color=auto'
|
|||||||
alias egrep='egrep --color=auto'
|
alias egrep='egrep --color=auto'
|
||||||
|
|
||||||
alias d='dirs -v'
|
alias d='dirs -v'
|
||||||
|
# shfmt needs to ignore this because it is a zsh specific syntax
|
||||||
|
# shfmt:ignore:start
|
||||||
for index ({1..9}) alias "c$index"="cd +${index}"; unset index
|
for index ({1..9}) alias "c$index"="cd +${index}"; unset index
|
||||||
|
# shfmt:ignore:end
|
||||||
|
|
||||||
_get_aws_config_path() {
|
_get_aws_config_path() {
|
||||||
local config_path="${AWS_CONFIG_FILE:-$HOME/.aws/config}"
|
local config_path="${AWS_CONFIG_FILE:-$HOME/.aws/config}"
|
||||||
@@ -102,11 +105,46 @@ alias tgi="tg grunt init"
|
|||||||
alias tgp="tg grunt plan -lock=false"
|
alias tgp="tg grunt plan -lock=false"
|
||||||
alias tga="tg grunt apply"
|
alias tga="tg grunt apply"
|
||||||
alias tgu="tg grunt get -update"
|
alias tgu="tg grunt get -update"
|
||||||
alias tgg="tg grunt graph-dependencies"
|
|
||||||
|
|
||||||
alias idot='dot -Tsvg -Goverlap=scale -Grankdir=RL -Gbgcolor="#282a36" -Ncolor="#f8f8f2" -Ecolor="#f8f8f2" -Nfontcolor="#f8f8f2" -Gfontname="PragmataPro Mono Liga Regular" -Gfontsize=13 -Nfontname="PragmataPro" -Nfontsize=13 -Nshape=box -Earrowhead=normal'
|
|
||||||
|
|
||||||
alias curltime="curl -w \"@$HOME/.curl-format.txt\" -o /dev/null -s "
|
alias curltime="curl -w \"@$HOME/.curl-format.txt\" -o /dev/null -s "
|
||||||
|
|
||||||
alias vi=nvim
|
alias vi=nvim
|
||||||
alias vim=nvim
|
alias vim=nvim
|
||||||
|
|
||||||
|
git_root() {
|
||||||
|
# Check if we're in a git repository
|
||||||
|
if ! git rev-parse --is-inside-work-tree &>/dev/null; then
|
||||||
|
echo "Error: Not in a git repository" >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get the root of the git repository
|
||||||
|
local git_root
|
||||||
|
git_root=$(git rev-parse --show-toplevel)
|
||||||
|
|
||||||
|
if [ -n "$git_root" ]; then
|
||||||
|
echo "Changing directory to git root: $git_root"
|
||||||
|
cd "$git_root"
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
echo "Error: Could not determine git root directory" >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
alias groot="git_root"
|
||||||
|
|
||||||
|
git_push() {
|
||||||
|
# Check if we're in a git repository
|
||||||
|
if ! git rev-parse --is-inside-work-tree &>/dev/null; then
|
||||||
|
echo "Error: Not in a git repository" >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local branch
|
||||||
|
branch=$(git branch --show-current)
|
||||||
|
|
||||||
|
git push origin "$branch" $@
|
||||||
|
}
|
||||||
|
|
||||||
|
alias gpush="git_push"
|
||||||
|
|||||||
110
zsh/.zshrc
110
zsh/.zshrc
@@ -8,28 +8,40 @@ setopt HIST_IGNORE_SPACE # Do not record an event starting with a space.
|
|||||||
unsetopt HIST_SAVE_NO_DUPS # Do not write a duplicate event to the history file.
|
unsetopt HIST_SAVE_NO_DUPS # Do not write a duplicate event to the history file.
|
||||||
setopt SHARE_HISTORY # Share history between all sessions.
|
setopt SHARE_HISTORY # Share history between all sessions.
|
||||||
|
|
||||||
|
bindkey -e
|
||||||
|
|
||||||
bindkey '^R' history-incremental-search-backward
|
bindkey '^R' history-incremental-search-backward
|
||||||
bindkey '^A' beginning-of-line
|
bindkey '^A' beginning-of-line
|
||||||
bindkey '^E' end-of-line
|
bindkey '^E' end-of-line
|
||||||
bindkey '^K' kill-line
|
bindkey '^K' kill-line
|
||||||
|
|
||||||
|
bindkey "^[[1;5C" forward-word
|
||||||
|
bindkey "^[[1;5D" backward-word
|
||||||
|
|
||||||
setopt AUTO_PUSHD # Push the current directory visited on the stack.
|
setopt AUTO_PUSHD # Push the current directory visited on the stack.
|
||||||
setopt PUSHD_IGNORE_DUPS # Do not store duplicates in the stack.
|
setopt PUSHD_IGNORE_DUPS # Do not store duplicates in the stack.
|
||||||
setopt PUSHD_SILENT # Do not print the directory stack after pushd or popd.
|
setopt PUSHD_SILENT # Do not print the directory stack after pushd or popd.
|
||||||
|
|
||||||
|
DISABLE_AUTO_TITLE="true"
|
||||||
|
|
||||||
# install zsh-syntax-highlighting
|
# install zsh-syntax-highlighting
|
||||||
case "$(uname -s)" in
|
case "$(uname -s)" in
|
||||||
Linux*) {
|
Linux*) {
|
||||||
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
||||||
|
# make less more friendly for non-text input files, see lesspipe(1)
|
||||||
|
[ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"
|
||||||
} ;;
|
} ;;
|
||||||
Darwin*) {
|
Darwin*) {
|
||||||
source "$(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
|
source "$(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
|
||||||
|
# make less more friendly for non-text input files, see lesspipe(1)
|
||||||
|
export LESSOPEN="|$(brew --prefix)/bin/lesspipe.sh %s"
|
||||||
} ;;
|
} ;;
|
||||||
*) ;;
|
*) ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
bindkey "^[[1;5C" forward-word
|
if [ -f ~/.zsh_aliases ]; then
|
||||||
bindkey "^[[1;5D" backward-word
|
. ~/.zsh_aliases
|
||||||
|
fi
|
||||||
|
|
||||||
# Set fpath before sourcing completion.zsh
|
# Set fpath before sourcing completion.zsh
|
||||||
fpath=("$DOTFILES/zsh/zsh-completions/src" $fpath)
|
fpath=("$DOTFILES/zsh/zsh-completions/src" $fpath)
|
||||||
@@ -37,16 +49,92 @@ fpath=("$DOTFILES/zsh/zsh-completions/src" $fpath)
|
|||||||
source "$DOTFILES/zsh/completion.zsh"
|
source "$DOTFILES/zsh/completion.zsh"
|
||||||
source "$DOTFILES/zsh/zsh-autosuggestions/zsh-autosuggestions.zsh"
|
source "$DOTFILES/zsh/zsh-autosuggestions/zsh-autosuggestions.zsh"
|
||||||
|
|
||||||
# make less more friendly for non-text input files, see lesspipe(1)
|
# export starship_precmd_user_func="set_win_title"
|
||||||
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
#
|
||||||
|
# eval "$(starship init zsh)"
|
||||||
|
|
||||||
if [ -f ~/.zsh_aliases ]; then
|
autoload -Uz vcs_info
|
||||||
. ~/.zsh_aliases
|
setopt prompt_subst
|
||||||
fi
|
|
||||||
|
|
||||||
function set_win_title() {
|
zstyle ':vcs_info:*' enable git
|
||||||
echo -ne "\033]0; $(basename "$PWD") \007"
|
zstyle ':vcs_info:*' max-exports 3
|
||||||
|
|
||||||
|
zstyle ':vcs_info:*+*:*' debug false
|
||||||
|
|
||||||
|
zstyle ':vcs_info:git:*' check-for-changes true
|
||||||
|
zstyle ':vcs_info:git:*' get-revision false
|
||||||
|
zstyle ':vcs_info:git:*' stagedstr '+'
|
||||||
|
zstyle ':vcs_info:git:*' unstagedstr '!'
|
||||||
|
|
||||||
|
zstyle ':vcs_info:git*:*' use-simple true
|
||||||
|
zstyle ':vcs_info:git*:*' cache-ttl 30 # Cache for 30 seconds
|
||||||
|
|
||||||
|
function preexec() {
|
||||||
|
# Command execution timer
|
||||||
|
timer=${timer:-$SECONDS}
|
||||||
|
|
||||||
|
# Check if the command is a git command
|
||||||
|
if [[ "$1" == git* || "$1" == "g "* ]]; then
|
||||||
|
__GIT_COMMAND_EXECUTED=1
|
||||||
|
else
|
||||||
|
__GIT_COMMAND_EXECUTED=0
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
export starship_precmd_user_func="set_win_title"
|
|
||||||
|
|
||||||
eval "$(starship init zsh)"
|
precmd() {
|
||||||
|
if [[ $__GIT_COMMAND_EXECUTED -eq 1 ]]; then
|
||||||
|
zstyle ':vcs_info:git*:*' cache-ttl 0
|
||||||
|
__GIT_COMMAND_EXECUTED=0
|
||||||
|
fi
|
||||||
|
vcs_info
|
||||||
|
zstyle ':vcs_info:git*:*' cache-ttl 30
|
||||||
|
|
||||||
|
PS1=$'%B%(?.%F{240}--.%F{red}!%?)%f '
|
||||||
|
|
||||||
|
if [[ -z ${vcs_info_msg_0_} ]]; then
|
||||||
|
PS1+=$'%F{cyan}%5~%f%b '
|
||||||
|
else
|
||||||
|
PS1+=$'%F{cyan}%3~%f%b ${vcs_info_msg_0_} '
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $timer ]; then
|
||||||
|
timer_show=$(($SECONDS - $timer))
|
||||||
|
if [ $timer_show -gt 3 ]; then
|
||||||
|
PS1+=$'%F{240}-- %ftook %F{red}${timer_show}s %f'
|
||||||
|
fi
|
||||||
|
unset timer
|
||||||
|
fi
|
||||||
|
|
||||||
|
PS1+=$'\n;; '
|
||||||
|
}
|
||||||
|
zstyle ':vcs_info:git*' formats "%F{red}⎇ %b %F{blue}[%c%u] %F{240}(%F{red}%m%F{240})%f" # branch [staged unstaged(+untracked)] (misc(ahead/behind))
|
||||||
|
|
||||||
|
zstyle ':vcs_info:git*+set-message:*' hooks git-untracked
|
||||||
|
+vi-git-untracked() {
|
||||||
|
if [[ $(git rev-parse --is-inside-work-tree 2>/dev/null) == 'true' ]] &&
|
||||||
|
git status --porcelain | grep -m1 --mmap '??' &>/dev/null; then
|
||||||
|
hook_com[unstaged]+='?'
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
# zstyle ':vcs_info:git*+set-message:*' hooks git-st
|
||||||
|
# function +vi-git-st() {
|
||||||
|
# local ahead behind
|
||||||
|
# local -a gitstatus
|
||||||
|
#
|
||||||
|
# # Exit early in case the worktree is on a detached HEAD
|
||||||
|
# git rev-parse ${hook_com[branch]}@{upstream} >/dev/null 2>&1 || return 0
|
||||||
|
#
|
||||||
|
# local -a ahead_and_behind=(
|
||||||
|
# $(git rev-list --left-right --count HEAD...${hook_com[branch]}@{upstream} 2>/dev/null)
|
||||||
|
# )
|
||||||
|
#
|
||||||
|
# ahead=${ahead_and_behind[1]}
|
||||||
|
# behind=${ahead_and_behind[2]}
|
||||||
|
#
|
||||||
|
# (( $ahead )) && gitstatus+=( "+${ahead}" )
|
||||||
|
# (( $behind )) && gitstatus+=( "-${behind}" )
|
||||||
|
#
|
||||||
|
# # shfmt:ignore:start
|
||||||
|
# hook_com[misc]+=${(j:/:)gitstatus}
|
||||||
|
# # shfmt:ignore:end
|
||||||
|
# }
|
||||||
|
|||||||
Reference in New Issue
Block a user