[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Vim tip (was Re: Suspend/Resume issues - Custom scripts not running? Mouse frozen?)



On Sat, Feb 21, 2009 at 06:59:15AM +0100, Javier wrote:
> You should use /etc/pm/sleep.d for these purposes. For example, create a
> new file in /etc/pm/sleep.d/10key_issue with this content:
> 
> #!/bin/sh
> case "$1" in
> 	hibernate|suspend)
> 		echo -n "i8042" > /sys/bus/platform/drivers/i8042/unbind
> 		;;
> 	thaw|resume)
> 		echo -n "i8042" > /sys/bus/platform/drivers/i8042/bind
> 		;;
> 	*) exit $NA
> 		;;
> esac
> 
> Of course, you can replace the content with your needs.
> Don't forget to chmod +x once saved.

If you use vim for your editing, put this in your .vimrc file:

" automatically give executable permissions if file begins with #! and
" contains '/bin/' in the path

function ModeChange()
  if getline(1) =~ "^#!"
    if getline(1) =~ "/bin/"
      silent !chmod a+x <afile>
    endif
  endif
endfunction

au BufWritePost * call ModeChange()

-- 
Chris.
======
I contend that we are both atheists. I just believe in one fewer god
than you do. When you understand why you dismiss all the other
possible gods, you will understand why I dismiss yours.
                                           -- Stephen F Roberts


Reply to: