Add timestamp for entered commands.
This commit is contained in:
17
.blerc
17
.blerc
@@ -52,3 +52,20 @@ function blerc/define-sabbrev-commit {
|
|||||||
}
|
}
|
||||||
blehook/eval-after-load complete blerc/define-sabbrev-commit
|
blehook/eval-after-load complete blerc/define-sabbrev-commit
|
||||||
|
|
||||||
|
# Show the timestamp aligned to the right after each command is entered.
|
||||||
|
show_timestamp() {
|
||||||
|
# 17:10:00 EST-05
|
||||||
|
local ts="$(date +'%H:%M:%S %Z%:::z')"
|
||||||
|
# Column to show timestamp.(COLUMNS - length_of_timestamp)
|
||||||
|
local col=$((COLUMNS - ${#ts}))
|
||||||
|
# Save current cursor position.
|
||||||
|
printf '\033[s'
|
||||||
|
# Move cursor to desired column.
|
||||||
|
printf "\033[${col}G"
|
||||||
|
# Print timestamp in gray.
|
||||||
|
printf '\e[90m%s\e[0m' "$ts"
|
||||||
|
# Restore previous cursor position.
|
||||||
|
printf '\033[u'
|
||||||
|
}
|
||||||
|
|
||||||
|
blehook PREEXEC=show_timestamp
|
||||||
|
|||||||
Reference in New Issue
Block a user