Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # source this file to put bash's input line at the top of the screen
- # you'll probably also want to set horizontal-scroll-mode in .inputrc so
- # if you type a long command, it won't spill over into your scrollback
- base_PS1='[\u@\h \W]\$ '
- # \e[H moves to top left, \e[K erases to end of line
- PS1="\[\e[H\e[K\]$base_PS1"
- pre_command () {
- # enable scrolling from line 2 to bottom of screen
- printf "\e[2;${LINES}r"
- # move cursor to bottom of screen, column 1
- printf "\e[${LINES};1H"
- # print command
- printf "\n+ %s\n" "$BASH_COMMAND"
- # re-enable full-screen scrolling for less, which behaves slightly
- # strangely otherwise. will likely need to account for other commands
- # here. fixing this properly for less would probably involve writing a
- # wrapper script that reset the screen before running /usr/bin/less and
- # setting PAGER to it, so that indirect invocations (e.g. via man)
- # would work too
- if [[ $BASH_COMMAND =~ ^[[:space:]]*less([[:space:]]|$) ]]
- then
- printf "\e[r"
- fi
- }
- trap pre_command DEBUG
- clear
Add Comment
Please, Sign In to add comment