1
0
Fork 0

Compare commits

...

5 Commits

Author SHA1 Message Date
urosm 74e2032202 remove `readline` config 2023-12-20 21:08:05 +01:00
urosm 3c6fb05bbc update `.bashrc` 2023-12-20 21:07:55 +01:00
urosm e419d10a3c update `.profile` 2023-12-20 20:49:49 +01:00
urosm 596932ca27 update `.bashrc` 2023-12-20 20:49:40 +01:00
urosm 1c3c2ca149 remove `screen` config 2023-12-20 20:48:27 +01:00
4 changed files with 37 additions and 105 deletions

77
bashrc
View File

@ -1,39 +1,37 @@
# check interactive
case $- in
*i*) ;;
*) return ;;
esac
# ~/.bashrc
# if not running interactively, don't do anything
[ -z "$PS1" ] && return
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# history
shopt -s histappend
HISTCONTROL=ignoreboth
HISTSIZE=1000
HISTFILESIZE=2000
PROMPT_COMMAND="history -a"
# prompt
r="\[\e[00m\]"
b="\[\e[01m\]"
c4="\[\e[34m\]"
c7="\[\e[37m\]"
PS1="${b}\u@\h:$c4\w$c7\$$r "
unset e r b c4 c5 c7
# title
# set the title to user@host:dir
PS1="\[\e]0;\u@\h:\w\a\]$PS1"
# functions
# stat
st() {
find "${1-.}" -maxdepth 1 -printf '%m %u %g %y %P\n' |
sort -V -k 4,5 | column -t -N 'i,u,g,t,n' -l 5 -R 'i,u' -d
}
# readline
bind "set editing-mode vi"
bind "set keyseq-timeout 50"
bind "set show-mode-in-prompt on"
bind "set vi-ins-mode-string \1\e[35m\2+\1\e[0m\2"
bind "set vi-cmd-mode-string :"
# color
case "$TERM" in
foot) export TERMCOLOR=truecolor;;
esac
bind "set keymap vi-command"
bind "j:history-substring-search-forward"
bind "k:history-substring-search-backward"
bind "set keymap vi-insert"
bind '"\e[A":history-substring-search-backward'
bind '"\e[B":history-substring-search-forward'
bind "set show-all-if-ambiguous on"
bind "set completion-display-width 0"
bind "set colored-stats on"
bind "set visible-stats on"
# aliases
# exit
@ -48,9 +46,9 @@ alias ls="ls --color"
alias ll="ls -AFv1 --group-directories-first"
# nvim
alias :e="$EDITOR"
alias :e="nvim"
# bash completion
# enable bash completion in interactive shells
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
@ -58,20 +56,3 @@ if ! shopt -oq posix; then
. /etc/bash_completion
fi
fi
# osc 7
osc7_cwd() {
local strlen=${#PWD}
local encoded=""
local pos c o
for ((pos = 0; pos < strlen; pos++)); do
c=${PWD:$pos:1}
case "$c" in
[-/:_.!\'\(\)~[:alnum:]]) o="${c}" ;;
*) printf -v o '%%%02X' "'${c}" ;;
esac
encoded+="${o}"
done
printf '\e]7;file://%s%s\e\\' "${HOSTNAME}" "${encoded}"
}
PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }osc7_cwd

14
profile
View File

@ -1,11 +1,18 @@
# .profile
# ~/.profile
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ]; then
PATH="$HOME/.local/bin:$PATH"
@ -81,16 +88,11 @@ if [ "$(tty)" = "/dev/tty1" ] && command -v sway &>/dev/null; then
# locale
export LANG=sl_SI.UTF-8
export LC_MESSAGES=en_US.UTF-8
# defaults
export EDITOR=nvim
export VISUAL=nvim
export TERMINAL=footclient
export BROWSER=firefox
# wayland
# export WLR_DRM_NO_ATOMIC=1
# run sway
exec systemd-cat --identifier=sway sway
fi

View File

@ -1,30 +0,0 @@
$include /etc/inputrc
# vi mode
set editing-mode vi
set show-mode-in-prompt on
set vi-ins-mode-string "\1\e[01;31m\2+\1\e[0m\2"
set vi-cmd-mode-string "\1\e[01m\2:\1\e[0m\2"
set keyseq-timeout 50
# history search
$if mode=vi
set keymap vi-command
"j": history-substring-search-forward
"k": history-substring-search-backward
set keymap vi-insert
"\e[A": history-substring-search-backward
"\e[B": history-substring-search-forward
$endif
# faster completion
"\t":menu-complete
"\e[Z":menu-complete-backward
set completion-ignore-case on
set show-all-if-ambiguous on
set completion-display-width 0
# color
set colored-stats on
set visible-stats on

View File

@ -1,21 +0,0 @@
startup_message off
maptimeout 5
# hardstatus
hardstatus off
hardstatus alwayslastline
hardstatus string "%{= b} %S %?%E%{m}%?ESC%{b}%=%?%-Lw%?%{m}%n%f %t%?(%u)%?%{-}%?%+Lw%?%= %D %M %d %c"
# caption
caption always
caption string "%?%F%{= m}%:%{= b}%?%=> %n%f %t%? (%u)%? <%="
# rendition
rendition so "=00"
bind h focus left
bind j focus down
bind k focus up
bind l focus right
altscreen on
nonblock on
termcapinfo foot* ti@:te@