home *** CD-ROM | disk | FTP | other *** search
- set more [get env PAGER]
- if { [length $more chars] == 0 } { set more more }
-
- proc perror {} {
- browse message [get error]
- browse bell
- }
-
- proc target {} {
- set file [get file *]
- if {[length $file chars]==0} {set file [get file .]}
- return $file
- }
-
- proc key_'j' {} {
- if { ![browse move +1] } { browse bell }
- }
- proc key_'k' {} {
- if { ![browse move -1] } { browse bell }
- }
- proc key_':' {} {
- set command [get response :]
- if { [length $command chars] > 0 } {
- if { [catch {eval $command} response] != 0 } {
- browse message Error: $response
- } else {
- if { [length $response chars] > 0 } {
- browse message Response: $response
- }
- }
- }
- }
- proc key_'!' {} {
- global shellcmd
- set command [get response ! shellcmd]
- if { [length $command chars] > 0 } {
- browse shell $command
- set shellcmd $command
- }
- }
- proc key_space {} {
- global more
- set file [get file .]
- if { ![browse chdir $file] } {
- set file [target]
- eval [concat browse tag - $file]
- browse message !$more $file
- browse shell [concat $more $file]
- }
- }
- proc key_'q' {} {
- if { [string compare q [get key -q-]] == 0 } {
- browse exit
- } else {
- browse message
- }
- }
- proc key_'^J' {} {
- if { [string match *line [get mode]] } { browse redraw }
- }
- proc key_'d' {} {
- if { [string compare d [get key -d-]] == 0 } {
- set file [target]
- set prompt [concat Delete $file {? }]
- if { [string match {[yY]} [get key $prompt]] } {
- if { ![eval [concat browse delete $file]] } {
- perror
- }
- }
- }
- }
- proc cdhelp {name def} {
- set dir $name[get response [concat chdir $name] $def]
- if { ![browse chdir $dir] } { perror }
- }
- proc key_'=' {} { cdhelp {} [get file .] }
- proc key_'.' {} { cdhelp . {} }
- proc key_'/' {} { cdhelp / {} }
- proc key_'~' {} { cdhelp [get env HOME] {} }
- proc key_'t' {} { eval [concat browse tag / [get file .]] }
- proc key_'H' {} { browse move [get line home] }
- proc key_'L' {} { browse move [get line last] }
- proc key_dollar_sign {} { browse move [get line end] }
- proc key_'J' {} { browse move [get line end] }
- proc key_'^' {} { browse move 0 }
- proc key_'K' {} { browse move 0 }
- proc key_'M' {} { browse move [expr ([get line home]+[get line last])/2] }
- proc key_'<' {} { browse mode narrow }
- proc key_'>' {} { browse mode wide }
- proc key_'^R' {} { browse rescan }
- proc key_'^L' {} { browse redraw }
-
- proc key_'r' {} {
- set file [get file .]
- set prompt [concat Rename $file {to }]
- set new_file [get response $prompt $file]
- if { ![browse rename $file $new_file] } {
- perror
- }
- }
-
- proc key_'R' {} {
- set files [get file *]
- if { [length files] == 0 } {
- key_'r'
- } else {
- set dir [get response {Move tagged files to }]
- foreach file $files {
- if { ![browse rename $file $dir/$file] } {
- perror
- return
- }
- }
- }
- }
-
- proc key_'v' {} {
- set command [concat vi [get file .]]
- browse message !$command
- browse shell $command
- }
-
- proc macro_'#' {} { return [get cwd] }
- proc macro_'%' {} { return [get file .] }
- proc macro_'~' {} { return [get env HOME] }
-
- proc key_'^F' {} {
- browse move [expr {[get line .]+10}]
- }
-
- proc key_'^B' {} {
- browse move [expr {[get line .]-10}]
- }
-
- proc key_'+' {} {
- set file [get response {Add file: }]
- if { [length $file chars] > 0 } {
- if { ![browse add $file] } {
- perror
- }
- }
- }
-
- proc key_'p' {} {
- set files [target]
- eval [concat browse tag /P [target]]
- eval [concat browse tag -T [target]]
- }
-