Compare commits
24 commits
Author | SHA1 | Date | |
---|---|---|---|
Erin | 1f4fec71be | ||
Erin | 4dac47ebf1 | ||
Erin | 9f1d89476b | ||
Erin | 134c66c40c | ||
Erin | d248e8db45 | ||
Erin | 3616100be8 | ||
Erin | 08899c5389 | ||
Erin | 9191e7c09b | ||
erin | 29f2f2aa2e | ||
Erin | e3bed71aaa | ||
Erin | b1de97c26c | ||
Erin | c9e74bc7e5 | ||
Erin | 9f3bc25600 | ||
erin | e211b0b1a8 | ||
erin | f5d6353371 | ||
Erin | 636e6a5582 | ||
Erin | 9bb8a94879 | ||
Erin | 9cd4e23932 | ||
Erin | 57a5eb0247 | ||
Erin | d29244712d | ||
Erin | daa83d6286 | ||
Erin | 85925d9357 | ||
Erin | e0be7c37f0 | ||
Erin | e6254f0f27 |
118
.github/README.md
vendored
Normal file
118
.github/README.md
vendored
Normal file
|
@ -0,0 +1,118 @@
|
|||
# dotfiles
|
||||
|
||||
too many dotfiles
|
||||
|
||||
## Installation
|
||||
|
||||
Use [GNU Stow][stow] (`apt install stow`, etc.). The repo has a `.stowrc` which
|
||||
should target your home directory as the installation directory, but in some
|
||||
cases the `~` may not be evaluated and you'll have to specify
|
||||
`--target="$HOME"`.
|
||||
|
||||
Install the essentials with `stow zsh vim git`.
|
||||
|
||||
## Notes
|
||||
|
||||
### Git
|
||||
|
||||
Most of my git configuration lives in `~/.config/git/personal.gitconfig`, which
|
||||
is `include`d from `~/.gitconfig`. I do this to separate system-specific
|
||||
configuration that may be set by automated tools (i.e. the Github CLI setting up
|
||||
credential managers for guthub.com and gist.github.com) from my personal,
|
||||
cross-platform configuration (e.g. my identity and aliases).
|
||||
|
||||
Keep configuration that should be synced between computers in the
|
||||
`personal.gitconfig` file, and after cloning the repository, consider telling
|
||||
Git to ignore local changes to the main `.gitconfig` file:
|
||||
|
||||
git update-index --skip-worktree git/.gitconfig
|
||||
|
||||
### zsh
|
||||
|
||||
The zsh config has secrets now, because of the prompt username color fetching
|
||||
thing. You'll probably want to avoid committing your secrets:
|
||||
|
||||
git update-index --skip-worktree zsh/.config/zsh/config.d/00_secrets.zsh
|
||||
|
||||
The prompt will still work if you don't fill in anything in that file, it'll
|
||||
just always be the default color (your terminal's `cyan`).
|
||||
|
||||
### KDE
|
||||
|
||||
KDE stuff is split up a lot. If you want everything, `stow kde-*` should work in
|
||||
all the shells I care about.
|
||||
|
||||
#### `kde-autostart-ksuperkey`
|
||||
|
||||
Adds an autostart entry for `/usr/bin/ksuperkey -e 'Super_L=Alt_L|F2'`, which
|
||||
maps presses of the left meta key to Alt+F2 (the default bind for krunner).
|
||||
[ksuperkey][ksuperkey] can only be used in X, it breaks on Wayland. Install it
|
||||
via adding dependencies, cloning, `make`, and `make install`:
|
||||
|
||||
# on debian/etc:
|
||||
# sudo apt install git gcc make libx11-dev libxtst-dev pkg-config
|
||||
# on fedora-based things:
|
||||
# sudo dnf install git gcc make libX11-devel libXtst-devel pkgconfig
|
||||
mkdir -p ~/src/github.com/hanschen
|
||||
cd ~/src/github.com/hanschen
|
||||
git clone https://github.com/hanschen/ksuperkey.git
|
||||
cd ~/src/github.com/hanschen/ksuperkey
|
||||
make
|
||||
sudo make install
|
||||
|
||||
#### `kde-autostart-syncthing`
|
||||
|
||||
Adds an autostart entry for
|
||||
`/usr/bin/syncthing serve --no-browser --logfile=default`, which starts
|
||||
Syncthing without opening the web UI and logs to files in
|
||||
`~/.config/syncthing`. Install [Syncthing][syncthing] via your package manager,
|
||||
probably.
|
||||
|
||||
#### `kde-dolphin`
|
||||
|
||||
Configuration for Dolphin. Mostly toolbar layout and icon sizes.
|
||||
|
||||
#### `kde-icon-*`
|
||||
|
||||
Custom icons for various apps I use. They wind up in
|
||||
`~/.local/share/icons/hicolor/*` alongside other icons for user-installed apps.
|
||||
|
||||
#### `kde-konsole`
|
||||
|
||||
My Konsole profile, as well as some additional configuration for default window
|
||||
size on different screens. You can see what screen sizes I use in here!
|
||||
|
||||
Konsole also stores window *position* in this file, which I super do not care
|
||||
about. You will probably want to skip-worktree this file as well:
|
||||
|
||||
git update-index --skip-worktree kde-konsole/.config/konsolerc
|
||||
|
||||
#### `kde-krunner`
|
||||
|
||||
Just adds a `.desktop` entry that launches krunner. Mostly useful as a thing I
|
||||
used to keep on my application switcher, but nowadays I don't really use it - if
|
||||
I have a launcher icon on my dock at all, it'll be a proper switcher so I can
|
||||
log out/shutdown/etc without my keyboard if I need to.
|
||||
|
||||
#### `kde-kwin-apprules`
|
||||
|
||||
Custom application rules for `kwin`. Files in `~/.local/share/color-schemes`
|
||||
come from [my repo of KDE titlebar color schemes][colors].
|
||||
|
||||
#### `kde-spectacle`
|
||||
|
||||
Configures Spectacle to act more like ShareX or macOS's screenshot tool by
|
||||
default - pressing print screen will bring up rectangle select, and hitting
|
||||
enter will save the screenshot to disk and copy the image contents to the
|
||||
clipboard. My screenshots are saved to
|
||||
`~/Pictures/Screenshots/YYYY-MM/YYYYMMDDHHmmSS.png`.
|
||||
|
||||
Spectacle also stores the path of the last saved image in config, so it's
|
||||
another one for skip-worktree:
|
||||
|
||||
git update-index --skip-worktree kde-spectacle/.config/spectaclerc
|
||||
|
||||
[colors]: https://github.com/eritbh/kde-application-titlebar-themes
|
||||
[ksuperkey]: https://github.com/hanschen/ksuperkey
|
||||
[stow]: https://www.gnu.org/software/stow
|
||||
[syncthing]: https://syncthing.net
|
46
README.md
46
README.md
|
@ -1,46 +0,0 @@
|
|||
# dotfiles
|
||||
|
||||
too many dotfiles
|
||||
|
||||
## Installation
|
||||
|
||||
Use [GNU Stow][stow] (`apt install stow`, etc.). The repo has a `.stowrc` which
|
||||
should target your home directory as the installation directory, but in some
|
||||
cases the `~` may not be evaluated and you'll have to specify
|
||||
`--target="$HOME"`.
|
||||
|
||||
Install the essentials with `stow zsh vim git`.
|
||||
|
||||
## Notes
|
||||
|
||||
### Git
|
||||
|
||||
Most of my git configuration lives in `~/.config/git/personal.gitconfig`, which
|
||||
is `include`d from `~/.gitconfig`. I do this to separate system-specific
|
||||
configuration that may be set by automated tools (i.e. the Github CLI setting up
|
||||
credential managers for guthub.com and gist.github.com) from my personal,
|
||||
cross-platform configuration (e.g. my identity and aliases).
|
||||
|
||||
Keep configuration that should be synced between computers in the
|
||||
`personal.gitconfig` file, and after cloning the repository, consider telling
|
||||
Git to ignore local changes to the main `.gitconfig` file:
|
||||
|
||||
git update-index --skip-worktree git/.gitconfig
|
||||
|
||||
### zsh
|
||||
|
||||
The zsh config has secrets now, because of the prompt username color fetching
|
||||
thing. You'll probably want to avoid committing your secrets:
|
||||
|
||||
git update-index --skip-worktree zsh/.config/zsh/config.d/00_secrets.zsh
|
||||
|
||||
The prompt will still work if you don't fill in anything in that file, it'll
|
||||
just always be the default color (your terminal's `cyan`).
|
||||
|
||||
### KDE
|
||||
|
||||
Files in `~/.local/share/color-schemes` come from [my repo of KDE titlebar color
|
||||
schemes][colors].
|
||||
|
||||
[stow]: https://www.gnu.org/software/stow
|
||||
[colors]: https://github.com/eritbh/kde-application-titlebar-themes
|
|
@ -1,8 +1,3 @@
|
|||
# User identity
|
||||
[user]
|
||||
name = Erin
|
||||
email = github@eritbh.me
|
||||
|
||||
# Command aliases
|
||||
[alias]
|
||||
l = log --oneline --decorate --graph
|
||||
|
|
4
git/.config/git/servers/git.ewin.moe.gitconfig
Normal file
4
git/.config/git/servers/git.ewin.moe.gitconfig
Normal file
|
@ -0,0 +1,4 @@
|
|||
# settings for repositories in ~/src/git.ewin.moe
|
||||
[user]
|
||||
name = Erin
|
||||
email = git@ewin.moe
|
4
git/.config/git/servers/github.com.gitconfig
Normal file
4
git/.config/git/servers/github.com.gitconfig
Normal file
|
@ -0,0 +1,4 @@
|
|||
# settings for repositories in ~/src/github.com
|
||||
[user]
|
||||
name = Erin
|
||||
email = github@eritbh.me
|
|
@ -1,2 +1,8 @@
|
|||
[include]
|
||||
path = ~/.config/git/personal.gitconfig
|
||||
|
||||
# Pull in additional config files for per-server identity
|
||||
[includeIf "gitdir:~/src/github.com/"]
|
||||
path = ~/.config/git/servers/github.com.gitconfig
|
||||
[includeIf "gitdir:~/src/git.ewin.moe/"]
|
||||
path = ~/.config/git/servers/git.ewin.moe.gitconfig
|
||||
|
|
8
kde-autostart-ksuperkey/.config/autostart/ksuperkey.desktop
Executable file
8
kde-autostart-ksuperkey/.config/autostart/ksuperkey.desktop
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env xdg-open
|
||||
[Desktop Entry]
|
||||
Exec=/usr/bin/ksuperkey -e 'Super_L=Alt_L|F2'
|
||||
Icon=krunner
|
||||
Name=ksuperkey
|
||||
Path=
|
||||
Terminal=False
|
||||
Type=Application
|
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env xdg-open
|
||||
[Desktop Entry]
|
||||
Exec=/usr/bin/syncthing serve --no-browser --logfile=default
|
||||
Icon=syncthing
|
||||
Name=syncthing
|
||||
Path=
|
||||
Terminal=False
|
||||
Type=Application
|
|
@ -1,18 +1,16 @@
|
|||
MenuBar=Disabled
|
||||
State=AAAA/wAAAAD9AAAAAwAAAAAAAAC4AAACDfwCAAAAAvsAAAAWAGYAbwBsAGQAZQByAHMARABvAGMAawAAAAAA/////wAAAAoBAAAD+wAAABQAcABsAGEAYwBlAHMARABvAGMAawEAAAAmAAACDQAAAF0BAAADAAAAAQAAAAAAAAAA/AIAAAAB+wAAABAAaQBuAGYAbwBEAG8AYwBrAAAAAAD/////AAAACgEAAAMAAAADAAAERwAAAL78AQAAAAH7AAAAGAB0AGUAcgBtAGkAbgBhAGwARABvAGMAawAAAAAAAAAERwAAAJEBAAADAAADjgAAAg0AAAAEAAAABAAAAAgAAAAI/AAAAAEAAAACAAAAAQAAABYAbQBhAGkAbgBUAG8AbwBsAEIAYQByAQAAAAD/////AAAAAAAAAAA=
|
||||
eDP-1 Height 1003=563
|
||||
eDP-1 Width 1504=1095
|
||||
eDP-1 XPosition=235
|
||||
eDP-1 YPosition=177
|
||||
|
||||
[CompactMode]
|
||||
FontWeight=50
|
||||
PreviewSize=22
|
||||
|
||||
[Desktop Entry]
|
||||
DefaultProfile=My Profile.profile
|
||||
|
||||
[DetailsMode]
|
||||
FontWeight=50
|
||||
PreviewSize=22
|
||||
|
||||
[General]
|
||||
|
@ -20,24 +18,24 @@ AutoExpandFolders=true
|
|||
BrowseThroughArchives=true
|
||||
EditableUrl=true
|
||||
ShowToolTips=true
|
||||
Version=200
|
||||
Version=202
|
||||
ViewPropsTimestamp=2022,8,7,20,1,54
|
||||
|
||||
[IconsMode]
|
||||
FontWeight=50
|
||||
|
||||
[KFileDialog Settings]
|
||||
Places Icons Auto-resize=false
|
||||
Places Icons Static Size=22
|
||||
Recent Files[$e]=org.kde.kfontview.desktop,file:///usr/share/applications/org.kde.kfontview.desktop
|
||||
Recent URLs[$e]=file:///usr/share/applications/,file:$HOME/
|
||||
detailViewIconSize=16
|
||||
|
||||
[KPropertiesDialog]
|
||||
1504x1003 screen: Height=532
|
||||
1504x1003 screen: Width=435
|
||||
eDP-1 Height 1003=544
|
||||
eDP-1 Width 1504=435
|
||||
|
||||
[MainWindow]
|
||||
MenuBar=Disabled
|
||||
State=AAAA/wAAAAD9AAAAAwAAAAAAAAC4AAACDfwCAAAAAvsAAAAWAGYAbwBsAGQAZQByAHMARABvAGMAawAAAAAA/////wAAAAoBAAAD+wAAABQAcABsAGEAYwBlAHMARABvAGMAawEAAAAmAAACDQAAAF0BAAADAAAAAQAAAAAAAAAA/AIAAAAB+wAAABAAaQBuAGYAbwBEAG8AYwBrAAAAAAD/////AAAACgEAAAMAAAADAAAERwAAAL78AQAAAAH7AAAAGAB0AGUAcgBtAGkAbgBhAGwARABvAGMAawAAAAAAAAAERwAAAJEBAAADAAADjgAAAg0AAAAEAAAABAAAAAgAAAAI/AAAAAEAAAACAAAAAQAAABYAbQBhAGkAbgBUAG8AbwBsAEIAYQByAQAAAAD/////AAAAAAAAAAA=
|
||||
ToolBarsMovable=Disabled
|
||||
eDP-1 Height 1003=563
|
||||
eDP-1 Width 1504=1095
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
|
@ -9,6 +9,8 @@ RememberWindowSize=false
|
|||
ShowWindowTitleOnTitleBar=true
|
||||
|
||||
[MainWindow]
|
||||
1504x1003 screen: Height=524
|
||||
1504x1003 screen: Width=689
|
||||
1920x1080 screen: Height=524
|
||||
1920x1080 screen: Width=689
|
||||
2560x1080 screen: Height=524
|
||||
|
@ -19,6 +21,7 @@ MenuBar=Disabled
|
|||
State=AAAA/wAAAAD9AAAAAQAAAAAAAAAAAAAAAPwCAAAAAvsAAAAiAFEAdQBpAGMAawBDAG8AbQBtAGEAbgBkAHMARABvAGMAawAAAAAA/////wAAAXwBAAAD+wAAABwAUwBTAEgATQBhAG4AYQBnAGUAcgBEAG8AYwBrAAAAAAD/////AAABFQEAAAMAAAKxAAACOgAAAAQAAAAEAAAACAAAAAj8AAAAAQAAAAIAAAACAAAAFgBtAGEAaQBuAFQAbwBvAGwAQgBhAHIAAAAAAP////8AAAAAAAAAAAAAABwAcwBlAHMAcwBpAG8AbgBUAG8AbwBsAGIAYQByAAAAAAD/////AAAAAAAAAAA=
|
||||
ToolBarsMovable=Disabled
|
||||
Width=689
|
||||
eDP-1=eDP-1
|
||||
|
||||
[Notification Messages]
|
||||
CloseAllTabs=true
|
|
@ -40,6 +40,13 @@ decocolorrule=2
|
|||
wmclass=obsidian
|
||||
wmclassmatch=1
|
||||
|
||||
[7]
|
||||
Description=Application settings for gimp
|
||||
decocolor=GIMP Dark
|
||||
decocolorrule=2
|
||||
wmclass=gimp
|
||||
wmclassmatch=2
|
||||
|
||||
[General]
|
||||
count=6
|
||||
rules=ac4334d1-953b-4987-893d-875a2a0603ac,1
|
||||
count=7
|
||||
rules=1,2,3,4,5,6,7
|
|
@ -1,5 +1,5 @@
|
|||
[WM]
|
||||
activeBackground=32,34,37
|
||||
activeBackground=31,31,33
|
||||
activeForeground=255,255,255
|
||||
inactiveBackground=32,34,37
|
||||
inactiveBackground=31,31,33
|
||||
inactiveForeground=150,152,157
|
|
@ -0,0 +1,5 @@
|
|||
[WM]
|
||||
activeBackground=72,72,72
|
||||
activeForeground=221,221,221
|
||||
inactiveBackground=72,72,72
|
||||
inactiveForeground=129,129,129
|
18
kde-spectacle/.config/spectaclerc
Normal file
18
kde-spectacle/.config/spectaclerc
Normal file
|
@ -0,0 +1,18 @@
|
|||
[$Version]
|
||||
update_info=spectacle_clipboard.upd:clipboard-settings-change,spectacle_rememberregion.upd:spectacle-migrate-rememberregion
|
||||
|
||||
[General]
|
||||
autoSaveImage=true
|
||||
clipboardGroup=PostScreenshotCopyImage
|
||||
onLaunchAction=UseLastUsedCapturemode
|
||||
rememberLastRectangularRegion=Never
|
||||
showCaptureInstructions=false
|
||||
|
||||
[GuiConfig]
|
||||
captureDelay=0
|
||||
captureMode=0
|
||||
quitAfterSaveCopyExport=true
|
||||
|
||||
[Save]
|
||||
defaultSaveLocation=file:///home/erin/Pictures/Screenshots
|
||||
saveFilenameFormat=%Y-%M/%Y%M%D%H%m%S
|
|
@ -25,4 +25,5 @@ function fetch_fronter_information {
|
|||
precmd_functions+="set_fronter_information"
|
||||
function set_fronter_information {
|
||||
eval_with_secrets fetch_fronter_information
|
||||
export PROMPT_NAME_COLOR="$PK_FRONTER_COLOR"
|
||||
}
|
||||
|
|
|
@ -10,3 +10,6 @@ fancy-ctrl-z () {
|
|||
}
|
||||
zle -N fancy-ctrl-z
|
||||
bindkey '^Z' fancy-ctrl-z
|
||||
|
||||
# make delete key work; this gets fucked with by badly-behaved distros sometimes
|
||||
bindkey "\e[3~" delete-char
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
# Prompt stuff
|
||||
setopt PROMPT_SUBST
|
||||
|
||||
# vcs_info - used for displaying VCS information in prompt
|
||||
zstyle ':vcs_info:*' actionformats '%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f '
|
||||
zstyle ':vcs_info:*' formats '(%b) '
|
||||
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r'
|
||||
autoload -Uz vcs_info
|
||||
precmd_functions+="vcs_info"
|
||||
|
||||
# Prompt shows hostname if connected to a remote or if root
|
||||
PROMPT="%B$([ -n "$is_remote" ] || [ "$EUID" = 0 ] && echo "%F{magenta}%m%f ")%F{$([ "$EUID" = 0 ] && echo "red" || echo "\${PK_FRONTER_COLOR:-cyan}")}%n%f %F{blue}%~%f%b \${vcs_info_msg_0_}%B%#%b "
|
||||
|
||||
# The line before the prompt is used by RPROMPT for information about the previous command - leave space
|
||||
NEWLINE=$'\n'
|
||||
PROMPT="$NEWLINE$PROMPT"
|
99
zsh/.config/zsh/config.d/30_prompts.zsh
Normal file
99
zsh/.config/zsh/config.d/30_prompts.zsh
Normal file
|
@ -0,0 +1,99 @@
|
|||
# Prompt stuff
|
||||
|
||||
# allow command substitutions at prompt time
|
||||
setopt PROMPT_SUBST
|
||||
|
||||
# Hide rprompt after command execution
|
||||
setopt TRANSIENT_RPROMPT
|
||||
|
||||
lineup=$'\e[1A'
|
||||
linedown=$'\e[1B'
|
||||
newline=$'\n'
|
||||
|
||||
# vcs_info - used for displaying VCS information in prompt
|
||||
zstyle ':vcs_info:*' actionformats '%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f '
|
||||
zstyle ':vcs_info:*' formats '(%b) '
|
||||
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r'
|
||||
autoload -Uz vcs_info
|
||||
precmd_functions+="vcs_info"
|
||||
|
||||
# Prompt shows hostname if connected to a remote or if root
|
||||
PROMPT_NORMAL="$newline%B$([ -n "$is_remote" ] || [ "$EUID" = 0 ] && echo "%F{magenta}%m%f ")%F{$([ "$EUID" = 0 ] && echo "red" || echo "\${PROMPT_NAME_COLOR:-cyan}")}%n%f %F{blue}%~%f%b \${vcs_info_msg_0_}$newline%B%#%b "
|
||||
|
||||
# Also create a minimal prompt which is displayed for previously run commands
|
||||
PROMPT_MINIMAL="%F{$([ -n "$is_remote" ] && echo "magenta" || [ "$EUID" = 0 ] && echo "red" || echo "\${PROMPT_NAME_COLOR:-cyan}")}%B%#%b%f "
|
||||
|
||||
# Replace prompt with a smaller form on enter
|
||||
PROMPT="$PROMPT_NORMAL"
|
||||
function del-prompt-accept-line {
|
||||
# store current prompts
|
||||
# remove everything from left prompt except %/#
|
||||
PROMPT="$PROMPT_MINIMAL"
|
||||
RPROMPT_OLD="$RPROMPT"
|
||||
RPROMPT=""
|
||||
zle reset-prompt
|
||||
PROMPT="$PROMPT_NORMAL"
|
||||
RPROMPT="$RPROMPT_OLD"
|
||||
zle accept-line
|
||||
}
|
||||
zle -N del-prompt-accept-line
|
||||
bindkey '^M' del-prompt-accept-line
|
||||
|
||||
# Multiline incomplete command prompt
|
||||
PROMPT2=" "
|
||||
|
||||
# Hook preexec/precmd to dynamically set RPROMPT with useful info
|
||||
|
||||
# start a timer every time we exec something so we can see how long it took
|
||||
preexec_functions+=start_prompt_timer
|
||||
function start_prompt_timer {
|
||||
# Store command execution start time
|
||||
rprompt_exec_timer="${timer:-"$(date +%s.%N)"}"
|
||||
}
|
||||
|
||||
# check the timer and add other info about the exec'd process to RPROMPT
|
||||
# this needs to be the first precmd function because it needs to run before any
|
||||
# other precmd hooks (e.g. the VS Code terminal integration hook) happen,
|
||||
# otherwise $? will be fucked
|
||||
precmd_functions=(build_rprompt ${precmd_functions[@]})
|
||||
function build_rprompt {
|
||||
# Start with a fresh prompt
|
||||
RPROMPT=""
|
||||
if [ -z $new_session ]; then
|
||||
# If this is the first prompt in a session, there's not much to say
|
||||
RPROMPT="%B%F{cyan}new session%f%b"
|
||||
new_session=1
|
||||
else
|
||||
# Show exit code + more info about the last command run as a separate line
|
||||
RPROMPT="exited %B%(?.%F{green}%?%f.%F{red}%?%f)%b"
|
||||
if [ -z $rprompt_exec_timer ]; then
|
||||
# If we never set $timer, preexec was never run (e.g. ^C at prompt)
|
||||
RPROMPT="%B%F{cyan}no exec%f%b, $RPROMPT"
|
||||
else
|
||||
# Calculate elapsed real time for last command
|
||||
now="$(date +%s.%N)"
|
||||
if [[ $(($now - $rprompt_exec_timer)) > 0.5 ]]; then
|
||||
timer_show=$(($now - $rprompt_exec_timer))
|
||||
timer_show=$(printf '%.*f\n' 3 $timer_show)
|
||||
RPROMPT="took %B%F{cyan}${timer_show}s%f%b, $RPROMPT"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# add exit time, including timezone if remote, and collapse it if we're out of room
|
||||
timeformat="%D{%T$([ -n "$is_remote" ] && echo ' %Z')}"
|
||||
exittime="$(print -P "$timeformat")"
|
||||
RPROMPT="$RPROMPT at $exittime"
|
||||
|
||||
# this is all info about the previous command, so put it up a line from the main prompt
|
||||
RPROMPT="%{$lineup%}$RPROMPT%{$linedown%}"
|
||||
|
||||
# that's an RPROMPT!
|
||||
export RPROMPT
|
||||
|
||||
# always unset $timer for the next run
|
||||
unset rprompt_exec_timer
|
||||
}
|
||||
|
||||
# get rid of useless right-side space
|
||||
export ZLE_RPROMPT_INDENT=0
|
|
@ -1,51 +0,0 @@
|
|||
# Hook preexec/precmd to dynamically set rprompt with useful info
|
||||
preexec_functions+=start_prompt_timer
|
||||
function start_prompt_timer {
|
||||
# Store command execution start time
|
||||
timer="${timer:-"$(date +%s.%N)"}"
|
||||
}
|
||||
|
||||
# this needs to be the first precmd function because it needs to run before any
|
||||
# other precmd hooks (e.g. the VS Code terminal integration hook) happen,
|
||||
# otherwise $? will be fucked
|
||||
precmd_functions=(build_rprompt ${precmd_functions[@]})
|
||||
function build_rprompt {
|
||||
# Start with a fresh prompt
|
||||
RPROMPT=""
|
||||
if [ -z $new_session ]; then
|
||||
# If this is the first prompt in a session, there's not much to say
|
||||
RPROMPT="%B%F{cyan}new session%f%b"
|
||||
new_session=1
|
||||
else
|
||||
# Show exit code + more info about the last command run as a separate line
|
||||
RPROMPT="exited %B%(?.%F{green}%?%f.%F{red}%?%f)%b"
|
||||
if [ -z $timer ]; then
|
||||
# If we never set $timer, preexec was never run (e.g. ^C at prompt)
|
||||
RPROMPT="%B%F{cyan}no exec%f%b, $RPROMPT"
|
||||
else
|
||||
# Calculate elapsed real time for last command
|
||||
now="$(date +%s.%N)"
|
||||
if [[ $(($now - $timer)) > 0.5 ]]; then
|
||||
timer_show=$(($now - $timer))
|
||||
timer_show=$(printf '%.*f\n' 3 $timer_show)
|
||||
RPROMPT="took %B%F{cyan}${timer_show}s%f%b, $RPROMPT"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# add exit time, including timezone if remote, and collapse it if we're out of room
|
||||
timeformat="%D{%T$([ -n "$is_remote" ] && echo ' %Z')}"
|
||||
exittime="$(print -P "$timeformat")"
|
||||
RPROMPT="$RPROMPT at $exittime"
|
||||
|
||||
# this is all info about the previous command, so put it up a line from the main prompt
|
||||
lineup=$'\e[1A'
|
||||
linedown=$'\e[1B'
|
||||
RPROMPT="%{$lineup%}$RPROMPT%{$linedown%}"
|
||||
|
||||
# that's an RPROMPT!
|
||||
export RPROMPT
|
||||
|
||||
# always unset $timer for the next run
|
||||
unset timer
|
||||
}
|
Loading…
Reference in a new issue