Shell: big overhaul, error fixes, smart rewrite here and there.

Cmus: custom column view.
master
Ambrevar 2012-08-13 17:18:56 +01:00
parent cc8cfb01d2
commit 41bd0f01e8
18 changed files with 801 additions and 1179 deletions

View File

@ -2,5 +2,4 @@
[core] [core]
[extra] [extra]
[community] [community]
[multilib]
[archlinuxfr] [archlinuxfr]

View File

@ -1,15 +1,12 @@
bashmount bashmount
doxymacs-git
dropbox dropbox
dropbox-cli dropbox-cli
emacs-auto-complete-git emacs-mediawiki-bzr
emacs-yasnippet emacs-yasnippet
emacs-yasnippet-latex-git grub
fbpdf-git
guvcview
movgrab movgrab
python-unipath rxvt-unicode-patched
submarine submarine
trash-cli trash-cli
vicious-git urxvt-keyboard-select
wmfs-git vlc-ncurses

View File

@ -1,6 +1,11 @@
abs abs
acpi acpi
alsa-utils alsa-utils
antiword
archlinux-keyring
asciidoc
aspell-en
aspell-fr
atool atool
auctex auctex
autoconf autoconf
@ -12,46 +17,47 @@ bashmount
bc bc
binutils binutils
bison bison
blas
bzip2 bzip2
bzr bzr
calc calc
checkinstall catdvi
clang
claws-mail
cmus cmus
coreutils coreutils
cpufrequtils
crda crda
cronie cronie
cryptsetup cryptsetup
ctags
cyrus-sasl
device-mapper device-mapper
d-feet
dhclient dhclient
dhcpcd dhcpcd
diffutils diffutils
doxymacs-git docbook-xml
docbook-xsl
dosfstools
dropbox dropbox
dropbox-cli dropbox-cli
dvgrab dtach
e2fsprogs e2fsprogs
elfutils elfutils
emacs-auto-complete-git
emacs-lua-mode emacs-lua-mode
emacs-mediawiki-bzr
emacs-nox emacs-nox
emacs-yasnippet emacs-yasnippet
emacs-yasnippet-latex-git expac
evince
fakeroot fakeroot
fbpdf-git farstream
fbv fbv
feh feh
fftw fftw
file file
filesystem filesystem
findutils findutils
firefox
firefox-adblock-plus
flashplugin flashplugin
flex flex
fortune-mod
gawk gawk
gcc gcc
gcc-libs gcc-libs
@ -59,148 +65,209 @@ gcolor2
gdb gdb
gettext gettext
gimp gimp
git
glibc glibc
gnome-themes-standard
gnumeric
gnuplot gnuplot
gparted gparted
gpicview
gprolog gprolog
graphicsmagick
grep grep
grub grub
gtk-aurora-engine gsasl
gtk-engines gstreamer0.10-bad
guvcview gstreamer0.10-bad-plugins
gstreamer0.10-ffmpeg
gstreamer0.10-good
gstreamer0.10-python
gzip gzip
hdparm hdparm
heirloom-mailx heirloom-mailx
help2man
highlight highlight
htop htop
hunspell-en hunspell-en
hunspell-fr hunspell-fr
hwids
ifplugd ifplugd
indent
inetutils inetutils
initscripts initscripts
inkscape inkscape
iptables
iputils iputils
irssi
ispell
jansson
jfsutils jfsutils
jre7-openjdk khrplatform-devel
ladspa ladspa
laptop-mode-tools
latex2html latex2html
latex2rtf latex2rtf
less less
lib32-v4l-utils
libaio libaio
libavc1394 libavc1394
libcdaudio
libdc1394
libdvdcss
libdvdnav
libdvdread
libegl
libevent
libgme
liblqr
liblrdf
libmediainfo
libmicrohttpd
libmms
libnice
libofa
libpipeline libpipeline
libquicktime libpurple
libstdc++5 libstdc++5
libsystemd
libtool libtool
libusbx
libzen
licenses licenses
liferea lighttpd
links
linux linux
linux-lts linux-lts
logrotate logrotate
lrzip
lshw lshw
ltrace
luakit
lvm2 lvm2
lxde-icon-theme
lxterminal lxterminal
lzo2
m4 m4
make make
man-db man-db
man-pages man-pages
mdadm mdadm
midori mediainfo
mercurial
mjpegtools
movgrab movgrab
mplayer mplayer2
mtools
musicbrainz
mutt
nano nano
nasm
ncdu ncdu
nmap nmap
ntfs-3g ntfs-3g
ntfsprogs ntfsprogs
numlockx numlockx
openslp
openssh openssh
p7zip p7zip
pacman pacman
pacman-color pacman-color
pambase
pari
patch patch
pciutils pciutils
pcmciautils pcmciautils
pdksh
perl perl
perl-locale-gettext
pidgin
pkg-config pkg-config
pkgfile
pkgtools pkgtools
postfix
ppp ppp
procps procps-ng
psmisc psmisc
pstoedit
pwgen pwgen
pwsafe
python2-dbus
python2-udiskie
python-configobj
python-dbus-common
python-notify
python-pycurl
ranger ranger
raptor
reiserfsprogs reiserfsprogs
rpmextract
rtorrent rtorrent
rxvt-unicode rxvt-unicode-patched
screen
scrot scrot
sdparm
sed sed
shadow shadow
skype slock
soundtouch
splint splint
strace
submarine submarine
subversion subversion
sudo sudo
sxiv
sysfsutils sysfsutils
syslog-ng syslog-ng
sysstat sysstat
systemd-tools
sysvbanner
sysvinit sysvinit
tar tar
task task
tcpdump
texi2html
texinfo texinfo
texlive-genericextra texlive-genericextra
texlive-langextra texlive-langextra
texlive-latexextra texlive-latexextra
texlive-pictures texlive-pictures
texlive-science texlive-science
thunderbird
trash-cli trash-cli
tree tree
ttf-dejavu ttf-dejavu
udev
unrar unrar
unzip unzip
upx upx
urxvt-keyboard-select
usbutils usbutils
util-linux util-linux
valgrind valgrind
vi vi
vicious-git vicious
vim
vim-runtime
vlc-ncurses
vlock vlock
w3m
weechat
wget wget
which which
wildmidi
wipe
wireless_tools wireless_tools
wmfs-git wireshark-cli
wireshark-gtk
wmname wmname
wpa_actiond wpa_actiond
wpa_supplicant wpa_supplicant
wv
xclip xclip
xcursor-vanilla-dmz-aa
xf86-input-synaptics xf86-input-synaptics
xf86-video-ati xf86-video-ati
xf86-video-vesa xf86-video-vesa
xfconf
xfsprogs xfsprogs
xkeycaps
xorg-server xorg-server
xorg-utils xorg-twm
xorg-xdm xorg-xev
xorg-xinit xorg-xinit
xorg-xmessage
xorg-xmodmap xorg-xmodmap
xorg-xrandr xorg-xrandr
xpdf xorg-xrdb
xscreensaver
xsel xsel
yaourt yaourt
zenity zathura
zathura-djvu
zathura-pdf-poppler
zathura-ps
zip
zsh zsh

View File

@ -113,7 +113,6 @@ mediainfo
mencoder mencoder
mercurial mercurial
mesa-demos mesa-demos
midori
mongoose mongoose
movgrab movgrab
mplayer2 mplayer2

View File

@ -5,9 +5,14 @@ acl
acpi acpi
alsa-lib alsa-lib
alsa-utils alsa-utils
antiword
apr apr
apr-util apr-util
archlinux-keyring
asciidoc
aspell aspell
aspell-en
aspell-fr
ati-dri ati-dri
atk atk
atkmm atkmm
@ -24,49 +29,46 @@ bash-completion
bc bc
binutils binutils
bison bison
blas
bluez
bzip2 bzip2
bzr bzr
ca-certificates ca-certificates
ca-certificates-java cairo
cairomm cairomm
cairo-xcb
calc calc
cantarell-fonts catdvi
cdparanoia cdparanoia
checkinstall
cifs-utils
clang
claws-mail
cloog cloog
cmus cmus
colord
compositeproto compositeproto
consolekit
coreutils coreutils
cpufrequtils
cracklib cracklib
crda crda
cronie cronie
cryptsetup cryptsetup
ctags
curl curl
cyrus-sasl
damageproto damageproto
db db
dbus dbus
dbus-core dbus-core
dbus-glib dbus-glib
dconf
desktop-file-utils desktop-file-utils
device-mapper device-mapper
d-feet
dhclient dhclient
dhcpcd dhcpcd
dialog dialog
diffutils diffutils
dirmngr dirmngr
djvulibre djvulibre
dmxproto dnssec-anchors
docbook-xml
docbook-xsl
dosfstools
dri2proto dri2proto
dvgrab dtach
e2fsprogs e2fsprogs
eject eject
elfutils elfutils
@ -75,11 +77,12 @@ emacs-nox
enca enca
enchant enchant
eventlog eventlog
evince expac
expat expat
faac faac
faad2 faad2
fakeroot fakeroot
farstream
fbv fbv
feh feh
ffmpeg ffmpeg
@ -87,14 +90,13 @@ fftw
file file
filesystem filesystem
findutils findutils
firefox
firefox-adblock-plus
fixesproto fixesproto
flac flac
flashplugin flashplugin
flex flex
fontconfig fontconfig
fontsproto fontsproto
fortune-mod
freeglut freeglut
freetype2 freetype2
fribidi fribidi
@ -104,17 +106,19 @@ gc
gcc gcc
gcc-libs gcc-libs
gcolor2 gcolor2
gconf
gd gd
gdb gdb
gdbm gdbm
gdk-pixbuf2 gdk-pixbuf2
gegl gegl
geoclue
gettext gettext
ghostscript ghostscript
giblib giblib
giflib giflib
gimp gimp
girara-common
girara-gtk2
git git
glib2 glib2
glibc glibc
@ -122,38 +126,36 @@ glibmm
glib-networking glib-networking
glproto glproto
gmp gmp
gnome-icon-theme
gnome-icon-theme-symbolic
gnome-themes-standard
gnumeric
gnupg gnupg
gnuplot gnuplot
gnutls gnutls
goffice
gparted gparted
gpgme gpgme
gpicview
gpm gpm
gprolog gprolog
graphicsmagick
grep grep
groff groff
grub gsasl
gsettings-desktop-schemas gsettings-desktop-schemas
gsfonts gsfonts
gsl gsl
gsm gsm
gstreamer0.10 gstreamer0.10
gstreamer0.10-bad
gstreamer0.10-bad-plugins
gstreamer0.10-base gstreamer0.10-base
gstreamer0.10-ffmpeg
gstreamer0.10-good
gstreamer0.10-python
gtk2 gtk2
gtk3
gtk-aurora-engine
gtk-engines
gtkmm gtkmm
gtkspell gtkspell
gtk-update-icon-cache gtk-update-icon-cache
gzip gzip
hdparm hdparm
heirloom-mailx heirloom-mailx
help2man
hicolor-icon-theme hicolor-icon-theme
highlight highlight
hspell hspell
@ -161,84 +163,45 @@ htop
hunspell hunspell
hunspell-en hunspell-en
hunspell-fr hunspell-fr
hwids
iana-etc iana-etc
icon-naming-utils
icu icu
ifplugd ifplugd
imagemagick imagemagick
imlib2 imlib2
indent
inetutils inetutils
initscripts initscripts
inkscape inkscape
inputproto inputproto
iproute2 iproute2
iptables
iputils iputils
irssi
isl isl
ispell
iw iw
jack jack
jansson
jasper jasper
jbig2dec
jfsutils jfsutils
jre7-openjdk
jre7-openjdk-headless
json-c json-c
json-glib
kbd kbd
kbproto kbproto
keyutils keyutils
khrplatform-devel
kmod kmod
krb5 krb5
ladspa ladspa
lame lame
laptop-mode-tools
latex2html latex2html
latex2rtf latex2rtf
lcms lcms
lcms2 lcms2
ldns
less less
lesstif
lib32-alsa-lib
lib32-bzip2
lib32-dbus-core
lib32-expat
lib32-fontconfig
lib32-freetype2
lib32-gcc-libs
lib32-glib2
lib32-glibc
lib32-libdrm
lib32-libffi
lib32-libgl
lib32-libglapi
lib32-libice
lib32-libjpeg-turbo
lib32-libmng
lib32-libpciaccess
lib32-libpng
lib32-libsm
lib32-libtiff
lib32-libx11
lib32-libxau
lib32-libxcb
lib32-libxcursor
lib32-libxdamage
lib32-libxdmcp
lib32-libxext
lib32-libxfixes
lib32-libxi
lib32-libxrandr
lib32-libxrender
lib32-libxss
lib32-libxv
lib32-libxxf86vm
lib32-openssl
lib32-pcre
lib32-qt
lib32-sqlite3
lib32-util-linux
lib32-v4l-utils
lib32-zlib
libaio libaio
libao
libarchive libarchive
libass libass
libassuan libassuan
@ -248,19 +211,22 @@ libavc1394
libbluray libbluray
libcaca libcaca
libcap libcap
libcap-ng libcdaudio
libcddb libcddb
libcdio libcdio
libcroco libcroco
libcups libcups
libdaemon libdaemon
libdatrie libdatrie
libdc1394
libdca libdca
libdmx
libdrm libdrm
libdv libdv
libdvdcss
libdvdnav
libdvdread
libedit libedit
libetpan libegl
libev libev
libevent libevent
libexif libexif
@ -272,31 +238,33 @@ libgee
libgl libgl
libglade libglade
libglapi libglapi
libgnome-keyring libgme
libgpg-error libgpg-error
libgphoto2
libgsf libgsf
libgssglue libgssglue
libgusb
libice libice
libid3tag libid3tag
libiec61883 libidn
libieee1284
libirman libirman
libjpeg-turbo libjpeg-turbo
libksba libksba
libldap libldap
liblqr
liblrdf
libltdl libltdl
libmad libmad
libmikmod libmediainfo
libmicrohttpd
libmms
libmng libmng
libmodplug libmodplug
libmp4v2 libmp4v2
libmpc libmpc
libmpcdec libmpcdec
libmysqlclient libnice
libnl libnl
libnotify libnotify
libofa
libogg libogg
libpcap libpcap
libpciaccess libpciaccess
@ -304,7 +272,7 @@ libpipeline
libpng libpng
libproxy libproxy
libpulse libpulse
libquicktime libpurple
libraw1394 libraw1394
librsvg librsvg
libsamplerate libsamplerate
@ -317,6 +285,7 @@ libsoup
libspectre libspectre
libssh2 libssh2
libstdc++5 libstdc++5
libsystemd
libtasn1 libtasn1
libthai libthai
libtheora libtheora
@ -325,13 +294,12 @@ libtirpc
libtool libtool
libtorrent libtorrent
libunique libunique
libusb
libusb-compat libusb-compat
libusbx
libva libva
libvdpau libvdpau
libvorbis libvorbis
libvpx libvpx
libwbclient
libwebkit libwebkit
libwmf libwmf
libx11 libx11
@ -344,7 +312,6 @@ libxdamage
libxdg-basedir libxdg-basedir
libxdmcp libxdmcp
libxext libxext
libxfce4util
libxfixes libxfixes
libxfont libxfont
libxft libxft
@ -353,7 +320,6 @@ libxinerama
libxkbfile libxkbfile
libxml2 libxml2
libxmu libxmu
libxp
libxpm libxpm
libxrandr libxrandr
libxrender libxrender
@ -362,49 +328,56 @@ libxss
libxt libxt
libxtst libxtst
libxv libxv
libxvmc
libxxf86dga libxxf86dga
libxxf86vm libxxf86vm
libzen
licenses licenses
liferea lighttpd
links
linux linux
linux-api-headers linux-api-headers
linux-firmware linux-firmware
linux-lts linux-lts
lirc-utils lirc-utils
llvm
lm_sensors lm_sensors
logrotate logrotate
lrzip
lshw lshw
lsof lsof
ltrace
lua lua
luafilesystem
luajit
luakit
lvm2 lvm2
lxde-icon-theme
lxterminal lxterminal
lzo2
m4 m4
make make
man-db man-db
man-pages man-pages
mcpp mcpp
mdadm mdadm
mediainfo
mercurial
mesa mesa
midori
mime-types mime-types
mjpegtools
mkinitcpio mkinitcpio
mkinitcpio-busybox mkinitcpio-busybox
mozilla-common mozilla-common
mpfr mpfr
mpg123 mpg123
mplayer mplayer2
mtdev mtdev
mupdf mtools
musicbrainz
mutt
nano nano
nasm
ncdu ncdu
ncurses ncurses
neon neon
netpbm netpbm
net-snmp
nettle nettle
net-tools net-tools
nmap nmap
@ -415,6 +388,7 @@ ntfsprogs
numlockx numlockx
opencore-amr opencore-amr
openjpeg openjpeg
openslp
openssh openssh
openssl openssl
orc orc
@ -425,106 +399,91 @@ pacman
pacman-color pacman-color
pacman-mirrorlist pacman-mirrorlist
pam pam
pambase
pango pango
pangomm pangomm
pari
parted parted
patch patch
pciutils pciutils
pcmciautils pcmciautils
pcre pcre
pdksh
perl perl
perl-encode-locale
perl-error perl-error
perl-file-listing perl-locale-gettext
perl-html-parser pidgin
perl-html-tagset
perl-http-cookies
perl-http-daemon
perl-http-date
perl-http-message
perl-http-negotiate
perl-libwww
perl-lwp-mediatypes
perl-net-http
perl-uri
perl-www-robotrules
perl-xml-parser
perl-xml-simple
pilot-link
pinentry pinentry
pixman pixman
pkg-config pkg-config
pkgfile
pkgtools pkgtools
plotutils
polkit polkit
poppler poppler
poppler-data poppler-data
poppler-glib poppler-glib
popt popt
portaudio
postfix
postgresql-libs
ppl ppl
ppp ppp
printproto procps-ng
procps
psmisc psmisc
pstoedit
pth pth
pwgen pwgen
pwsafe
pygobject2-devel pygobject2-devel
pygtk pygtk
python python
python2 python2
python2-cairo python2-cairo
python2-dbus
python2-distribute python2-distribute
python2-gobject2 python2-gobject2
qt python2-udiskie
python-configobj
python-dbus-common
python-notify
python-pycurl
randrproto randrproto
ranger ranger
raptor
readline readline
recode recode
recordproto recordproto
reiserfsprogs reiserfsprogs
renderproto renderproto
rhino
rpmextract
rsync rsync
rtmpdump rtmpdump
rtorrent rtorrent
run-parts run-parts
rxvt-unicode
sane
schroedinger schroedinger
screen
scrnsaverproto scrnsaverproto
scrot scrot
sdl sdl
sdl_mixer sdparm
sed sed
sg3_utils sg3_utils
shadow shadow
shared-color-profiles
shared-mime-info shared-mime-info
skype slock
smbclient soundtouch
smpeg
speex speex
splint splint
sqlite sqlite
startup-notification startup-notification
strace
subversion subversion
sudo sudo
sxiv
sysfsutils sysfsutils
syslog-ng syslog-ng
sysstat sysstat
systemd-tools
sysvbanner
sysvinit sysvinit
t1lib t1lib
talloc
tar tar
task task
tdb tcpdump
texi2html
texinfo texinfo
texlive-bin texlive-bin
texlive-core texlive-core
@ -533,11 +492,9 @@ texlive-langextra
texlive-latexextra texlive-latexextra
texlive-pictures texlive-pictures
texlive-science texlive-science
thunderbird
tree tree
ttf-dejavu ttf-dejavu
tzdata tzdata
udev
udisks udisks
unixodbc unixodbc
unrar unrar
@ -548,18 +505,27 @@ util-linux
v4l-utils v4l-utils
valgrind valgrind
vi vi
vicious
videoproto videoproto
vim
vim-runtime
vlock vlock
vte vte
vte-common vte-common
wavpack w3m
weechat
wget wget
which which
wildmidi
wipe
wireless-regdb wireless-regdb
wireless_tools wireless_tools
wireshark-cli
wireshark-gtk
wmname wmname
wpa_actiond wpa_actiond
wpa_supplicant wpa_supplicant
wv
wxgtk wxgtk
x264 x264
xcb-proto xcb-proto
@ -568,7 +534,6 @@ xcb-util-image
xcb-util-keysyms xcb-util-keysyms
xcb-util-wm xcb-util-wm
xclip xclip
xcursor-vanilla-dmz-aa
xdg-utils xdg-utils
xextproto xextproto
xf86dgaproto xf86dgaproto
@ -577,13 +542,10 @@ xf86-input-synaptics
xf86-video-ati xf86-video-ati
xf86-video-vesa xf86-video-vesa
xf86vidmodeproto xf86vidmodeproto
xfconf
xfsprogs xfsprogs
xineramaproto xineramaproto
xkeyboard-config xkeyboard-config
xkeycaps
xmlrpc-c xmlrpc-c
xorg-appres
xorg-bdftopcf xorg-bdftopcf
xorg-fonts-alias xorg-fonts-alias
xorg-fonts-encodings xorg-fonts-encodings
@ -594,34 +556,28 @@ xorg-mkfontdir
xorg-mkfontscale xorg-mkfontscale
xorg-server xorg-server
xorg-server-common xorg-server-common
xorg-sessreg
xorg-setxkbmap xorg-setxkbmap
xorg-utils xorg-twm
xorg-xauth xorg-xauth
xorg-xdm
xorg-xdpyinfo
xorg-xdriinfo
xorg-xev xorg-xev
xorg-xinit xorg-xinit
xorg-xkbcomp xorg-xkbcomp
xorg-xlsatoms xorg-xmessage
xorg-xlsclients
xorg-xmodmap xorg-xmodmap
xorg-xprop
xorg-xrandr xorg-xrandr
xorg-xrdb xorg-xrdb
xorg-xset xorg-xset
xorg-xvinfo
xorg-xwininfo
xpdf
xproto xproto
xscreensaver
xsel xsel
xvidcore xvidcore
xz xz
yajl yajl
yaourt yaourt
zenity zathura
zathura-djvu
zathura-pdf-poppler
zathura-ps
zip
zlib zlib
zsh zsh
zziplib zziplib

View File

@ -364,7 +364,6 @@ mencoder
mercurial mercurial
mesa mesa
mesa-demos mesa-demos
midori
mime-types mime-types
mjpegtools mjpegtools
mkinitcpio mkinitcpio

35
.bashrc
View File

@ -1,6 +1,6 @@
################################################################################ ################################################################################
## Shell Config -- Master File ## Shell Config -- Master File
## Date 2012-07-02 ## Date 2012-08-11
################################################################################ ################################################################################
##============================================================================== ##==============================================================================
@ -8,31 +8,20 @@
##============================================================================== ##==============================================================================
[ -z "$PS1" ] && return [ -z "$PS1" ] && return
##==============================================================================
## Base functions
##==============================================================================
isShell()
{
if [ "$1" = "$(ps | grep $$ | awk '{print $4}')" ]; then
return 0
else
return 1
fi
}
##============================================================================== ##==============================================================================
## Sourcing ## Sourcing
##============================================================================== ##==============================================================================
SHELLDIR="$HOME/.shell.d" SHELL_CURRENT="$(ps | awk -v shellpid=$$ '$0 ~ shellpid {print $4}')"
SHELL_DIR="$HOME/.shell.d"
source "${SHELLDIR}/main_rc" # Should be sourced first. ## Should be sourced first.
source "${SHELLDIR}/options_bash" # Should be sourced first. source "${SHELL_DIR}/main_rc"
source "${SHELLDIR}/colors_rc" # Should be sourced first. source "${SHELL_DIR}/colors_bash"
source "${SHELL_DIR}/options_bash"
source "${SHELLDIR}/funs_rc" ## Source order should not matter.
source "${SHELLDIR}/funs_bash" source "${SHELL_DIR}/alias_rc"
source "${SHELLDIR}/alias_rc" source "${SHELL_DIR}/funs_rc"
source "${SHELLDIR}/personal_rc" source "${SHELL_DIR}/funs_bash"
source "${SHELL_DIR}/personal_rc"

View File

@ -1,4 +1,4 @@
set aaa_mode=album set aaa_mode=all
set altformat_current= %F set altformat_current= %F
set altformat_playlist= %f%= %d set altformat_playlist= %f%= %d
set altformat_title=%f set altformat_title=%f
@ -33,11 +33,11 @@ set continue=true
set display_artist_sort_name=false set display_artist_sort_name=false
set dsp.alsa.device=default set dsp.alsa.device=default
set dsp.oss.device= set dsp.oss.device=
set format_current= %a - %l -%3n. %t%= %y set format_current= %a - %y. %l -%3n. %t
set format_playlist= %-25%a %3n. %t%= %y %d set format_playlist= %-18%a %y. %-25%l %3n. %t%= %d
set format_playlist_va= %-25%A %3n. %t (%a)%= %y %d set format_playlist_va= %-25%A %3n. %t (%a)%= %y %d
set format_title=%a - %l - %t (%y) set format_title=%a - %y. %l -%3n. %t
set format_trackwin=%3n. %t%= %y %d set format_trackwin=%y %3n. %t%= %d [%{codec} %{bitrate} kbps]
set format_trackwin_va=%3n. %t (%a)%= %y %d set format_trackwin_va=%3n. %t (%a)%= %y %d
set id3_default_charset=ISO-8859-1 set id3_default_charset=ISO-8859-1
set lib_sort=albumartist date album discnumber tracknumber title filename set lib_sort=albumartist date album discnumber tracknumber title filename
@ -49,7 +49,7 @@ set mixer.pulse.restore_volume=1
set output_plugin=alsa set output_plugin=alsa
set passwd= set passwd=
set pl_sort= set pl_sort=
set play_library=false set play_library=true
set play_sorted=false set play_sorted=false
set repeat=false set repeat=false
set repeat_current=false set repeat_current=false
@ -60,7 +60,7 @@ set resume=true
set set_term_title=true set set_term_title=true
set show_hidden=false set show_hidden=false
set show_remaining_time=false set show_remaining_time=false
set shuffle=false set shuffle=true
set smart_artist_sort=true set smart_artist_sort=true
set softvol=false set softvol=false
set softvol_state=0 0 set softvol_state=0 0

3
.save
View File

@ -196,6 +196,9 @@ do
FILELIST=(${FILELIST[*]} "$i") FILELIST=(${FILELIST[*]} "$i")
done done
## README
FILELIST=(${FILELIST[*]} "README")
## rtorrent ## rtorrent
FILELIST=(${FILELIST[*]} ".rtorrent.rc") FILELIST=(${FILELIST[*]} ".rtorrent.rc")

View File

@ -8,39 +8,35 @@
## General ## General
##============================================================================== ##==============================================================================
# Warning: if this does not work if you change of shell without relogging, use ## Warning: if this does not work if you change shell without relogging, use
# 'source .[shell]rc' instead. ## 'source .<shell>rc' instead.
if isShell "bash"; then
if [ "bash" = "$SHELL_CURRENT" ]; then
alias ..='cd ..' alias ..='cd ..'
alias esrc='$EDITOR ~/.bashrc' alias esrc='$EDITOR ~/.bashrc'
alias ssrc='source ~/.bashrc' alias ssrc='source ~/.bashrc'
fi fi
if isShell "zsh"; then if [ "zsh" = "$SHELL_CURRENT" ]; then
alias esrc='$EDITOR ~/.zshrc' alias esrc='$EDITOR ~/.zshrc'
alias ssrc='source ~/.zshrc' alias ssrc='source ~/.zshrc'
fi fi
## Enable color support of ls and also add handy aliases.
if [ "$TERM" != "dumb" ]; then
eval "`dircolors -b`"
fi
##============================================================================== ##==============================================================================
##============================================================================== ##==============================================================================
## 'ls' redefinition ## 'ls' redefinition
alias ls='ls --color=auto -F -v' alias ls='ls --color=auto -F -v'
## Listing aliases ## Listing aliases.
alias l='ls -1' alias l='ls -1'
alias la='ls -lAh --group-directories-first' # Hidden files alias la='ls -lAh --group-directories-first' # Hidden files
alias lc='ls -ltcrh --group-directories-first' # by change time alias lc='ls -ltcrh --group-directories-first' # by change time
alias lk='ls -lSrh --group-directories-first' # by size alias lk='ls -lSrh --group-directories-first' # by size
alias ll='ls -lh --group-directories-first' # Detailed view with human readable values. alias ll='ls -lh --group-directories-first' # Detailed view with human readable values.
alias lx='ls -lXh --group-directories-first' # sort by extension alias lx='ls -lXh --group-directories-first' # sort by extension
# Misc ## Misc
alias cp="cp -i" # confirm before overwriting something alias cp="cp -i" # confirm before overwriting something
alias xlx='xrdb -load ~/.Xresources' alias xlx='xrdb -load ~/.Xresources'
alias grep='grep --color=auto' alias grep='grep --color=auto'
@ -51,36 +47,36 @@ if [ -e "/usr/bin/emacs" ]; then
alias emacs-reload="emacsclient -e '(kill-emacs)' >/dev/null 2>&1; /usr/bin/emacs --daemon" alias emacs-reload="emacsclient -e '(kill-emacs)' >/dev/null 2>&1; /usr/bin/emacs --daemon"
fi fi
# List desktop applications # List desktop applications.
alias applist='grep -r "^Name=" /usr/share/applications/* | cut -d'=' -f2| sort' alias applist='grep -r "^Name=" /usr/share/applications/* | cut -d'=' -f2| sort'
## Remove executable attribute ## Remove executable attribute.
alias nox='find . -type f -exec chmod a-x {} \;' alias nox='find . -type f -exec chmod a-x {} \;'
## Get your external IP ## Get your external IP.
[ -e "/usr/bin/curl" ] && alias myip='curl ifconfig.me' [ -e "/usr/bin/curl" ] && alias myip='curl ifconfig.me'
## Network discovery ## Network discovery.
[ -e "/usr/bin/nmap" ] && alias netdiscover='nmap -sP "192.168.1.*"' [ -e "/usr/bin/nmap" ] && alias network-discover='nmap -sP "192.168.1.*"'
# Prevents accidentally clobbering files. ## Prevents accidentally clobbering files.
alias mkdir='mkdir -p' alias mkdir='mkdir -p'
# Reset terminal -- Faster alternative of 'reset' ## Reset terminal -- Faster alternative of 'reset'.
alias cls='printf "\ec"' alias cls='printf "\ec"'
# Display PATH and LD_LIBRARY_PATH in a more readable way ## Display PATH and LD_LIBRARY_PATH in a more readable way.
alias echopath='echo -e ${PATH//:/\\n}' alias echopath='echo -e ${PATH//:/\\n}'
alias echolibpath='echo -e ${LD_LIBRARY_PATH//:/\\n}' alias echolibpath='echo -e ${LD_LIBRARY_PATH//:/\\n}'
## Shutdown / Reboot ## Shutdown / Reboot.
## Will only work with consolekit and dbus daemons running. ## If you do not want to get prompted for your password, configure sudo properly.
if [ -e "/usr/bin/dbus-send" ]; then if [ -e "/usr/bin/dbus-send" ]; then
alias halt='sudo halt' alias halt='sudo halt'
alias reboot='sudo reboot' alias reboot='sudo reboot'
fi fi
## Start X and lock current terminal (press ENTER when back in terminal to prompt for password) ## Start X and lock current terminal (press ENTER when back in terminal to prompt for password).
[ -e "/usr/bin/vlock" ] && alias sx='startx & vlock' [ -e "/usr/bin/vlock" ] && alias sx='startx & vlock'
## Screensaver ## Screensaver
@ -89,9 +85,6 @@ fi
## Zathura -- Fork to background. ## Zathura -- Fork to background.
[ -e "/usr/bin/zathura" ] && alias zat='zathura --fork' [ -e "/usr/bin/zathura" ] && alias zat='zathura --fork'
## Configuration files
[ -e "/etc/rc.conf" ] && alias ercc='sudo $EDITOR /etc/rc.conf'
## Xrandr ## Xrandr
alias xmulti='xrandr --output VGA1 --auto --right-of $(xrandr | grep -A1 current | sed -n 2p | awk '"'"'{print $1}'"'"')' alias xmulti='xrandr --output VGA1 --auto --right-of $(xrandr | grep -A1 current | sed -n 2p | awk '"'"'{print $1}'"'"')'
alias xmultioff="xrandr --output VGA1 --off" alias xmultioff="xrandr --output VGA1 --off"
@ -104,7 +97,7 @@ alias xmorphzi='xrandr --output $(xrandr | grep -A1 current | sed -n 2p | awk '"
## Zsh power aliases ## Zsh power aliases
##============================================================================== ##==============================================================================
# if isShell "zsh"; then #if [ "zsh" = "$SHELL_CURRENT" ]; then
## Inline aliases, zsh -g aliases can be anywhere in command line ## Inline aliases, zsh -g aliases can be anywhere in command line
#alias -g G='| grep -' #alias -g G='| grep -'
#alias -g L='| less' #alias -g L='| less'
@ -117,46 +110,49 @@ alias xmorphzi='xrandr --output $(xrandr | grep -A1 current | sed -n 2p | awk '"
##============================================================================== ##==============================================================================
## Pacman aliases ## Pacman aliases
##============================================================================== ##==============================================================================
[ -e "/usr/bin/pacman" ] && PACMAN_FRONTEND='pacman' if [ -e "/usr/bin/pacman" ] ; then
## Use of Pacman-Color PACMAN_FRONTEND='pacman'
if [ -e "/usr/bin/pacman-color" ]; then
PACMAN_FRONTEND='pacman-color'
if isShell "zsh" ; then ## Use of Pacman-Color
compdef _pacman pacman-color if [ -e "/usr/bin/pacman-color" ]; then
elif isShell "bash"; then PACMAN_FRONTEND='pacman-color'
complete -o default -o nospace -F _pacman pacman-color
if [ "zsh" = "$SHELL_CURRENT" ]; then
compdef _pacman pacman-color
elif [ "bash" = "$SHELL_CURRENT" ]; then
complete -o default -o nospace -F _pacman pacman-color
fi
fi fi
fi
## Pacman aliases ## Pacman aliases
if [ "$PACMAN_FRONTEND" = "pacman" ]; then if [ "$PACMAN_FRONTEND" = "pacman" ]; then
alias pc='sudo pacman -Scc' alias pc='sudo pacman -Scc'
alias pi='sudo pacman -S --needed' alias pi='sudo pacman -S --needed'
alias pqi='pacman -Qi' alias pqi='pacman -Qi'
alias pql='pacman -Ql' alias pql='pacman -Ql'
alias pqo='pacman -Qo' alias pqo='pacman -Qo'
alias pqs='pacman -Qs' alias pqs='pacman -Qs'
alias pr='sudo pacman -Rs' alias pr='sudo pacman -Rs'
alias psi='pacman -Si' alias psi='pacman -Si'
alias pss='pacman -Ss' alias pss='pacman -Ss'
alias pu='sudo pacman -Syu' alias pu='sudo pacman -Syu'
fi fi
if [ "$PACMAN_FRONTEND" = "pacman-color" ]; then if [ "$PACMAN_FRONTEND" = "pacman-color" ]; then
alias pc='sudo pacman-color -Scc' alias pc='sudo pacman-color -Scc'
alias pi='sudo pacman -S --needed' alias pi='sudo pacman -S --needed'
alias pqi='pacman-color -Qi' alias pqi='pacman-color -Qi'
alias pql='pacman-color -Ql' alias pql='pacman-color -Ql'
alias pqo='pacman-color -Qo' alias pqo='pacman-color -Qo'
alias pqs='pacman-color -Qs' alias pqs='pacman-color -Qs'
alias pr='sudo pacman-color -Rs' alias pr='sudo pacman-color -Rs'
alias psi='pacman-color -Si' alias psi='pacman-color -Si'
alias pss='pacman-color -Ss' alias pss='pacman-color -Ss'
alias pu='sudo pacman-color -Syu' alias pu='sudo pacman-color -Syu'
fi fi
fi
##============================================================================== ##==============================================================================
## TeXlive aliases ## TeXlive aliases

View File

@ -1,77 +0,0 @@
## -*- mode:sh -*- #
##==============================================================================
## Colors for universal support
##==============================================================================
## Reset
Color_Off='\e[0m' # Text Reset
## Regular Colors
Black='\e[0;30m' # Black
Red='\e[0;31m' # Red
Green='\e[0;32m' # Green
Yellow='\e[0;33m' # Yellow
Blue='\e[0;34m' # Blue
Purple='\e[0;35m' # Purple
Cyan='\e[0;36m' # Cyan
White='\e[0;37m' # White
## Bold
BBlack='\e[1;30m' # Black
BRed='\e[1;31m' # Red
BGreen='\e[1;32m' # Green
BYellow='\e[1;33m' # Yellow
BBlue='\e[1;34m' # Blue
BPurple='\e[1;35m' # Purple
BCyan='\e[1;36m' # Cyan
BWhite='\e[1;37m' # White
## Underline
UBlack='\e[4;30m' # Black
URed='\e[4;31m' # Red
UGreen='\e[4;32m' # Green
UYellow='\e[4;33m' # Yellow
UBlue='\e[4;34m' # Blue
UPurple='\e[4;35m' # Purple
UCyan='\e[4;36m' # Cyan
UWhite='\e[4;37m' # White
## Background
On_Black='\e[40m' # Black
On_Red='\e[41m' # Red
On_Green='\e[42m' # Green
On_Yellow='\e[43m' # Yellow
On_Blue='\e[44m' # Blue
On_Purple='\e[45m' # Purple
On_Cyan='\e[46m' # Cyan
On_White='\e[47m' # White
## High Intensty
IBlack='\e[0;90m' # Black
IRed='\e[0;91m' # Red
IGreen='\e[0;92m' # Green
IYellow='\e[0;93m' # Yellow
IBlue='\e[0;94m' # Blue
IPurple='\e[0;95m' # Purple
ICyan='\e[0;96m' # Cyan
IWhite='\e[0;97m' # White
## Bold High Intensty
BIBlack='\e[1;90m' # Black
BIRed='\e[1;91m' # Red
BIGreen='\e[1;92m' # Green
BIYellow='\e[1;93m' # Yellow
BIBlue='\e[1;94m' # Blue
BIPurple='\e[1;95m' # Purple
BICyan='\e[1;96m' # Cyan
BIWhite='\e[1;97m' # White
## High Intensty backgrounds
On_IBlack='\e[0;100m' # Black
On_IRed='\e[0;101m' # Red
On_IGreen='\e[0;102m' # Green
On_IYellow='\e[0;103m' # Yellow
On_IBlue='\e[0;104m' # Blue
On_IPurple='\e[10;95m' # Purple
On_ICyan='\e[0;106m' # Cyan
On_IWhite='\e[0;107m' # White

View File

@ -1,175 +1,177 @@
## -*- mode:sh -*- # ## -*- mode:sh -*- #
################################################################################ ################################################################################
## Bash specific functions ## Bash specific functions
## WARNING: this file needs a serious update and rewrite!
################################################################################ ################################################################################
if isShell "bash"; then
##============================================================================== ##==============================================================================
## Browse History ## Browse History
##============================================================================== ##==============================================================================
# Parameters usage -- should be set before sourcing the function.
## Parameters usage -- should be set before sourcing the function.
if [ -d "$SHELLDIR" ]; then
BHISTORY="${SHELLDIR}/bhistory"
else
BHISTORY="$HOME/.bhistory"
fi
BHISTFILESIZE=20
BHISTREVERT=true
BHISTLOADLAST=true
## Where to store the history file.
if [ "$BHISTORY" == "" ]; then
if [ -d "$SHELLDIR" ]; then if [ -d "$SHELLDIR" ]; then
BHISTORY="${SHELLDIR}/bhistory" BHISTORY="${SHELLDIR}/bhistory"
else else
BHISTORY="$HOME/.bhistory" BHISTORY="$HOME/.bhistory"
fi fi
BHISTFILESIZE=20 fi
BHISTREVERT=true
BHISTLOADLAST=true ## History prompted to the user.
## BHISTFILESIZE +1 entry are stored, the additional one
## is for the current directory to be remembered for new session.
[ "$BHISTFILESIZE" == "" ] && BHISTFILESIZE=20
## If true, first listed is last browsed.
[ "$BHISTREVERT" == "" ] && BHISTREVERT=true
## Go back to previous folder when starting a new session.
[ "$BHISTLOADLAST" == "" ] && BHISTLOADLAST=true
# Where to store the history file. ## Prevent infinite recursiveness when sourcing multiple times.
if [ "$BHISTORY" == "" ]; then unalias cd>/dev/null 2>&1
if [ -d "$SHELLDIR" ]; then
BHISTORY="${SHELLDIR}/bhistory"
else
BHISTORY="$HOME/.bhistory"
fi
fi
# History prompted to the user.
# BHISTFILESIZE +1 entry are stored, the additional one
# is for the current directory to be remembered for new session.
[ "$BHISTFILESIZE" == "" ] && BHISTFILESIZE=20
# If true, first listed is last browsed. ## SEED is used to generate uniq filenames.
[ "$BHISTREVERT" == "" ] && BHISTREVERT=true SEED=$(date "+%y-%m-%d-%H%M%S")
# Go back to previous folder when starting a new session. ## Makes sure destination folder exists.
[ "$BHISTLOADLAST" == "" ] && BHISTLOADLAST=true mkdir -p $(dirname "$BHISTORY")
## Use 'head' or 'tail' depending on BHISTREVERT
if $BHISTREVERT; then
BFUNC=head
BFUNCREV=tail
touch "${BHISTORY}-true"
if [ -e "$BHISTORY" -a -e "${BHISTORY}-false" ]; then
rm -rf "${BHISTORY}-false"
touch "${BHISTORY}-${SEED}_REV"
tac "$BHISTORY" > "${BHISTORY}_${SEED}_REV"
cat "${BHISTORY}_${SEED}_REV" > "$BHISTORY"
rm -rf "${BHISTORY}_${SEED}_REV"
fi
else
BFUNC=tail
BFUNCREV=head
touch "${BHISTORY}-false"
if [ -e "$BHISTORY" -a -e "${BHISTORY}-true" ]; then
rm -rf "${BHISTORY}-true"
touch "${BHISTORY}-${SEED}_REV"
tac "$BHISTORY" > "${BHISTORY}_${SEED}_REV"
cat "${BHISTORY}_${SEED}_REV" > "$BHISTORY"
rm -rf "${BHISTORY}_${SEED}_REV"
fi
fi
# Prevent infinite recursiveness when sourcing multiple times. ## Go back to previous folder when starting a new session.
unalias cd>/dev/null 2>&1 ## Need to put this part before the new 'cd' is set to prevent $HOME from being added as last entry in the history.
if [ $BHISTLOADLAST -a -e $BHISTORY ]; then
# SEED is used to generate uniq filenames. LASTPATH="$($BFUNC -n1 $BHISTORY)"
SEED=$(date "+%y-%m-%d-%H%M%S") if [[ -e "$LASTPATH" ]]; then
cd "$LASTPATH"
# Makes sure destination folder exists. fi
mkdir -p $(dirname "$BHISTORY") unset LASTPATH
fi
# Use 'head' or 'tail' depending on BHISTREVERT
if $BHISTREVERT; then
BFUNC=head
BFUNCREV=tail
touch "${BHISTORY}-true"
if [ -e "$BHISTORY" -a -e "${BHISTORY}-false" ]; then
rm -rf "${BHISTORY}-false"
touch "${BHISTORY}-${SEED}_REV"
tac "$BHISTORY" > "${BHISTORY}_${SEED}_REV"
cat "${BHISTORY}_${SEED}_REV" > "$BHISTORY"
rm -rf "${BHISTORY}_${SEED}_REV"
fi
else
BFUNC=tail
BFUNCREV=head
touch "${BHISTORY}-false"
if [ -e "$BHISTORY" -a -e "${BHISTORY}-true" ]; then
rm -rf "${BHISTORY}-true"
touch "${BHISTORY}-${SEED}_REV"
tac "$BHISTORY" > "${BHISTORY}_${SEED}_REV"
cat "${BHISTORY}_${SEED}_REV" > "$BHISTORY"
rm -rf "${BHISTORY}_${SEED}_REV"
fi
fi
# Go back to previous folder when starting a new session. function bcd(){
# Need to put this part before the new 'cd' is set to prevent $HOME from being added as last entry in the history. ## First character is an hyphen.
if [ $BHISTLOADLAST -a -e $BHISTORY ]; then if [ "${1:0:1}" == "-" ]; then
LASTPATH="$($BFUNC -n1 $BHISTORY)" if [ ${#1} -eq 1 ]; then # cd -
if [[ -e "$LASTPATH" ]]; then cd -
cd "$LASTPATH" else
fi DEST=${1:1} # After the hyphen
unset LASTPATH
fi
function bcd(){
# First character is an hyphen.
if [ "${1:0:1}" == "-" ]; then
if [ ${#1} -eq 1 ]; then # cd -
cd -
else
DEST=${1:1} # After the hyphen
# Check if the content after the hyphen is a number. # Check if the content after the hyphen is a number.
if [[ $DEST == ${DEST//[^0-9]/} ]]; then if [[ $DEST == ${DEST//[^0-9]/} ]]; then
let DEST=$DEST # Set DEST as an integer only here to avoid errors. let DEST=$DEST # Set DEST as an integer only here to avoid errors.
if $BHISTREVERT; then if $BHISTREVERT; then
let DEST=${DEST}+1 let DEST=${DEST}+1
fi fi
NEWPATH=$(head -n$DEST "$BHISTORY"|tail -n1) NEWPATH=$(head -n$DEST "$BHISTORY"|tail -n1)
echo ${NEWPATH} echo ${NEWPATH}
cd "${NEWPATH}" cd "${NEWPATH}"
else else
cd "$1" cd "$1"
fi fi
fi fi
else else
if [ -z "$1" ]; then if [ -z "$1" ]; then
cd cd
else else
cd "$1" cd "$1"
fi fi
fi fi
## Let's update the history. ## Let's update the history.
touch $BHISTORY touch $BHISTORY
# A buffer is used to avoid flow errors. ## A buffer is used to avoid flow errors.
if $BHISTREVERT; then if $BHISTREVERT; then
echo ${PWD} >> "${BHISTORY}_$SEED" echo ${PWD} >> "${BHISTORY}_$SEED"
cat "$BHISTORY" >> "${BHISTORY}_$SEED" cat "$BHISTORY" >> "${BHISTORY}_$SEED"
else else
cat "$BHISTORY" >> "${BHISTORY}_$SEED" cat "$BHISTORY" >> "${BHISTORY}_$SEED"
echo "${PWD}" >> "${BHISTORY}_$SEED" echo "${PWD}" >> "${BHISTORY}_$SEED"
fi fi
# The 'awk' command makes sure there is duplicates. ## The 'awk' command makes sure there is duplicates.
# If the history size is beyond the limit set by $BHISTFILESIZE+1, it is cut. ## If the history size is beyond the limit set by $BHISTFILESIZE+1, it is cut.
# The '+1' is for storing the current folder which is not displayed to the used. ## The '+1' is for storing the current folder which is not displayed to the used.
let BHISTSIZEREAL=${BHISTFILESIZE}+1 let BHISTSIZEREAL=${BHISTFILESIZE}+1
awk ' !x[$0]++' "${BHISTORY}_$SEED" | $BFUNC -n $BHISTSIZEREAL > "$BHISTORY" awk ' !x[$0]++' "${BHISTORY}_$SEED" | $BFUNC -n $BHISTSIZEREAL > "$BHISTORY"
rm "${BHISTORY}_$SEED" rm "${BHISTORY}_$SEED"
} }
function bhistory(){ function bhistory(){
if [ ! -e "$BHISTORY" ]; then if [ ! -e "$BHISTORY" ]; then
echo "Browse history empty" echo "Browse history empty"
else else
let BHISTDISPLAY=$(cat "$BHISTORY"| wc -l)-1 let BHISTDISPLAY=$(cat "$BHISTORY"| wc -l)-1
$BFUNCREV -n$BHISTDISPLAY "$BHISTORY"| cat -n $BFUNCREV -n$BHISTDISPLAY "$BHISTORY"| cat -n
fi fi
} }
# Clean -- buggy? ## Clean -- buggy?
#unset BFUNC BFUNCREV SEED BHISTSIZEREAL #unset BFUNC BFUNCREV SEED BHISTSIZEREAL
# Replace 'cd' command ## Replace 'cd' command
alias cd='bcd' alias cd='bcd'
shopt -s extglob # To allow bash to understand generic expression shopt -s extglob ## To allow bash to understand generic expression
shopt -s progcomp # To enable the programmable completion shopt -s progcomp ## To enable the programmable completion
set +o nounset # Otherwise some completions will fail set +o nounset ## Otherwise some completions will fail
complete -A directory cd complete -A directory cd
##============================================================================== ##==============================================================================
## Alias auto completion ## Alias auto completion
##============================================================================== ##==============================================================================
# wrap_alias takes three arguments: ## wrap_alias takes three arguments:
# $1: The name of the alias ## $1: The name of the alias
# $2: The command used in the alias ## $2: The command used in the alias
# $3: The arguments in the alias all in one string ## $3: The arguments in the alias all in one string
# Generate a wrapper completion function (completer) for an alias ## Generate a wrapper completion function (completer) for an alias
# based on the command and the given arguments, if there is a ## based on the command and the given arguments, if there is a
# completer for the command, and set the wrapper as the completer for ## completer for the command, and set the wrapper as the completer for
# the alias. ## the alias.
#function wrap_alias() { #function wrap_alias() {
# [[ "$#" == 3 ]] || return 1 # [[ "$#" == 3 ]] || return 1
# #
@ -178,28 +180,28 @@ if isShell "bash"; then
# local alias_arguments="$3" # local alias_arguments="$3"
# local num_alias_arguments=$(echo "$alias_arguments" | wc -w) # local num_alias_arguments=$(echo "$alias_arguments" | wc -w)
# #
# # The completion currently being used for the aliased command. # ## The completion currently being used for the aliased command.
# local completion=$(complete -p $aliased_command 2> /dev/null) # local completion=$(complete -p $aliased_command 2> /dev/null)
# #
# # Only a completer based on a function can be wrapped so look for -F # ## Only a completer based on a function can be wrapped so look for -F
# # in the current completion. This check will also catch commands # ## in the current completion. This check will also catch commands
# # with no completer for which $completion will be empty. # ## with no completer for which $completion will be empty.
# echo $completion | grep -q -- -F || return 0 # echo $completion | grep -q -- -F || return 0
# #
# local namespace=alias_completion:: # local namespace=alias_completion::
# #
# # Extract the name of the completion function from a string that # ## Extract the name of the completion function from a string that
# # looks like: something -F function_name something # ## looks like: something -F function_name something
# # First strip the beginning of the string up to the function name by # ## First strip the beginning of the string up to the function name by
# # removing "* -F " from the front. # ## removing "* -F " from the front.
# local completion_function=${completion##* -F } # local completion_function=${completion##* -F }
# # Then strip " *" from the end, leaving only the function name. # ## Then strip " *" from the end, leaving only the function name.
# completion_function=${completion_function%% *} # completion_function=${completion_function%% *}
# #
# # Try to prevent an infinite loop by not wrapping a function # ## Try to prevent an infinite loop by not wrapping a function
# # generated by this function. This can happen when the user runs # ## generated by this function. This can happen when the user runs
# # this twice for an alias like ls='ls --color=auto' or alias l='ls' # ## this twice for an alias like ls='ls --color=auto' or alias l='ls'
# # and alias ls='l foo' # ## and alias ls='l foo'
# [[ "${completion_function#$namespace}" != $completion_function ]] && return 0 # [[ "${completion_function#$namespace}" != $completion_function ]] && return 0
# #
# local wrapper_name="${namespace}${alias_name}" # local wrapper_name="${namespace}${alias_name}"
@ -213,20 +215,18 @@ if isShell "bash"; then
# } # }
#" #"
# #
# To create the new completion we use the old one with two # ## To create the new completion we use the old one with two
# replacements: # ## replacements:
# 1) Replace the function with the wrapper. # ## 1) Replace the function with the wrapper.
# local new_completion=${completion/-F * /-F $wrapper_name } # local new_completion=${completion/-F * /-F $wrapper_name }
# 2) Replace the command being completed with the alias. # ## 2) Replace the command being completed with the alias.
# new_completion="${new_completion% *} $alias_name" # new_completion="${new_completion% *} $alias_name"
#
# eval "$new_completion" # eval "$new_completion"
#} #}
# For each defined alias, extract the necessary elements and use them ## For each defined alias, extract the necessary elements and use them
# to call wrap_alias. ## to call wrap_alias.
#eval "$(alias -p | sed -e 's/alias \([^=][^=]*\)='\''\([^ ][^ ]*\) *\(.*\)'\''/wrap_alias \1 \2 '\''\3'\'' /')" #eval "$(alias -p | sed -e 's/alias \([^=][^=]*\)='\''\([^ ][^ ]*\) *\(.*\)'\''/wrap_alias \1 \2 '\''\3'\'' /')"
#unset wrap_alias #unset wrap_alias
fi

View File

@ -1,13 +1,27 @@
## -*- mode:sh -*- # ## -*- mode:sh -*- #
################################################################################ ################################################################################
## Shell -- Functions. ## Shell -- Functions.
## Date 2012-06-21 ## Date 2012-08-11
################################################################################ ################################################################################
## Make dir and go into it. ## Colored man pager.
man()
{
env \
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
LESS_TERMCAP_md=$(printf "\e[1;31m") \
LESS_TERMCAP_me=$(printf "\e[0m") \
LESS_TERMCAP_se=$(printf "\e[0m") \
LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
LESS_TERMCAP_ue=$(printf "\e[0m") \
LESS_TERMCAP_us=$(printf "\e[1;32m") \
man "$@"
}
## Make directories and change into the first one.
mkcd () { mkcd () {
mkdir -p "$*" mkdir -p "$@"
cd "$*" cd "$1"
} }
## Quick search. ## Quick search.
@ -25,6 +39,7 @@ cuttail()
} }
## Cut first n lines in file, 10 by default. ## Cut first n lines in file, 10 by default.
## TODO: use sed command instead.
cuthead() cuthead()
{ {
local nlines=${2:-10} local nlines=${2:-10}
@ -41,13 +56,12 @@ renamelower()
for file ; do for file ; do
filename=${file##*/} filename=${file##*/}
case "$filename" in
*/*)
dirname==${file%/*} ;;
*)
dirname=.;;
esac
case "$filename" in
*/*) dirname="${file%/*}" ;;
*) dirname="." ;;
esac
local nf=$(echo $filename | tr A-Z a-z) local nf=$(echo $filename | tr A-Z a-z)
local newname="${dirname}/${nf}" local newname="${dirname}/${nf}"
if [ "$nf" != "$filename" ]; then if [ "$nf" != "$filename" ]; then
@ -62,10 +76,10 @@ renamelower()
## Swap 2 filenames around. ## Swap 2 filenames around.
renameswap() renameswap()
{ {
local TMPFILE=tmp.$$ local TEMPFILE="$(mktemp)"
mv "$1" $TMPFILE mv "$1" "$TEMPFILE"
mv "$2" "$1" mv "$2" "$1"
mv $TMPFILE "$2" mv "$TEMPFILE" "$2"
} }
## Finds directory sizes and lists them for the current directory. ## Finds directory sizes and lists them for the current directory.
@ -74,15 +88,15 @@ dirsize ()
local TEMPFILE="$(mktemp)" local TEMPFILE="$(mktemp)"
# du -shx * .[a-zA-Z0-9_]* 2> /dev/null | \ # du -shx * .[a-zA-Z0-9_]* 2> /dev/null | \
du -shx * 2> /dev/null | \ du -shx * 2> /dev/null | \
egrep '^ *[0-9.]*[MG]' | sort -n > ${TEMPFILE} egrep '^ *[0-9.]*[MG]' | sort -n > "${TEMPFILE}"
egrep '^ *[0-9.]*M' ${TEMPFILE} egrep '^ *[0-9.]*M' "${TEMPFILE}"
egrep '^ *[0-9.]*G' ${TEMPFILE} egrep '^ *[0-9.]*G' "${TEMPFILE}"
rm -rf ${TEMPFILE} rm -rf "${TEMPFILE}"
} }
## Network operations ## Network operations
if [ -e "/usr/bin/nmap" ]; then if [ -e "/usr/bin/nmap" ]; then
networkmap() { network-map() {
echo "$1" echo "$1"
for SCANIP in $( nmap -sL "$1" | grep -i "\([[:digit:]]\+\.\)\{3,\}[[:digit:]]\+" | awk '{print $5}' ); do for SCANIP in $( nmap -sL "$1" | grep -i "\([[:digit:]]\+\.\)\{3,\}[[:digit:]]\+" | awk '{print $5}' ); do
sudo nmap -oX - -n -sT -T Normal -O -sR -I -F -P0 "$SCANIP" sudo nmap -oX - -n -sT -T Normal -O -sR -I -F -P0 "$SCANIP"
@ -91,8 +105,8 @@ if [ -e "/usr/bin/nmap" ]; then
} }
fi fi
## Vim-only: search the vim reference manual for a keyword ## Vim-only: search the vim reference manual for a keyword.
## usage: :h <keyword> ## Usage: :h <keyword>
if [ -e "/usr/bin/vim" ]; then if [ -e "/usr/bin/vim" ]; then
:h() :h()
{ {
@ -129,21 +143,21 @@ asciify()
for i; do for i; do
sed -i \ sed -i \
-e 's/[àáâä]/a/g' \ -e 's/[àáâä]/a/g' \
-e 's/[éèêë]/e/g' \ -e 's/[éèêë]/e/g' \
-e 's/[ïîí]/i/g' \ -e 's/[ïîí]/i/g' \
-e 's/[öôó]/o/g' \ -e 's/[öôó]/o/g' \
-e 's/[ùúûü]/u/g' \ -e 's/[ùúûü]/u/g' \
-e 's/[À]/A/g' \ -e 's/[À]/A/g' \
-e 's/[ÉÈ]/E/g' \ -e 's/[ÉÈ]/E/g' \
-e 's/[ñ]/n/g' \ -e 's/[ñ]/n/g' \
-e 's/[œ]/oe/g' \ -e 's/[œ]/oe/g' \
-e 's/[Œ]/Oe/g' \ -e 's/[Œ]/Oe/g' \
-e 's/[æ]/ae/g' \ -e 's/[æ]/ae/g' \
-e 's/[Æ]/Ae/g' \ -e 's/[Æ]/Ae/g' \
-e 's/[ç]/c/g' \ -e 's/[ç]/c/g' \
-e 's/[Ç]/C/g' \ -e 's/[Ç]/C/g' \
"$i" "$i"
done; done;
} }
@ -176,11 +190,13 @@ blind-append()
STRING="$2" STRING="$2"
fi fi
echo -n "Secret: "
read -s DUMMY read -s DUMMY
echo ""
if [ ! -e "$FILE" ] || [ "$STRING" = "" ]; then if [ ! -e "$FILE" ] || [ "$STRING" = "" ]; then
echo "$DUMMY" >> "$FILE" echo "$DUMMY" >> "$FILE"
echo "Secrect blindly appended to ${FILE} at the end." echo "Secret appended to ${FILE} at the end."
return return
fi fi
@ -190,11 +206,10 @@ blind-append()
else else
sed -i "s/${STRING}/${STRING}${DUMMY}/g" "${FILE}" sed -i "s/${STRING}/${STRING}${DUMMY}/g" "${FILE}"
fi fi
echo "Secret blindly appended to ${FILE}." echo "Secret appended to ${FILE}."
return return
} }
## Term properties ## Term properties
termcolors(){ termcolors(){
x=$(tput op) x=$(tput op)
@ -217,45 +232,27 @@ termsupport()
done | sort -nk2 done | sort -nk2
} }
## Colored man pager.
man()
{
env \
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
LESS_TERMCAP_md=$(printf "\e[1;31m") \
LESS_TERMCAP_me=$(printf "\e[0m") \
LESS_TERMCAP_se=$(printf "\e[0m") \
LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
LESS_TERMCAP_ue=$(printf "\e[0m") \
LESS_TERMCAP_us=$(printf "\e[1;32m") \
man "$@"
}
## Highlight themes viewer for 256-colors terminals. ## Highlight themes viewer for 256-colors terminals.
hlt-viewer () if [ -f "/usr/bin/highlight" ] ; then
{ hlt-viewer ()
print_help()
{ {
echo "Synopsis:" print_help()
echo -e " $1" {
echo echo "Synopsis:"
echo "This script displays a preview for every highlight's theme." echo -e " $1"
echo "Press ENTER to display next preview. Press anything else then ENTER to quit." echo
} echo "This script displays a preview for every highlight's theme."
echo "Press ENTER to display next preview. Press anything else then ENTER to quit."
if [ ! -f "/usr/bin/highlight" ];then }
echo "Please install 'highlight'."
return if [ $# -gt 0 ]; then
fi print_help "$0"
return
if [ $# -gt 0 ]; then fi
print_help "$0"
return
fi
local LIST=$(highlight -w | grep -v "\s\|^$") local LIST=$(highlight -w | grep -v "\s\|^$")
local SAMPLE="void function(char* pointer, int &ref) local SAMPLE="void function(char* pointer, int &ref)
{ {
int integer=3; int integer=3;
char* string=\"Hello!\"; char* string=\"Hello!\";
@ -267,41 +264,42 @@ hlt-viewer ()
} }
}" }"
unset DUMMY unset DUMMY
for i in $(highlight -w | grep -v "\s\|^$"); do for i in $(highlight -w | grep -v "\s\|^$"); do
echo "******************** $i ********************" echo "******************** $i ********************"
highlight -S c -O xterm256 <(echo $SAMPLE) -s "$i" highlight -S c -O xterm256 <(echo $SAMPLE) -s "$i"
read -s DUMMY read -s DUMMY
if [ ! "$DUMMY" = "" ];then if [ ! "$DUMMY" = "" ];then
return return
fi fi
done done
} }
fi
## Extractor -- Useless when using 'atool'. ## Extractor -- Useless when using 'atool'.
if [ ! -e "/usr/bin/atool" ]; then if [ ! -e "/usr/bin/atool" ]; then
extract () { extract () {
if [ -f $1 ] ; then if [ -f $1 ] ; then
case $1 in case $1 in
*.tar.bz2) tar xvjf $1 ;; *.tar.bz2) tar xvjf $1 ;;
*.tar.gz) tar xvzf $1 ;; *.tar.gz) tar xvzf $1 ;;
*.tar.xz) tar xvJf $1 ;; *.tar.xz) tar xvJf $1 ;;
*.bz2) bunzip2 $1 ;; *.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;; *.rar) unrar x $1 ;;
*.gz) gunzip $1 ;; *.gz) gunzip $1 ;;
*.tar) tar xvf $1 ;; *.tar) tar xvf $1 ;;
*.tbz2) tar xvjf $1 ;; *.tbz2) tar xvjf $1 ;;
*.tgz) tar xvzf $1 ;; *.tgz) tar xvzf $1 ;;
*.zip) unzip $1 ;; *.zip) unzip $1 ;;
*.Z) uncompress $1 ;; *.Z) uncompress $1 ;;
*.7z) 7z x $1 ;; *.7z) 7z x $1 ;;
*.xz) unxz $1 ;; *.xz) unxz $1 ;;
*.exe) cabextract $1 ;; *.exe) cabextract $1 ;;
*) echo "\`$1': unrecognized file compression" ;; *) echo "\`$1': unrecognized file compression" ;;
esac esac
else else
echo "\`$1' is not a valid file" echo "\`$1' is not a valid file"
fi fi
} }
fi fi
@ -432,7 +430,7 @@ archive ()
} }
# This function will clean TeX/LaTeX project folders recursively. # This function will clean TeX/LaTeX project folders recursively.
function texclean () texclean ()
{ {
if [ -z "$1" ]; then if [ -z "$1" ]; then
WORKDIR="$PWD" WORKDIR="$PWD"
@ -535,7 +533,7 @@ formatc()
# ## Function parenthesis # ## Function parenthesis
# sed -i 's/\([^ ]\)(/\1 (/g' "$FILE" # sed -i 's/\([^ ]\)(/\1 (/g' "$FILE"
# sed -i 's/\s\s\+(/ (/g' "$FILE" # sed -i 's/\s\s\+(/ (/g' "$FILE"
# ## Semicolon # ## Semicolon
# sed -i 's/\([^ ]\);/\1 ;/g' "$FILE" # sed -i 's/\([^ ]\);/\1 ;/g' "$FILE"
# sed -i 's/;\([^ ]\)/; \1/g' "$FILE" # sed -i 's/;\([^ ]\)/; \1/g' "$FILE"
@ -598,8 +596,11 @@ bindatasearch()
## The awk command suppresses first column, spaces and line breaks. ## The awk command suppresses first column, spaces and line breaks.
local SOURCE=$(od -tx8 "$1" | awk '($1="")1 gsub ( /\s/,"") { printf ("%s", $0) }') local SOURCE=$(od -tx8 "$1" | awk '($1="")1 gsub ( /\s/,"") { printf ("%s", $0) }')
## This special, not well-known syntax allows us to execute a set of
## Solution 1 ## functions of the result of find. Since everything MUST be between simple
## quotes, we cannot use external varaibles directly. So we pass the $SOURCE
## varaible as argument. The underscore at the end allow the use of
## arguments.
find "$WORKDIR" -type f -exec bash -c ' find "$WORKDIR" -type f -exec bash -c '
TARGET=$(od -tx8 "$1" | awk '"'"'($1="")1 gsub ( /\s/,"") { printf ("%s", $0) }'"'"') TARGET=$(od -tx8 "$1" | awk '"'"'($1="")1 gsub ( /\s/,"") { printf ("%s", $0) }'"'"')
grep -q "$2" <(echo $TARGET) grep -q "$2" <(echo $TARGET)
@ -613,301 +614,9 @@ bindatasearch()
##============================================================================== ##==============================================================================
if [ -f "/usr/bin/pacman" ]; then if [ -f "/usr/bin/pacman" ]; then
source "${SHELL_DIR}/funs_pacman"
## TODO: completion does not work as is. It requires pacman arguments like -S or -Q.
## There should be a way to use it.
# if isShell "zsh" ; then
# compdef _pacman pacman-deps
# elif isShell "bash"; then
# complete -o default -o nospace -F _pacman pacman-deps
# fi
## This function gets the pacman variabless when necessary.
## Note: some functions uses pacman localized output. It should work in any case.
## Note: you should always call _pacman_unset_vars in the end.
_pacman_set_vars()
{
local pacman_var_list="$(pacman -Qi tzdata | cut -f1 -d':')"
if [ "$pacman_var_list" = "" ];then
echo "Could not get pacman's variables."
return 2
fi
pacman_name="$(echo "$pacman_var_list" | sed -n '1p')"
pacman_deps="$(echo "$pacman_var_list" | sed -n '7p')"
pacman_optdeps="$(echo "$pacman_var_list" | sed -n '8p')"
pacman_size="$(echo "$pacman_var_list" | sed -n '12p')"
}
_pacman_unset_vars()
{
unset pacman_name
unset pacman_deps
unset pacman_optdeps
unset pacman_size
}
## Get detailed file size list for the specified packages.
if [ -f "/usr/bin/pacman" ]; then
pacman-files()
{
printhelp()
{
echo "Synopsis:"
echo -e " $1 [-n] PACKAGES"
echo
echo "Usage:"
echo -e " default:\tDisplay file size of PACKAGES."
echo -e " -h:\t\tDisplay this help."
echo -e " -n:\t\tSort by size."
}
local OPTION_SORT="cat"
while getopts ":hn" opt; do
case $opt in
h)
printhelp "$0"
return 1
;;
n)
OPTION_SORT="sort -h"
;;
?)
printhelp "$0"
return 1
;;
:)
echo "Missing argument."
echo "Use $0 -h for help."
return 1
;;
esac
done
shift $(($OPTIND - 1))
if [ $# -eq 0 ]; then
echo "Missing argument."
echo "Use $0 -h for help."
return 1
fi
local RESULT_HUMAN="$(du -bh $(pacman -Qlq "$@" | grep -v ".*/$" | sort -u) | eval ${OPTION_SORT})"
local RESULT="$(du -b $(pacman -Qlq "$@" | grep -v ".*/$" | sort -u))"
echo "${RESULT_HUMAN}"
echo "$RESULT" | awk -F "[[:alpha:]]" '{TOTAL=$1+TOTAL} END {printf("Total: %d KiB\n",TOTAL/1024)}'
}
fi fi
## Retrieve official packages list.
if [ -f "/usr/bin/pacman" ]; then
pacman-official()
{
# Alternative 'diff' verision.
# diff <(pacman -Qq | sort) <(pacman -Qmq | sort) --new-line-format='' --unchanged-group-format='%>'
comm -3 <(pacman -Qq | sort) <(pacman -Qmq | sort)
}
fi
## Compare installed packages with list.
if [ -f "/usr/bin/pacman" ]; then
pacman-diff()
{
printhelp()
{
echo "Synopsis:"
echo -e " $1 [-m|-e] [-q] FILE"
echo
echo "Usage:"
echo -e " default:\tDisplay packages included in FILE but not installed."
echo -e " -e:\t\tCompare FILE to explicitly installed packages."
echo -e " -h:\t\tDisplay this help."
echo -e " -m:\t\tCompare FILE to foreign installed packages."
echo -e " -q:\t\tDisplay installed packages not included in FILE."
}
local OPTION_EXPLICIT=""
local OPTION_FOREIGN=""
local OPTION_LOCAL="-1"
while getopts ":hmqe" opt; do
case $opt in
e)
OPTION_EXPLICIT="e"
;;
h)
printhelp "$0"
return 1
;;
m)
OPTION_FOREIGN="m"
;;
q)
OPTION_LOCAL="-2"
;;
?)
printhelp "$0"
return 1
;;
:)
echo "Missing argument."
echo "Use $0 -h for help."
return 1
;;
esac
done
shift $(($OPTIND - 1))
if [ $# -eq 0 ]; then
echo "Missing argument."
echo "Use $0 -h for help."
return 1
fi
comm -3 ${OPTION_LOCAL} <(pacman -Qq${OPTION_FOREIGN}${OPTION_EXPLICIT} | sort) <(sort "$*")
}
fi
## Print specified package size and a grand total.
if [ -f "/usr/bin/pacman" ]; then
pacman-size()
{
printhelp()
{
echo "Synopsis:"
echo -e " $1 [-a|-h|-n|-q] PACKAGES"
echo -e " Arguments MUST be set before package list."
echo
echo "Usage:"
echo -e " default:\tDisplay package size. Output contains no double and is alphabetically sorted. A grand total is printed at the end. It will only work for repos packages by default."
echo -e " -h:\t\tShow this help."
echo -e " -n:\t\tOutput is sorted by size."
echo -e " -q:\t\tUses installed packages database instead of repos database. It speeds up queries and allows displaying size of local packages not available in repos."
}
local CMD="pacman -Si"
local SEP=": "
local TOTAL_SIZE=0
local SORT="sort -u -k3"
local SORT_SIZE="cat"
while getopts ":hnq" opt; do
case $opt in
h)
printhelp "$0"
return 1
;;
n)
SORT_SIZE="sort -n"
;;
q)
CMD="pacman -Qi"
;;
?)
printhelp "$0"
return 1
;;
:)
echo "Missing argument."
echo "Use $0 -h for help."
return 1
;;
esac
done
shift $(($OPTIND - 1))
if [ $# -eq 0 ]; then
echo "Missing argument."
echo "Use $0 -h for help."
return 1
fi
_pacman_set_vars
local RESULT=$(eval "${CMD} $@" | awk -F "$SEP" -v filter="$pacman_size" -v pkg="$pacman_name" \
'$0 ~ pkg {pkgname=$2} $0 ~ filter {gsub(/\..*/,"") ; printf("%6s KiB %s\n", $2, pkgname)}' | eval "$SORT" | eval "$SORT_SIZE")
echo "$RESULT"
## Print total size.
echo "$RESULT" | awk '{TOTAL=$1+TOTAL} END {printf("Total: %d KiB\n",TOTAL)}'
## One line version. ~ same performance.
# eval "${CMD} $@ 2>/dev/null" | awk -F "$SEP" -v filter="$pacman_size" -v pkg="$pacman_name" \
# '$0 ~ pkg {pkgname=$2} $0 ~ filter {gsub(/\..*/,"") ; printf("%6s KiB %s\n", $2, pkgname)}' | sort -u -k3 \
# | tee >(awk '{TOTAL=$1+TOTAL} END {printf("Total: %d KiB\n",TOTAL)}')
_pacman_unset_vars
}
fi
## Print deps list.
if [ -f "/usr/bin/pacman" ]; then
pacman-deps()
{
printhelp()
{
echo "Synopsis:"
echo -e " $1 [-a|-h|-q] PACKAGES"
echo -e " Arguments MUST be set before package list."
echo
echo "Usage:"
echo -e " default:\tDisplay package dependencies. Output contains no double and is alphabetically sorted. It will only work for repos packages by default."
echo -e " -a:\t\tUses Yaourt queries instead of repos database. It slows down query but allow displaying size of local any packages not available in repos."
echo -e " -h:\t\tShow this help."
echo -e " -q:\t\tUses installed packages database instead of repos database. It speeds up queries and allows displaying size of local packages not available in repos."
}
local CMD="pacman -Si"
local SEP=": "
while getopts ":ahq" opt; do
case $opt in
a)
CMD="yaourt -Si"
;;
h)
printhelp "$0"
return 1
;;
q)
CMD="pacman -Qi"
;;
?)
printhelp "$0"
return 1
;;
:)
echo "Missing argument."
echo "Use $0 -h for help."
return 1
;;
esac
done
shift $(($OPTIND - 1))
if [ $# -eq 0 ]; then
echo "Missing argument."
echo "Use $0 -h for help."
return 1
fi
_pacman_set_vars
eval "${CMD} $@ 2>/dev/null" | awk -F "$SEP" -v filter="$pacman_deps" '$0 ~ filter {gsub(/[>=<][^ ]*/,"",$2) ; gsub(/ +/,"\n",$2) ; print $2}' | sort -u
_pacman_unset_vars
}
fi
fi
##============================================================================== ##==============================================================================
## TeXlive functions ## TeXlive functions
##============================================================================== ##==============================================================================
@ -915,6 +624,8 @@ fi
## TeXlive ## TeXlive
if [ -d "/usr/local/texlive" ]; then if [ -d "/usr/local/texlive" ]; then
## This function installs basic TeX and LaTeX packages. This is very
## user-specific, so you should adapt the list to your needs.
tlinit () tlinit ()
{ {
## Warning: it is important to set umask properly, otherwise users might ## Warning: it is important to set umask properly, otherwise users might
@ -954,5 +665,4 @@ if [ -d "/usr/local/texlive" ]; then
xcolor \ xcolor \
zapfding' zapfding'
} }
fi fi

View File

@ -1,15 +1,11 @@
## -*- mode:sh -*- #
################################################################################ ################################################################################
## Zsh Key bindings ## Zsh Key bindings
## Date 2011-11-19 ## 2012-08-11
################################################################################ ################################################################################
## References:
##============================================================================== ## http://mundy.yazzy.org/unix/zsh.php
## Zsh keys ## http://www.zsh.org/mla/users/2000/msg00727.html
##==============================================================================
# http://mundy.yazzy.org/unix/zsh.php
# http://www.zsh.org/mla/users/2000/msg00727.html
## Bindings functions: ## Bindings functions:
# backward-char # backward-char
@ -32,44 +28,43 @@
# up-line-or-search # up-line-or-search
# expand-or-complete-prefix ## completion in the middle of a line # expand-or-complete-prefix ## completion in the middle of a line
if isShell "zsh"; then ## Emacs bindings
bindkey -e # Emacs bindings bindkey -e
## Set '/' as a word delimiter. ## Set '/' as a word delimiter.
autoload -U select-word-style autoload -U select-word-style
select-word-style bash select-word-style bash
## ??? ## ???
# typeset -g -A key # typeset -g -A key
## Note that double brackets are needed to expand wildcards properly. ## Note that double brackets are needed to expand wildcards properly.
if [[ $TERM = *xterm* ]] ; then if [[ $TERM = *xterm* ]] ; then
bindkey "\e[3~" delete-char bindkey "\e[3~" delete-char
bindkey "\e[1;5D" backward-word bindkey "\e[1;5D" backward-word
bindkey "\e[1;5C" forward-word bindkey "\e[1;5C" forward-word
bindkey "\eOH" beginning-of-line bindkey "\eOH" beginning-of-line
bindkey "\eOF" end-of-line bindkey "\eOF" end-of-line
bindkey "\e[Z" reverse-menu-complete # Shift+Tab bindkey "\e[Z" reverse-menu-complete # Shift+Tab
fi fi
if [[ $TERM = *rxvt* ]] ; then if [[ $TERM = *rxvt* ]] ; then
bindkey "\e[3~" delete-char bindkey "\e[3~" delete-char
bindkey "\eOd" backward-word bindkey "\eOd" backward-word
bindkey "\eOc" forward-word bindkey "\eOc" forward-word
bindkey "\e[7~" beginning-of-line bindkey "\e[7~" beginning-of-line
bindkey "\e[8~" end-of-line bindkey "\e[8~" end-of-line
bindkey "\e[Z" reverse-menu-complete # Shift+Tab bindkey "\e[Z" reverse-menu-complete # Shift+Tab
fi fi
## For rxvt. ## For rxvt.
# bindkey "\e[7~" beginning-of-line # Home # bindkey "\e[7~" beginning-of-line # Home
# bindkey "\e[8~" end-of-line # End # bindkey "\e[8~" end-of-line # End
## For FreeBSD console. ## For FreeBSD console.
# bindkey "\e[H" beginning-of-line # bindkey "\e[H" beginning-of-line
# bindkey "\e[F" end-of-line # bindkey "\e[F" end-of-line
fi

View File

@ -25,6 +25,11 @@ if [ -d "${TEXROOT}" ]; then
unset TEXFOLDER unset TEXFOLDER
fi fi
## Enable color support of ls.
if [ "$TERM" != "dumb" ]; then
eval "`dircolors -b`"
fi
## Terminal ## Terminal
## WARNING: this is always a bad idea! ## WARNING: this is always a bad idea!
# if [[ "$TERM" = "*rxvt*" ]]; then # if [[ "$TERM" = "*rxvt*" ]]; then
@ -39,7 +44,7 @@ export MANPAGER="less -s"
export MANWIDTH=80 export MANWIDTH=80
## Time display (with ls command for example) ## Time display (with ls command for example)
export TIME_STYLE=+"| %d/%m/%Y %H:%M | " export TIME_STYLE=+"| %d/%m/%Y %H:%M:%S | "
## System locale ## System locale
# export LC_MESSAGES=fr_FR.utf8 # export LC_MESSAGES=fr_FR.utf8

View File

@ -3,161 +3,160 @@
## Bash specific options ## Bash specific options
################################################################################ ################################################################################
if isShell "bash"; then
## Enable programmable completion features (you don't need to enable ## Enable programmable completion features (you don't need to enable
## this, if it's already enabled in /etc/bash.bashrc and /etc/profile ## this, if it's already enabled in /etc/bash.bashrc and /etc/profile
## sources /etc/bash.bashrc). ## sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ]; then [ -f /etc/bash_completion ] && . /etc/bash_completion
. /etc/bash_completion
fi
## Sudo completion ## Sudo completion
complete -cf sudo complete -cf sudo
set +o nounset # Otherwise some completions will fail set +o nounset # Otherwise some completions will fail
set completion-ignore-case on set completion-ignore-case on
set show-all-if-ambiguous on set show-all-if-ambiguous on
## Use TAB to switch between completions instead of waiting for the next character. ## Use TAB to switch between completions instead of waiting for the next character.
#bind '"\t":menu-complete' #bind '"\t":menu-complete'
export FIGNORE=".o:~" # A list of suffixes to ignore when performing filename completion ## A list of suffixes to ignore when performing filename completion
set filec # To search and fill the complete name of a file (with <Esc>) export FIGNORE=".o:~"
## To search and fill the complete name of a file (with <Esc>)
set filec
##====================================================================== ##======================================================================
## History management ## History management
##====================================================================== ##======================================================================
export HISTCONTROL=ignoredups # don't put duplicate lines in the history. See bash(1) for more options
export HISTFILESIZE=1000 # Define number of previous commands stored # Don't put duplicate lines in the history. See bash(1) for more options.
export HISTIGNORE="&:bg:fg:ll:h:ls:la:la:lk:clear:exit:history" export HISTCONTROL=ignoredups
export HISTTIMEFORMAT="%Y-%m-%d_%H:%M:%S_%a "
# Define number of previous commands stored.
export HISTFILESIZE=1000
export HISTIGNORE="&:bg:fg:ll:h:ls:la:la:lk:clear:exit:history"
export HISTTIMEFORMAT="%Y-%m-%d_%H:%M:%S_%a "
##====================================================================== ##======================================================================
## Various options ## Various options
##====================================================================== ##======================================================================
set -o notify # Jobs notify shell about their states immediately set -o notify # Jobs notify shell about their states immediately.
#set ignoreeof # To avoid accidentally quitting the shell with <Ctrl-D> #set ignoreeof # To avoid accidentally quitting the shell with <Ctrl-D>.
#shopt -u mailwarn # Disable the shell ability to warn about incoming mail.
#shopt -u mailwarn # Disable the shell ability to warn about incoming mail shopt -s cdable_vars # If cd arg is not valid, assumes its a var defining a dir.
shopt -s cdable_vars # if cd arg is not valid, assumes its a var defining a dir shopt -s cdspell # To correct minor error in the directory spelling (during cd).
shopt -s cdspell # To correct minor error in the directory spelling (during cd) shopt -s checkhash
shopt -s checkhash shopt -s checkwinsize # Update the value of LINES and COLUMNS after each command if altered.
shopt -s checkwinsize # update the value of LINES and COLUMNS after each command if altered shopt -s cmdhist # Save multi-line commands in history as single line.
shopt -s cmdhist # save multi-line commands in history as single line shopt -s dirspell
shopt -s dirspell shopt -s dotglob # Include dotfiles in pathname expansion.
shopt -s dotglob # include dotfiles in pathname expansion shopt -s expand_aliases # Expand aliases.
shopt -s expand_aliases # expand aliases shopt -s extglob # Enable extended pattern-matching features.
shopt -s extglob # enable extended pattern-matching features shopt -s histappend # Append to (not overwrite) the history file.
shopt -s histappend # append to (not overwrite) the history file shopt -s hostcomplete # Attempt hostname expansion when @ is at the beginning of a word.
shopt -s hostcomplete # attempt hostname expansion when @ is at the beginning ofa word shopt -s no_empty_cmd_completion # No completion on an empty line.
shopt -s no_empty_cmd_completion # No completion on an empty line shopt -s nocaseglob # Pathname expansion will be treated as case-insensitive.
shopt -s nocaseglob # pathname expansion will be treated as case-insensitive shopt -s progcomp # To enable the programmable completion.
shopt -s progcomp #To enable the programmable completion
##============================================================================== ##==============================================================================
## PS1 -- Full width bar with informations. ## PS1 -- Full width bar with informations.
##============================================================================== ##==============================================================================
## An external function is needed to update $COLUMNS value, as well as path, time, and other variables. ## An external function is needed to update $COLUMNS value, as well as path, time, and other variables.
function PSBAR () _psbar ()
{ {
# Initialization. ## Initialization.
BARCOLOR=$BBlue BARCOLOR=$BBlue
OUTPUT="$BARCOLOR[" OUTPUT="$BARCOLOR["
SYMBOLVAR='=' SYMBOLVAR='='
CENTERVAR=" $(date +%H:%M:%S) " CENTERVAR=" $(date +%H:%M:%S) "
# Truncated path. ## Truncated path.
local PWDMAXLEN=$(($COLUMNS/2-${#CENTERVAR}/2-3)) # '3' stands for '[ $SYMBOLVAR'. ## '3' stands for '[ $SYMBOLVAR'.
local TRUNC_SYMBOL="..." local PWDMAXLEN=$(($COLUMNS/2-${#CENTERVAR}/2-3))
if [[ $PWD == $HOME* ]]; then local TRUNC_SYMBOL="..."
newPWD="~${PWD#$HOME}" if [[ $PWD == $HOME* ]]; then
else newPWD="~${PWD#$HOME}"
newPWD=${PWD} else
fi newPWD=${PWD}
if [ ${#newPWD} -gt $PWDMAXLEN ]; then fi
local PWDOFFSET=$(( ${#newPWD} - $PWDMAXLEN + ${#TRUNC_SYMBOL} )) if [ ${#newPWD} -gt $PWDMAXLEN ]; then
newPWD="${TRUNC_SYMBOL}${newPWD:$PWDOFFSET:$PWDMAXLEN}" local PWDOFFSET=$(( ${#newPWD} - $PWDMAXLEN + ${#TRUNC_SYMBOL} ))
fi newPWD="${TRUNC_SYMBOL}${newPWD:$PWDOFFSET:$PWDMAXLEN}"
fi
# Truncated login information. ## Truncated login information.
local LOGINFO="$(whoami)@$HOSTNAME" local LOGINFO="$(whoami)@$HOSTNAME"
if [ ${#LOGINFO} -gt $(($COLUMNS/2-${#CENTERVAR}/2-3)) ] # '3' stands for '$SYMBOLVAR ]' if [ ${#LOGINFO} -gt $(($COLUMNS/2-${#CENTERVAR}/2-3)) ]
then then
LOGINFO=$USER LOGINFO=$USER
if [ ${#LOGINFO} -gt $(($COLUMNS/2-${#CENTERVAR}/2-3)) ] # '3' stands for '$SYMBOLVAR ]' if [ ${#LOGINFO} -gt $(($COLUMNS/2-${#CENTERVAR}/2-3)) ]
then then
unset LOGINFO unset LOGINFO
fi fi
fi fi
# Left and right side. Empty if terminal width is too small. ## Left and right side. Empty if terminal width is too small.
if [ $COLUMNS -gt 50 ] if [ $COLUMNS -gt 50 ]
then then
LEFTSIDEVAR="$newPWD " LEFTSIDEVAR="$newPWD "
RIGHTSIDEVAR=" $LOGINFO" RIGHTSIDEVAR=" $LOGINFO"
fi fi
# Left side. ## Left side.
OUTPUT="$OUTPUT$BPurple$LEFTSIDEVAR" OUTPUT="$OUTPUT$BPurple$LEFTSIDEVAR"
# Reset bar color ## Reset bar color
OUTPUT="$OUTPUT$BARCOLOR" OUTPUT="$OUTPUT$BARCOLOR"
# In case of odd values. ## In case of odd values.
if [ $(($COLUMNS%2)) -eq 1 ] if [ $(($COLUMNS%2)) -eq 1 ]
then then
OUTPUT="$OUTPUT$SYMBOLVAR" OUTPUT="$OUTPUT$SYMBOLVAR"
fi fi
# Fill 'OUTPUT' variable with the desired chars. ## Fill 'OUTPUT' variable with the desired chars.
for i in $( seq $(($COLUMNS/2-${#LEFTSIDEVAR}-${#CENTERVAR}/2-1)) ) # '1' stands for '[' ## '1' stands for '['
do for i in $( seq $(($COLUMNS/2-${#LEFTSIDEVAR}-${#CENTERVAR}/2-1)) )
OUTPUT="$OUTPUT$SYMBOLVAR" do
done OUTPUT="$OUTPUT$SYMBOLVAR"
done
## Center.
OUTPUT="$OUTPUT$Color_Off$CENTERVAR"
# Center. ## Reset bar color
OUTPUT="$OUTPUT$Color_Off$CENTERVAR" OUTPUT="$OUTPUT$BARCOLOR"
## Fill 'OUTPUT' variable with the desired chars.
for i in $( seq $(($COLUMNS/2-${#CENTERVAR}/2-${#RIGHTSIDEVAR}-1)) )
do
OUTPUT="$OUTPUT$SYMBOLVAR"
done
# Reset bar color ## Right side.
OUTPUT="$OUTPUT$BARCOLOR" OUTPUT="$OUTPUT$BGreen$RIGHTSIDEVAR"
# Fill 'OUTPUT' variable with the desired chars. ## Reset bar color
for i in $( seq $(($COLUMNS/2-${#CENTERVAR}/2-${#RIGHTSIDEVAR}-1)) ) # '1' stands for ']' OUTPUT="$OUTPUT$BARCOLOR"
do
OUTPUT="$OUTPUT$SYMBOLVAR"
done
## Close bar
OUTPUT="$OUTPUT]\n"
# Right side. ## Prompt.
OUTPUT="$OUTPUT$BGreen$RIGHTSIDEVAR" if [ $(id -u) -eq 0 ]
then
## Root access
OUTPUT="$OUTPUT$BRed# $Color_Off"
else
## Normal user
OUTPUT="$OUTPUT$BYellow$ $Color_Off"
fi
# Reset bar color ## Set result to PS1.
OUTPUT="$OUTPUT$BARCOLOR" PS1="$OUTPUT"
}
# Close bar
OUTPUT="$OUTPUT]\n"
# Prompt.
if [ $(id -u) -eq 0 ]
then
# Root access
OUTPUT="$OUTPUT$BRed# $Color_Off"
else
# Normal user
OUTPUT="$OUTPUT$BYellow$ $Color_Off"
fi
# Set result to PS1.
PS1="$OUTPUT"
}
##============================================================================== ##==============================================================================
@ -169,10 +168,9 @@ if isShell "bash"; then
## PS1 ## PS1
##============================================================================== ##==============================================================================
## PS1 using PSBAR function. ## PS1 using _psbar function.
#PROMPT_COMMAND='PSBAR' #PROMPT_COMMAND='_psbar'
## Simple PS1 ## Simple PS1
PS1='\[\e[0;32m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[1;32m\]\$\[\e[m\] ' PS1='\[\e[0;32m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[1;32m\]\$\[\e[m\] '
fi

View File

@ -4,102 +4,99 @@
## Date 2011-11-19 ## Date 2011-11-19
################################################################################ ################################################################################
if isShell "zsh"; then
##============================================================================== ##==============================================================================
## History options ## History options
##============================================================================== ##==============================================================================
HISTFILE=~/.zshistfile HISTFILE=~/.zshistfile
HISTSIZE=1000 HISTSIZE=1000
SAVEHIST=1000 SAVEHIST=1000
setopt hist_ignore_all_dups setopt hist_ignore_all_dups
setopt hist_ignore_space # Commands beginning with a space won't be recorded. setopt hist_ignore_space # Commands beginning with a space won't be recorded.
setopt appendhistory setopt appendhistory
##============================================================================== ##==============================================================================
## Various ## Misc
##============================================================================== ##==============================================================================
# setopt completealiases # Not recommended. ## Not recommended.
setopt autocd # When only dirname is entered, then auto cd to it. # setopt completealiases
# setopt extendedglob nomatch notify # ???
unsetopt beep # ??? setopt autocd # When only dirname is entered, then auto cd to it.
## ???
# setopt extendedglob nomatch notify
## Usually not needed if pc speaker is off.
unsetopt beep
##============================================================================== ##==============================================================================
## VCS ## VCS
##============================================================================== ##==============================================================================
## TODO: work on it... ## TODO: to be continued...
# autoload -Uz vcs_info zstyle ':vcs_info:*' enable git hg svn # autoload -Uz vcs_info zstyle ':vcs_info:*' enable git hg svn
# autoload -Uz vcs_info # autoload -Uz vcs_info
##============================================================================== ##==============================================================================
## Dir stack ## Directory stack
##============================================================================== ##==============================================================================
DIRSTACKSIZE=20 DIRSTACKSIZE=20
setopt autopushd pushdsilent pushdtohome setopt autopushd pushdsilent pushdtohome
setopt pushdignoredups setopt pushdignoredups
# setopt pushdminus ## This revert the +/- operators.
alias dh='dirs -v' ## This revert the +/- operators.
# setopt pushdminus
if [[ -f ~/.zdirs ]] && [[ ${#dirstack[*]} -eq 0 ]]; then alias dh='dirs -v'
dirstack=( $(< ~/.zdirs) )
popd > /dev/null if [[ -f ~/.zdirs ]] && [[ ${#dirstack[*]} -eq 0 ]]; then
fi dirstack=( $(< ~/.zdirs) )
precmd() { popd > /dev/null
dirs -l >! ~/.zdirs fi
} precmd() {
dirs -l >! ~/.zdirs
}
##============================================================================== ##==============================================================================
## ??? ## ???
##============================================================================== ##==============================================================================
zstyle :compinstall filename "$HOME/.zshrc" zstyle :compinstall filename "$HOME/.zshrc"
##============================================================================== ##==============================================================================
## Completion ## Completion
##============================================================================== ##==============================================================================
autoload -Uz compinit autoload -Uz compinit
compinit compinit
zstyle ':completion:*' menu select zstyle ':completion:*' menu select
zstyle ':completion:*:descriptions' format '%U%B%d%b%u' zstyle ':completion:*:descriptions' format '%U%B%d%b%u'
zstyle ':completion:*:commands' rehash true # New binaries in path get recognized. zstyle ':completion:*:commands' rehash true # New binaries in path get recognized.
zstyle ':completion:*' completer _complete _match _approximate ## Allow approximate zstyle ':completion:*' completer _complete _match _approximate ## Allow approximate
zstyle ':completion:*:match:*' original only zstyle ':completion:*:match:*' original only
zstyle ':completion:*:approximate:*' max-errors 1 numeric zstyle ':completion:*:approximate:*' max-errors 1 numeric
## Tab completion for PID :D -- Useless ? ## Tab completion for PID :D -- Useless ?
# zstyle ':completion:*:*:kill:*' menu yes select # zstyle ':completion:*:*:kill:*' menu yes select
# zstyle ':completion:*:kill:*' force-list always # zstyle ':completion:*:kill:*' force-list always
##============================================================================== ##==============================================================================
## TESTING ## TESTING
##============================================================================== ##==============================================================================
# Remove RPS1 after <enter> ## Remove RPS1 after <enter>
setopt transient_rprompt setopt transient_rprompt
# Color vars ## Color vars
autoload -U colors terminfo autoload -U colors terminfo
colors colors
# Zargs pawa ## Zargs powaa
autoload -U zargs autoload -U zargs
##============================================================================== ##==============================================================================
## Prompt ## Prompt
##============================================================================== ##==============================================================================
autoload -U promptinit autoload -U promptinit
promptinit promptinit
prompt adam2 prompt adam2
##==============================================================================
## Colors for dirs.
##==============================================================================
eval `dircolors -b`
fi

35
.zshrc
View File

@ -1,6 +1,6 @@
################################################################################ ################################################################################
## Shell Config -- Master File ## Shell Config -- Master File
## Date 2012-07-02 ## Date 2012-08-11
################################################################################ ################################################################################
##============================================================================== ##==============================================================================
@ -9,32 +9,21 @@
## Useless for Zsh ? ## Useless for Zsh ?
[ -z "$PS1" ] && return [ -z "$PS1" ] && return
##==============================================================================
## Base functions
##==============================================================================
isShell()
{
if [ "$1" = "$(ps | grep $$ | awk '{print $4}')" ]; then
return 0
else
return 1
fi
}
##============================================================================== ##==============================================================================
## Sourcing ## Sourcing
##============================================================================== ##==============================================================================
SHELLDIR="$HOME/.shell.d" SHELL_CURRENT="$(ps | awk -v shellpid=$$ '$0 ~ shellpid {print $4}')"
SHELL_DIR="$HOME/.shell.d"
source "${SHELLDIR}/main_rc" # Should be sourced first. ## Should be sourced first.
source "${SHELLDIR}/options_zsh" # Should be sourced first. source "${SHELL_DIR}/main_rc"
source "${SHELLDIR}/colors_rc" # Should be sourced first. source "${SHELL_DIR}/options_zsh"
source "${SHELLDIR}/funs_rc" ## Source order should not matter.
source "${SHELLDIR}/alias_rc" source "${SHELL_DIR}/alias_rc"
source "${SHELLDIR}/keys_zsh" source "${SHELL_DIR}/colors_zsh"
source "${SHELLDIR}/personal_rc" source "${SHELL_DIR}/funs_rc"
source "${SHELL_DIR}/keys_zsh"
source "${SHELL_DIR}/personal_rc"