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 () (setq mediawiki-mode-hook (lambda ()
(visual-line-mode 1) (visual-line-mode 1)
(turn-off-auto-fill) (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 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 if [ -f "/usr/bin/pacman" ]; then
pacman-files() pacman-files()
{ {
if [ $# -ne 1 ];then if [ $# -lt 1 ];then
echo "Wrong number of arguments." echo "Wrong number of arguments."
return return
fi fi
echo "$1" RESULT_HUMAN="$(du -bh $(pacman -Qlq "$@" | grep -v ".*/$" | sort -u))"
RESULT="" RESULT="$(du -b $(pacman -Qlq "$@" | grep -v ".*/$" | sort -u))"
echo "${RESULT_HUMAN}"
for i in $(pacman -Qlq $1); do echo "$RESULT" | awk -F "[[:alpha:]]" '{TOTAL=$1+TOTAL} END {printf("Total: %d KiB\n",TOTAL/1024)}'
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
} }
fi fi
@ -492,7 +482,10 @@ fi
if [ -f "/usr/bin/pacman" ]; then if [ -f "/usr/bin/pacman" ]; then
pacman-official() 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 fi
@ -500,9 +493,6 @@ fi
if [ -f "/usr/bin/pacman" ]; then if [ -f "/usr/bin/pacman" ]; then
pacman-diff() pacman-diff()
{ {
OPTION_FOREIGN=""
OPTION_LOCAL=">"
printhelp() printhelp()
{ {
echo "Synopsis:" echo "Synopsis:"
@ -518,7 +508,7 @@ if [ -f "/usr/bin/pacman" ]; then
OPTION_EXPLICIT="" OPTION_EXPLICIT=""
OPTION_FOREIGN="" OPTION_FOREIGN=""
OPTION_LOCAL=">" OPTION_LOCAL="-1"
while getopts ":hmqe" opt; do while getopts ":hmqe" opt; do
case $opt in case $opt in
@ -533,7 +523,7 @@ if [ -f "/usr/bin/pacman" ]; then
OPTION_FOREIGN="m" OPTION_FOREIGN="m"
;; ;;
q) q)
OPTION_LOCAL="<" OPTION_LOCAL="-2"
;; ;;
?) ?)
printhelp "$0" printhelp "$0"
@ -555,8 +545,8 @@ if [ -f "/usr/bin/pacman" ]; then
return 1 return 1
fi fi
## TODO: Use pacman-official diff parameters. comm -3 ${OPTION_LOCAL} <(pacman -Qq${OPTION_FOREIGN}${OPTION_EXPLICIT} | sort) <(sort "$*")
diff <(pacman -Qq${OPTION_FOREIGN}${OPTION_EXPLICIT} | sort) <(cat "$*" | sort) | grep "${OPTION_LOCAL}" | cut -f2 -d" "
} }
fi fi
@ -623,12 +613,12 @@ if [ -f "/usr/bin/pacman" ]; then
echo "$RESULT" echo "$RESULT"
## Print total size. ## 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. ## One line version. ~ same performance.
# eval "${CMD} $@ 2>/dev/null" | awk -F "$SEP" -v filter="$pacman_size" -v pkg="$pacman_name" \ # 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 \ # '$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 _pacman_unset_vars
} }

16
README
View File

@ -1,7 +1,7 @@
################################################################################ ################################################################################
# Unix Home Configuration # # Unix Home Configuration #
# Author: Ambrevar # # Author: Ambrevar #
# Date: 2012-07-17 # # Date: 2012-07-20 #
################################################################################ ################################################################################
Synopsis Synopsis
@ -55,11 +55,13 @@ Vicious plugin, it is quite straightforward.
Emacs 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 Some keybindings and custom colors (for 256-colors terminals). Extended file
terminal.) Some customization -- columns, kill whole line, etc. Some plugins support (shell files, mutt mails, Arch Linux PKGBUILDs). Some customization --
customization too. columns, kill whole line, etc. Some plugins customization too (LaTeX, Mediawiki,
snippets). Some custom functions (duplicate line, unfill-paragraph, etc.).
Luakit 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 I'm using embedded imap and smtp services -- you must provide the required
compilation options. compilation options.
Some customization: custom index view, good Emacs integration -- see .emacs --, Some customization: custom index view, good Emacs integration (see .emacs),
custom theme, various tweaks. custom theme (matches Emacs colors), various tweaks.
Ranger Ranger
****** ******