Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Keyboard Macro?



On Apr 18, 10:26pm, Frank Terbeck wrote:
} Subject: Re: Keyboard Macro?
}
} zzapper <david@xxxxxxxxxx>:
} > I guess I could write a script, but what I'd really like is some kind of 
} > keyboard macro which would spit out the above if I typed say cpfl (copy
} > first to last)
} > 
} > Ideas? I'd use Shortkeys but that doesn't work on De-Vista-ted
} 
} Maybe:
} 
}   bindkey -s '^xC' 'cp _!\^ _!$'

or
    bindkey -s 'cpfl' 'cp _!\^ _!$'

Gotta type it fast, though.

Why not e.g.

    cpfl() {
      emulate -L zsh
      local -a last
      last=( ${(z)history[$[HISTCMD-1]]} )
      cp -iv $last[2] $last[-1]
    }



Messages sorted by: Reverse Date, Date, Thread, Author