Browse Source

better inputrc

master
pvincent 8 months ago
parent
commit
b968e42f10
  1. 21
      inputrc
  2. 2
      install.sh
  3. 42
      tools/erase_lines
  4. 5
      tools/ssl_check_domain

21
inputrc

@ -1,15 +1,20 @@
## arrow up, down for history search
## completion case-insentivive
set completion-ignore-case on
## ARROW up, down for history search
"\e[A":history-search-backward
"\e[B":history-search-forward
# mappings for Ctrl-left-arrow and Ctrl-right-arrow for word moving
# CTRL + Right, Left for word suppressing
"\e[1;5C": forward-word
"\e[1;5D": backward-word
"\e[5C": forward-word
"\e[5D": backward-word
"\e\e[C": forward-word
"\e\e[D": backward-word
## completion case-insentivive
set completion-ignore-case on
# ALT + BACKSPACE for left line suppressing
"\e[3;3~": kill-line
# ALT + DELETE for right line suppressing
"\e\C-?": backward-kill-line
# CTRL + BACKSPACE for left word suppressing
"\C-H": backward-kill-word

2
install.sh

@ -15,7 +15,7 @@ function install_host() {
[ "$(id -u)" -ne 0 ] && echo 'root privilege required' && exit 1
if [[ ! $CURDIR == '/opt/debian-bash' ]]; then
# download and filfull /opt/debian-bash, then run it from folder
# download and fullfill /opt/debian-bash, then run it from folder
if [[ -L /opt/debian-bash ]]; then
cd /opt/debian-bash && ./install.sh "$PARAM1"

42
tools/erase_lines

@ -0,0 +1,42 @@
#!/bin/bash
# Clears the entire current line regardless of terminal size.
# See the magic by running:
# { sleep 1; clear_this_line ; }&
clear_this_line(){
printf '\r'
cols="$(tput cols)"
for i in $(seq "$cols"); do
printf ' '
done
printf '\r'
}
# Erases the amount of lines specified.
# Usage: erase_lines [AMOUNT]
# See the magic by running:
# { sleep 1; erase_lines 2; }&
erase_lines(){
# Default line count to 1.
test -z "$1" && lines="1" || lines="$1"
# This is what we use to move the cursor to previous lines.
UP='\033[1A'
# Exit if erase count is zero.
[ "$lines" = 0 ] && return
# Erase.
if [ "$lines" = 1 ]; then
clear_this_line
else
lines=$((lines-1))
clear_this_line
for i in $(seq "$lines"); do
printf "$UP"
clear_this_line
done
fi
}
erase_lines "$1"

5
tools/ssl_check_domain

@ -1,5 +0,0 @@
#!/bin/bash
DOMAIN_NAME=$1
curl --insecure -v https://$DOMAIN_NAME 2>&1 | awk 'BEGIN { cert=0 } /^\* Server certificate:/ { cert=1 } /^\*/ { if (cert) print }'
Loading…
Cancel
Save