Emacs: Better Mediawiki support, set Luakit as default browser.

Shell: minor fixes + improved pacman functions.
master
Ambrevar 2012-07-20 16:04:29 +01:00
parent 5c2c6abbd7
commit 8f48ccf8d1
4 changed files with 218 additions and 333 deletions

2
.emacs
View File

@ -591,6 +591,8 @@ the line."
(setq mediawiki-mode-hook (lambda ()
(visual-line-mode 1)
(turn-off-auto-fill)
(define-key mediawiki-mode-map (kbd "C-c RET") 'mediawiki-open-page-at-point)
(define-key mediawiki-mode-map (kbd "C-c o") 'mediawiki-browse)
))

File diff suppressed because it is too large Load Diff

View File

@ -461,30 +461,20 @@ _pacman_unset_vars()
unset pacman_size
}
## Get detailed file size list for a specified package.
## Get detailed file size list for the specified packages.
if [ -f "/usr/bin/pacman" ]; then
pacman-files()
{
if [ $# -ne 1 ];then
if [ $# -lt 1 ];then
echo "Wrong number of arguments."
return
fi
echo "$1"
RESULT=""
RESULT_HUMAN="$(du -bh $(pacman -Qlq "$@" | grep -v ".*/$" | sort -u))"
RESULT="$(du -b $(pacman -Qlq "$@" | grep -v ".*/$" | sort -u))"
echo "${RESULT_HUMAN}"
for i in $(pacman -Qlq $1); do
if [ -f "$i" ]; then
RESULT+="$(du -sh "$i")\n"
fi
done
echo -e "${RESULT}" | grep -v "^$" | sort -h
echo -n "Total: "
_pacman_set_vars
pacman -Qi $1 | grep "$pacman_size" | sed 's/^[^[:digit:]]*//'
_pacman_unset_vars
echo "$RESULT" | awk -F "[[:alpha:]]" '{TOTAL=$1+TOTAL} END {printf("Total: %d KiB\n",TOTAL/1024)}'
}
fi
@ -492,7 +482,10 @@ fi
if [ -f "/usr/bin/pacman" ]; then
pacman-official()
{
diff <(pacman -Qq|sort) <(pacman -Qmq | sort) --new-line-format='' --unchanged-group-format='%>'
# 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
@ -500,9 +493,6 @@ fi
if [ -f "/usr/bin/pacman" ]; then
pacman-diff()
{
OPTION_FOREIGN=""
OPTION_LOCAL=">"
printhelp()
{
echo "Synopsis:"
@ -518,7 +508,7 @@ if [ -f "/usr/bin/pacman" ]; then
OPTION_EXPLICIT=""
OPTION_FOREIGN=""
OPTION_LOCAL=">"
OPTION_LOCAL="-1"
while getopts ":hmqe" opt; do
case $opt in
@ -533,7 +523,7 @@ if [ -f "/usr/bin/pacman" ]; then
OPTION_FOREIGN="m"
;;
q)
OPTION_LOCAL="<"
OPTION_LOCAL="-2"
;;
?)
printhelp "$0"
@ -555,8 +545,8 @@ if [ -f "/usr/bin/pacman" ]; then
return 1
fi
## TODO: Use pacman-official diff parameters.
diff <(pacman -Qq${OPTION_FOREIGN}${OPTION_EXPLICIT} | sort) <(cat "$*" | sort) | grep "${OPTION_LOCAL}" | cut -f2 -d" "
comm -3 ${OPTION_LOCAL} <(pacman -Qq${OPTION_FOREIGN}${OPTION_EXPLICIT} | sort) <(sort "$*")
}
fi
@ -623,12 +613,12 @@ if [ -f "/usr/bin/pacman" ]; then
echo "$RESULT"
## Print total size.
echo "$RESULT" | awk '{TOTAL=$1+TOTAL} END {printf("Total : %d KiB\n",TOTAL)}'
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)}')
# | tee >(awk '{TOTAL=$1+TOTAL} END {printf("Total: %d KiB\n",TOTAL)}')
_pacman_unset_vars
}

16
README
View File

@ -1,7 +1,7 @@
################################################################################
# Unix Home Configuration #
# Author: Ambrevar #
# Date: 2012-07-17 #
# Date: 2012-07-20 #
################################################################################
Synopsis
@ -55,11 +55,13 @@ Vicious plugin, it is quite straightforward.
Emacs
*****
Extra deps: auctex, auto-complete, emacs-lua-mode, emacs-yasnippet,
Extra deps: auctex, auto-complete, emacs-lua-mode, emacs-mediawiki,
emacs-yasnippet.
Some keybindings and custom colors. (I find it more convenient on a 256-colors
terminal.) Some customization -- columns, kill whole line, etc. Some plugins
customization too.
Some keybindings and custom colors (for 256-colors terminals). Extended file
support (shell files, mutt mails, Arch Linux PKGBUILDs). Some customization --
columns, kill whole line, etc. Some plugins customization too (LaTeX, Mediawiki,
snippets). Some custom functions (duplicate line, unfill-paragraph, etc.).
Luakit
******
@ -81,8 +83,8 @@ I use GPG for password management, mostly because it features a password agent.
I'm using embedded imap and smtp services -- you must provide the required
compilation options.
Some customization: custom index view, good Emacs integration -- see .emacs --,
custom theme, various tweaks.
Some customization: custom index view, good Emacs integration (see .emacs),
custom theme (matches Emacs colors), various tweaks.
Ranger
******