diff --git a/colortest.pl b/colortest.pl index c2cc550..3a71a39 100755 --- a/colortest.pl +++ b/colortest.pl @@ -1,8 +1,5 @@ #! /usr/bin/env perl -use strict; -use warnings; - # Generate the array # Fill in the first 16 colors. The exact hex codes vary by terminal and device @@ -35,7 +32,6 @@ print "\n"; sub number_to_color { - use integer; my $num = shift; $num -= 16; diff --git a/commonsh/02_term b/commonsh/02_term index 0c3186e..84d1a42 100755 --- a/commonsh/02_term +++ b/commonsh/02_term @@ -30,8 +30,11 @@ fix_term () screen?*) fix_term screen ;; - putty?*) - fix_term putty + putty-vt100) + echo "vt100" + ;; + putty-256color) + fix_term xterm-256color ;; *) echo "vt100" diff --git a/commonsh/10_utility b/commonsh/10_utility index faa5942..4fc26d3 100755 --- a/commonsh/10_utility +++ b/commonsh/10_utility @@ -61,6 +61,9 @@ extract () *.lzma) lzma -dc "${1}" > `basename "${1%.*}"` ;; + *.7z) + 7zr x "${1}" + ;; *) echo "Unable to extract '"$1"'" return 1 diff --git a/lock b/lock index 9427e5f..ac5a571 100755 --- a/lock +++ b/lock @@ -1,10 +1,37 @@ #! /bin/sh -if [ `uname -s` = 'Darwin' ] ; then +# Yell if they are trying to lock remotely. This won't work. +# Even if it does, it's wrong. +if [ "${SSH_TTY}" ] && [ -z "${STY}" ] ; then + echo "You're doing it wrong. Don't try to lock a remote computer." + exit 1 +fi + +# Graphically locking on Macs is simple. +# If we're not in screen, attempt to graphically lock it. +if [ `uname -s` = 'Darwin' ] && [ -z "${STY}" ] ; then /System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend exit fi +# Handle non-graphical locking +if [ -z "${DISPLAY}" ] ; then + if [ -z "${STY}" ] ; then # not running screen + if ( command -v vlock >/dev/null 2>/dev/null ) ; then + vlock + exit + else + echo "You don't have vlock. Maybe try locking in screen." + fi + else + echo "You are in screen. Use 'C-a x' to lock" + fi + exit 1 +fi + +# Try to lock sanely on X11. +# Certain combinations of desktop managers and locking programs +# allow new sessions to be started. KDE_LOCK='kdesktop_lock --forcelock || krunner_lock --forcelock || /usr/libexec/kde4/krunner_lock --forcelock || /usr/lib/kde4/libexec/krunner_lock --forcelock' GNOME_LOCK='gnome-screensaver-command --lock' XSCREEN_LOCK='xscreensaver-command -lock || xlock' @@ -22,13 +49,13 @@ elif ( ps -e | grep xdm >/dev/null 2>/dev/null ) ; then eval $XSCREEN_LOCK 2>/dev/null && exit fi -echo Could not decide what desktop manager you are using. -echo Trying fallback locking. +echo "Could not decide what desktop manager you are using." +echo "Trying fallback locking." eval $KDE_LOCK 2>/dev/null && exit gnome-screensaver >/dev/null 2>/dev/null eval $GNOME_LOCK 2>/dev/null xscreensaver & >/dev/null 2>/dev/null eval $XSCREEN_LOCK 2>/dev/null && exit -echo Could not lock your screen. +echo "Could not lock your screen." exit 1 diff --git a/vim/plugin/detectindent.vim b/vim/plugin/detectindent.vim index 81dfb1e..266cb2e 100644 --- a/vim/plugin/detectindent.vim +++ b/vim/plugin/detectindent.vim @@ -21,7 +21,7 @@ fun! IsCommentStart(line) " &comments isn't reliable - if &ft == "c" || &ft == "cpp" + if &ft == "c" || &ft == "cpp" || &ft == "java" || &ft == "scala" return -1 != match(a:line, '/\*') elseif &ft == "perl" " catch POD in Perl return -1 != match(a:line, '^=\w') @@ -31,7 +31,7 @@ fun! IsCommentStart(line) endfun fun! IsCommentEnd(line) - if &ft == "c" || &ft == "cpp" + if &ft == "c" || &ft == "cpp" || &ft == "java" || &ft == "scala" return -1 != match(a:line, '\*/') elseif &ft == "perl" " catch POD return -1 != match(a:line, '^=cut') diff --git a/vimrc b/vimrc index 03b4c05..7033707 100644 --- a/vimrc +++ b/vimrc @@ -160,9 +160,6 @@ if has('mouse') endif if has('autocmd') - " unhighlight search when idle - autocmd CursorHold * nohls | redraw - " always refresh syntax from the start autocmd BufEnter * syntax sync fromstart @@ -248,8 +245,11 @@ map Y y$ vmap K k " :W and :Q are annoying -cmap W w -cmap Q q +command! -nargs=0 -bang X x +command! -nargs=0 -bang Q q +command! -nargs=0 -bang W w +command! -nargs=0 -bang WQ wq +command! -nargs=0 -bang Wq wq " just continue nmap K K @@ -257,6 +257,7 @@ nmap K K " Toggle numbers with F12 nmap :silent set number! imap :silent set number! +noremap :set hls! " Don't force column 0 for # inoremap # X# diff --git a/xmonad.hs b/xmonad.hs index 98c0bd4..797eef5 100644 --- a/xmonad.hs +++ b/xmonad.hs @@ -42,4 +42,5 @@ main = do `additionalKeysP` [ ("M-p", shellPrompt defaultXPConfig { position = Top }) , ("M-b", sendMessage ToggleStruts) + , ("M-S-l", spawn "~/bin/lock") ] diff --git a/zsh/completion b/zsh/completion index 05b91b0..49ad5e7 100755 --- a/zsh/completion +++ b/zsh/completion @@ -1,6 +1,9 @@ # completion menu zstyle ':completion:*' menu select=1 +# change the order up +zstyle ':completion:*:(cd|mv|cp):*' tag-order local-directories directory-stack named-directories path-directories + # neat-o new features zstyle ':completion:*' completer _expand _complete _prefix _correct _match _approximate diff --git a/zsh/title b/zsh/title index 2b5ac68..b793c11 100755 --- a/zsh/title +++ b/zsh/title @@ -58,7 +58,12 @@ function title # Use this for GNU Screen: print -nR $'\ek'$2$'\e'"\\" ;; - xterm*|*rxvt*|cygwin|interix|Eterm|mlterm|kterm|aterm|putty*) + interix) + # Use this for interix as "2" makes it upset + shift + print -nR $'\e]0;'$@$'\a' + ;; + xterm*|*rxvt*|cygwin|Eterm|mlterm|kterm|aterm|putty*) # Use this one instead for everybody else: shift print -nR $'\e]1;'$@$'\a' diff --git a/zsh/utility b/zsh/utility index 25c437a..efba731 100755 --- a/zsh/utility +++ b/zsh/utility @@ -1,6 +1,6 @@ # utility.sh # Miscellaneous Utility Functions -zstyle ':completion:*:*:extract:*' file-patterns '*.(tar|tar.gz|tgz|tar.Z|tar.bz2|tbz2|zip|ZIP|jar|gz|Z|z|bz2|rar|RAR|LHa|LHA|lha|lzh|a|deb|tar.lzma|lzma):Compressed\ Files *(-/):directories' +zstyle ':completion:*:*:extract:*' file-patterns '*.(tar|tar.gz|tgz|tar.Z|tar.bz2|tbz2|zip|ZIP|jar|gz|Z|z|bz2|rar|RAR|LHa|LHA|lha|lzh|a|deb|tar.lzma|lzma|7z):Compressed\ Files *(-/):directories' # vim: set ft=sh ts=3 sw=3 et: