Compare commits
1 commit
Author | SHA1 | Date | |
---|---|---|---|
Erin | c8489ccd69 |
118
.github/README.md
vendored
118
.github/README.md
vendored
|
@ -1,118 +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
|
|
||||||
|
|
||||||
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
Normal file
46
README.md
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
# 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,3 +1,8 @@
|
||||||
|
# User identity
|
||||||
|
[user]
|
||||||
|
name = Erin
|
||||||
|
email = github@eritbh.me
|
||||||
|
|
||||||
# Command aliases
|
# Command aliases
|
||||||
[alias]
|
[alias]
|
||||||
l = log --oneline --decorate --graph
|
l = log --oneline --decorate --graph
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
# settings for repositories in ~/src/git.ewin.moe
|
|
||||||
[user]
|
|
||||||
name = Erin
|
|
||||||
email = git@ewin.moe
|
|
|
@ -1,4 +0,0 @@
|
||||||
# settings for repositories in ~/src/github.com
|
|
||||||
[user]
|
|
||||||
name = Erin
|
|
||||||
email = github@eritbh.me
|
|
|
@ -1,8 +1,2 @@
|
||||||
[include]
|
[include]
|
||||||
path = ~/.config/git/personal.gitconfig
|
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
|
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
#!/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
|
|
|
@ -1,8 +0,0 @@
|
||||||
#!/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,5 +0,0 @@
|
||||||
[WM]
|
|
||||||
activeBackground=72,72,72
|
|
||||||
activeForeground=221,221,221
|
|
||||||
inactiveBackground=72,72,72
|
|
||||||
inactiveForeground=129,129,129
|
|
|
@ -1,18 +0,0 @@
|
||||||
[$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
|
|
|
@ -1,16 +1,18 @@
|
||||||
MenuBar=Disabled
|
MenuBar=Disabled
|
||||||
|
State=AAAA/wAAAAD9AAAAAwAAAAAAAAC4AAACDfwCAAAAAvsAAAAWAGYAbwBsAGQAZQByAHMARABvAGMAawAAAAAA/////wAAAAoBAAAD+wAAABQAcABsAGEAYwBlAHMARABvAGMAawEAAAAmAAACDQAAAF0BAAADAAAAAQAAAAAAAAAA/AIAAAAB+wAAABAAaQBuAGYAbwBEAG8AYwBrAAAAAAD/////AAAACgEAAAMAAAADAAAERwAAAL78AQAAAAH7AAAAGAB0AGUAcgBtAGkAbgBhAGwARABvAGMAawAAAAAAAAAERwAAAJEBAAADAAADjgAAAg0AAAAEAAAABAAAAAgAAAAI/AAAAAEAAAACAAAAAQAAABYAbQBhAGkAbgBUAG8AbwBsAEIAYQByAQAAAAD/////AAAAAAAAAAA=
|
||||||
eDP-1 Height 1003=563
|
eDP-1 Height 1003=563
|
||||||
eDP-1 Width 1504=1095
|
eDP-1 Width 1504=1095
|
||||||
eDP-1 XPosition=235
|
eDP-1 XPosition=235
|
||||||
eDP-1 YPosition=177
|
eDP-1 YPosition=177
|
||||||
|
|
||||||
[CompactMode]
|
[CompactMode]
|
||||||
PreviewSize=22
|
FontWeight=50
|
||||||
|
|
||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
DefaultProfile=My Profile.profile
|
DefaultProfile=My Profile.profile
|
||||||
|
|
||||||
[DetailsMode]
|
[DetailsMode]
|
||||||
|
FontWeight=50
|
||||||
PreviewSize=22
|
PreviewSize=22
|
||||||
|
|
||||||
[General]
|
[General]
|
||||||
|
@ -18,29 +20,29 @@ AutoExpandFolders=true
|
||||||
BrowseThroughArchives=true
|
BrowseThroughArchives=true
|
||||||
EditableUrl=true
|
EditableUrl=true
|
||||||
ShowToolTips=true
|
ShowToolTips=true
|
||||||
Version=202
|
Version=200
|
||||||
ViewPropsTimestamp=2022,8,7,20,1,54
|
ViewPropsTimestamp=2022,8,7,20,1,54
|
||||||
|
|
||||||
|
[IconsMode]
|
||||||
|
FontWeight=50
|
||||||
|
|
||||||
[KFileDialog Settings]
|
[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 Files[$e]=org.kde.kfontview.desktop,file:///usr/share/applications/org.kde.kfontview.desktop
|
||||||
Recent URLs[$e]=file:///usr/share/applications/,file:$HOME/
|
Recent URLs[$e]=file:///usr/share/applications/,file:$HOME/
|
||||||
detailViewIconSize=16
|
detailViewIconSize=16
|
||||||
|
|
||||||
[KPropertiesDialog]
|
[KPropertiesDialog]
|
||||||
1504x1003 screen: Height=532
|
|
||||||
1504x1003 screen: Width=435
|
|
||||||
eDP-1 Height 1003=544
|
eDP-1 Height 1003=544
|
||||||
eDP-1 Width 1504=435
|
eDP-1 Width 1504=435
|
||||||
|
|
||||||
[MainWindow]
|
[MainWindow]
|
||||||
MenuBar=Disabled
|
MenuBar=Disabled
|
||||||
|
State=AAAA/wAAAAD9AAAAAwAAAAAAAAC4AAACDfwCAAAAAvsAAAAWAGYAbwBsAGQAZQByAHMARABvAGMAawAAAAAA/////wAAAAoBAAAD+wAAABQAcABsAGEAYwBlAHMARABvAGMAawEAAAAmAAACDQAAAF0BAAADAAAAAQAAAAAAAAAA/AIAAAAB+wAAABAAaQBuAGYAbwBEAG8AYwBrAAAAAAD/////AAAACgEAAAMAAAADAAAERwAAAL78AQAAAAH7AAAAGAB0AGUAcgBtAGkAbgBhAGwARABvAGMAawAAAAAAAAAERwAAAAoBAAADAAADjgAAAg0AAAAEAAAABAAAAAgAAAAI/AAAAAEAAAACAAAAAQAAABYAbQBhAGkAbgBUAG8AbwBsAEIAYQByAQAAAAD/////AAAAAAAAAAA=
|
||||||
ToolBarsMovable=Disabled
|
ToolBarsMovable=Disabled
|
||||||
eDP-1 Height 1003=563
|
eDP-1 Height 1003=563
|
||||||
eDP-1 Width 1504=1095
|
eDP-1 Width 1504=1095
|
||||||
eDP-1 XPosition=235
|
eDP-1 XPosition=0
|
||||||
eDP-1 YPosition=177
|
eDP-1 YPosition=27
|
||||||
|
|
||||||
[Open-with settings]
|
[Open-with settings]
|
||||||
CompletionMode=1
|
CompletionMode=1
|
|
@ -9,8 +9,6 @@ RememberWindowSize=false
|
||||||
ShowWindowTitleOnTitleBar=true
|
ShowWindowTitleOnTitleBar=true
|
||||||
|
|
||||||
[MainWindow]
|
[MainWindow]
|
||||||
1504x1003 screen: Height=524
|
|
||||||
1504x1003 screen: Width=689
|
|
||||||
1920x1080 screen: Height=524
|
1920x1080 screen: Height=524
|
||||||
1920x1080 screen: Width=689
|
1920x1080 screen: Width=689
|
||||||
2560x1080 screen: Height=524
|
2560x1080 screen: Height=524
|
||||||
|
@ -21,7 +19,8 @@ MenuBar=Disabled
|
||||||
State=AAAA/wAAAAD9AAAAAQAAAAAAAAAAAAAAAPwCAAAAAvsAAAAiAFEAdQBpAGMAawBDAG8AbQBtAGEAbgBkAHMARABvAGMAawAAAAAA/////wAAAXwBAAAD+wAAABwAUwBTAEgATQBhAG4AYQBnAGUAcgBEAG8AYwBrAAAAAAD/////AAABFQEAAAMAAAKxAAACOgAAAAQAAAAEAAAACAAAAAj8AAAAAQAAAAIAAAACAAAAFgBtAGEAaQBuAFQAbwBvAGwAQgBhAHIAAAAAAP////8AAAAAAAAAAAAAABwAcwBlAHMAcwBpAG8AbgBUAG8AbwBsAGIAYQByAAAAAAD/////AAAAAAAAAAA=
|
State=AAAA/wAAAAD9AAAAAQAAAAAAAAAAAAAAAPwCAAAAAvsAAAAiAFEAdQBpAGMAawBDAG8AbQBtAGEAbgBkAHMARABvAGMAawAAAAAA/////wAAAXwBAAAD+wAAABwAUwBTAEgATQBhAG4AYQBnAGUAcgBEAG8AYwBrAAAAAAD/////AAABFQEAAAMAAAKxAAACOgAAAAQAAAAEAAAACAAAAAj8AAAAAQAAAAIAAAACAAAAFgBtAGEAaQBuAFQAbwBvAGwAQgBhAHIAAAAAAP////8AAAAAAAAAAAAAABwAcwBlAHMAcwBpAG8AbgBUAG8AbwBsAGIAYQByAAAAAAD/////AAAAAAAAAAA=
|
||||||
ToolBarsMovable=Disabled
|
ToolBarsMovable=Disabled
|
||||||
Width=689
|
Width=689
|
||||||
eDP-1=eDP-1
|
eDP-1 XPosition=0
|
||||||
|
eDP-1 YPosition=27
|
||||||
|
|
||||||
[Notification Messages]
|
[Notification Messages]
|
||||||
CloseAllTabs=true
|
CloseAllTabs=true
|
|
@ -40,13 +40,6 @@ decocolorrule=2
|
||||||
wmclass=obsidian
|
wmclass=obsidian
|
||||||
wmclassmatch=1
|
wmclassmatch=1
|
||||||
|
|
||||||
[7]
|
|
||||||
Description=Application settings for gimp
|
|
||||||
decocolor=GIMP Dark
|
|
||||||
decocolorrule=2
|
|
||||||
wmclass=gimp
|
|
||||||
wmclassmatch=2
|
|
||||||
|
|
||||||
[General]
|
[General]
|
||||||
count=7
|
count=6
|
||||||
rules=1,2,3,4,5,6,7
|
rules=ac4334d1-953b-4987-893d-875a2a0603ac,1
|
|
@ -1,5 +1,5 @@
|
||||||
[WM]
|
[WM]
|
||||||
activeBackground=31,31,33
|
activeBackground=32,34,37
|
||||||
activeForeground=255,255,255
|
activeForeground=255,255,255
|
||||||
inactiveBackground=31,31,33
|
inactiveBackground=32,34,37
|
||||||
inactiveForeground=150,152,157
|
inactiveForeground=150,152,157
|
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 |
|
@ -25,5 +25,4 @@ function fetch_fronter_information {
|
||||||
precmd_functions+="set_fronter_information"
|
precmd_functions+="set_fronter_information"
|
||||||
function set_fronter_information {
|
function set_fronter_information {
|
||||||
eval_with_secrets fetch_fronter_information
|
eval_with_secrets fetch_fronter_information
|
||||||
export PROMPT_NAME_COLOR="$PK_FRONTER_COLOR"
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,3 @@ fancy-ctrl-z () {
|
||||||
}
|
}
|
||||||
zle -N fancy-ctrl-z
|
zle -N fancy-ctrl-z
|
||||||
bindkey '^Z' 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
|
|
||||||
|
|
16
zsh/.config/zsh/config.d/30_prompt.zsh
Normal file
16
zsh/.config/zsh/config.d/30_prompt.zsh
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# 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"
|
|
@ -1,99 +0,0 @@
|
||||||
# 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
|
|
51
zsh/.config/zsh/config.d/30_rprompt.zsh
Normal file
51
zsh/.config/zsh/config.d/30_rprompt.zsh
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
# 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
|
||||||
|
}
|
|
@ -28,3 +28,6 @@ fi
|
||||||
|
|
||||||
# User program: add rbenv
|
# User program: add rbenv
|
||||||
[ -d "$HOME/.rbenv/bin" ] && eval "$(~/.rbenv/bin/rbenv init - zsh)"
|
[ -d "$HOME/.rbenv/bin" ] && eval "$(~/.rbenv/bin/rbenv init - zsh)"
|
||||||
|
|
||||||
|
# User program: ntp is a fuck
|
||||||
|
alias timesync="sudo timedatectl set-ntp 0 && sudo timedatectl set-ntp 1"
|
||||||
|
|
Loading…
Reference in a new issue