## UserStartup for Eddie
## define some MPW - like shortcuts
##
## To turn on Emacs emulation mode, uncomment the last four lines of this
## file

## add some handy commands to the execute dialog
## most of the following are specific to the Perforce source control commands,
## you should be able to customize them for your source control system or other
## purposes
AddToExecuteDialog 'cho $DOCUMENT' -worksheet -appendToEnd
AddToExecuteDialog 'File $DOCUMENT' -worksheet -appendToEnd -pasteOnly
AddToExecuteDialog 'chdiff $DOCUMENT' -worksheet -appendToEnd
AddToExecuteDialog 'chcan $DOCUMENT' -worksheet -appendToEnd
AddToExecuteDialog 'chw $DOCUMENT' -worksheet -appendToEnd
AddToExecuteDialog 'chmod +w $DOCUMENT'
AddToExecuteDialog 'chmod -w $DOCUMENT'
AddToExecuteDialog 'cd `dirname $DOCUMENT` ; for i in * ; do echo $i ; done' -worksheet -appendToEnd

# add path to be used by Command-D; individual paths separated by ":"
# for now have to use absolute paths, shell variables not yet recognized;
# each path is searched recursively
# current directory is handled in a special way - if only "." is specified, it is
# only searched at the first level; if ".-r" notaition is used, a recursive search
# of the current directory is performed
OpenHeaderSearchPath ".:/boot/develop/headers:.-r"

## This is the preferred MPW-style keyboard map

EditKeymap MPW_like

# fancy document openning shortcuts
SetKey Command-Tab 					SwapWithHeaderFile
SetKey Command-D 					OpenSelection
SetKey Command-Option-D 			SimpleOpenSelection
SetKey Command-Option-P 			ActivateNextWindow
SetKey Shift-Command-Option-P 		ActivatePreviousWindow
SetKey Command-0 					ActivateWorksheet
SetKey Command-Option-O				OpenFromDocumentsDir
SetKey Command-S					Save

# cusror navigation shortcuts
SetKey Shift-LeftArrow 				ExtendOrShrinkLeft
SetKey Shift-RightArrow 			ExtendOrShrinkRight
SetKey Shift-UpArrow 				ExtendOrShrinkUp
SetKey Shift-DownArrow 				ExtendOrShrinkDown

SetKey Control-LeftArrow			SelectSubwordBeginning
SetKey Option-LeftArrow 			SelectWordBeginning
SetKey Command-LeftArrow 			SelectLineBeginning
SetKey Control-RightArrow			SelectSubwordEnd
SetKey Option-RightArrow 			SelectWordEnd
SetKey Command-RightArrow 			SelectLineEnd
SetKey Command-UpArrow 				GoToHome
SetKey Option-UpArrow 				GoToPageUp
SetKey Command-DownArrow 			GoToEnd
SetKey Option-DownArrow 			GoToPageDown
SetKey Option-PageUp 				GoToPageUp
SetKey Option-PageDown	 			GoToPageDown
SetKey Option-Home 					GoToHome
SetKey Option-End	 				GoToEnd
SetKey Control-Shift-LeftArrow		ExtendToSubwordBeginning
SetKey Option-Shift-LeftArrow 		ExtendToWordBeginning
SetKey Command-Shift-LeftArrow 		ExtendToLineBeginning
SetKey Control-Shift-RightArrow		ExtendToSubwordEnd
SetKey Option-Shift-RightArrow 		ExtendToWordEnd
SetKey Command-Shift-RightArrow 	ExtendToLineEnd
SetKey Shift-Home 					ExtendToDocumentBeginning
SetKey Shift-End			 		ExtendToDocumentEnd

# deleting
SetKey Command-Backspace			DeleteToDocumentEnd
SetKey Option-Backspace				DeleteToLineEnd
SetKey Option-Shift-Backspace		DeleteLine

# formatting
SetKey Command-B 					Balance
SetKey Command-[ 					IndentLeft
SetKey Command-] 					IndentRight
SetKey Control-Command-UpArrow		SwapWithPreviousLine
SetKey Control-Command-DownArrow	SwapWithNextLine
SetKey Control-Command-LeftArrow	SwapWithPreviousCharacter
SetKey Control-Command-RightArrow	SwapWithNextCharacter
SetKey Command-U					UpperCaseWord

# extended clipboard functions
SetKey Command-Option-C 			CopyOnStack
SetKey Command-Option-V 			PasteFromStack
SetKey Command-Control-V 			SwapWithClipboard
SetKey Command-Option-X 			CutOnStack
SetKey Command-Shift-C				CopyAndAppend
SetKey Command-Shift-X				CutAndAppend
SetKey Kp1							PasteExtended1
SetKey Option-Kp1					PasteFromStackExtended1
SetKey Command-Kp1					CopyExtended1
SetKey Command-Shift-Kp1			CopyAndAppendExtended1
SetKey Command-Option-Kp1			CopyOnStackExtended1
SetKey Control-Kp1					ClearClipboardExtended1
SetKey Command-Control-Kp1			SwapWithClipboardExtended1
SetKey Kp2							PasteExtended2
SetKey Option-Kp2					PasteFromStackExtended2
SetKey Command-Kp2					CopyExtended2
SetKey Command-Shift-Kp2			CopyAndAppendExtended2
SetKey Command-Option-Kp2			CopyOnStackExtended2
SetKey Control-Kp2					ClearClipboardExtended2
SetKey Command-Control-Kp2			SwapWithClipboardExtended2

# search/replace
SetKey Command-E 					EnterFindString
SetKey Command-F 					OpenFindPanel
SetKey Command-Option-F				OpenQuickFindPanel
SetKey Command-Control-F			OpenQuickFindPanelFromCurrentPos
SetKey Command-G 					FindAgain
SetKey Shift-Command-G 				ReverseFindAgain
SetKey Command-H 					EnterAndFind
SetKey Shift-Command-H 				EnterAndFindReverse
SetKey Command-T 					ReplaceAndFind

SetKey Command-L 					GoToLine

#fancy editing
SetKey Command-Control-I			OpenBefore
SetKey Command-Control-Shift-I		OpenAfter

#shell only shortcuts
SetKey Control-C					ShellBreak
SetKey Command-.					ShellBreak
SetKey Return						ShellExecute
SetKey Command-Return				ShellInsertReturn
SetKey Control-Return				ShellInsertReturn
SetKey Tab							ShellTabComplete
SetKey Control-Tab					ShellInsertTab

#prototyper
SetKey Control-Option-P				PrototyperGetOrPastePrototypes
SetKey Control-P					PrototyperGetOrPasteAllPrototypes

##ifdef balancer
SetKey Command-Option-B 			IfdefBalancerBalance
SetKey Command-Shift-B 				IfdefBalancerInclusiveBalance

# QuickFindWindow specific keyboard shortcuts

EditKeymap QuickFind_map

SetKey Command-G					QuickFindNext
SetKey Command-Shift-G				QuickFindPrevious
SetKey Control-S					QuickFindNext
SetKey Control-R					QuickFindPrevious

############# define some funny maps ###########################
## if you never use the following maps, you may delete them, this
## will take a millisecond or two of Eddie launch time
 
###### Rudiment of a vi-like map to illustrate how maps are defined

NewKeymap vi_like -beeping

SetKey Shift-:						ActivateAlternate1Map
SetKey I							ActivateAlternate2Map

NewKeymap vi_command -oneShot -beeping

SetKey W							Save
SetKey B							Beep

NewKeymap vi_insertion

SetKey Escape						ActivateDefaultMap

#SetDefaultKeymap vi_like
#SetAlternate1Keymap vi_command
#SetAlternate2Keymap vi_insertion

###### Emacs-like map ########

NewKeymap emacs_like

#navgiation
SetKey Control-V					GoToPageDown
SetKey Command-V					GoToPageUp

SetKey Control-P					UpArrow
SetKey Control-N					DownArrow
SetKey Control-B					LeftArrow
SetKey Control-F					RightArrow

SetKey Command-B					SelectWordBeginning
SetKey Command-F					SelectWordEnd

SetKey Control-A					SelectLineBeginning
SetKey Control-E					SelectLineEnd

SetKey Command-Shift-.				GoToEnd
SetKey Command-Shift-,				GoToHome

# deleting
SetKey Backspace					Backspace
SetKey Control-D					Delete

SetKey Command-Backspace			DeleteFromWordBeginning
SetKey Command-D					EmacsKillToWordEnd
SetKey Control-K					EmacsKillToLineEnd

# yank
SetKey Control-Y					EmacsYank
SetKey Command-Y					EmacsYankPop
SetKey Control-W					Cut

# undo
SetKey Control-Shift--				Undo

# misc
SetKey Control-S					OpenQuickFindPanel
SetKey Control-X					ActivateAlternate1Map
SetKey Control-T					Transpose

SetKey Command-L					LowerCaseWord
SetKey Command-U					UpperCaseWord
SetKey Command-C					CapitalizeWord

SetKey Control-O					OpenLine
SetKey Control-Option-O				OpenBefore
SetKey Control-Shift-Option-O		OpenAfter

# alternate meta key
SetKey Escape						ActivateAlternate2Map

#shell only shortcuts
SetKey Control-C					ShellBreak
SetKey Command-.					ShellBreak
SetKey Return						ShellExecute
SetKey Command-Return				ShellInsertReturn
SetKey Control-Return				ShellInsertReturn
SetKey Tab							ShellTabComplete
SetKey Control-Tab					ShellInsertTab

# generic stuff that won't hurt having
SetKey Backspace					Backspace
SetKey Delete						Delete
SetKey DownArrow					DownArrow
SetKey UpArrow						UpArrow
SetKey RightArrow					RightArrow
SetKey LeftArrow					LeftArrow
SetKey PageUp						GoToPageUp
SetKey PageDown						GoToPageDown
SetKey Home							GoToHome
SetKey End							GoToEnd
SetKey Control-Command-UpArrow		SwapWithPreviousLine
SetKey Control-Command-DownArrow	SwapWithNextLine

SetKey Command-G					GoToLine

SetKey Kp1							PasteExtended1
SetKey Option-Kp1					PasteFromStackExtended1
SetKey Command-Kp1					CopyExtended1
SetKey Command-Shift-Kp1			CopyAndAppendExtended1
SetKey Command-Option-Kp1			CopyOnStackExtended1
SetKey Control-Kp1					ClearClipboardExtended1
SetKey Command-Control-Kp1			SwapWithClipboardExtended1
SetKey Kp2							PasteExtended2
SetKey Option-Kp2					PasteFromStackExtended2
SetKey Command-Kp2					CopyExtended2
SetKey Command-Shift-Kp2			CopyAndAppendExtended2
SetKey Command-Option-Kp2			CopyOnStackExtended2
SetKey Control-Kp2					ClearClipboardExtended2
SetKey Command-Control-Kp2			SwapWithClipboardExtended2

## this map gets activated by Control-X

NewKeymap emacs_like_alternate1 -oneShot -beeping -mapHint C-X

SetKey U							Undo
SetKey Control-F					OpenDocument
SetKey Control-S					Save
SetKey Control-W					SaveAs
SetKey Control-C					Quit

#pane splitting
SetKey 0							UnsplitPane
SetKey 2							SplitPaneHorizontal
SetKey 3							SplitPaneVertical

## this map is for supporting Escape instead of the Meta key

NewKeymap emacs_like_Meta -oneShot -beeping -mapHint M-

SetKey V							GoToPageUp

SetKey B							SelectWordBeginning
SetKey F							SelectWordEnd

SetKey Shift-.						GoToEnd
SetKey Shift-,						GoToHome

SetKey Backspace					DeleteFromWordBeginning
SetKey D							EmacsKillToWordEnd

SetKey Y							EmacsYankPop

SetKey G							GoToLine

SetKey L							LowerCaseWord
SetKey U							UpperCaseWord
SetKey C							CapitalizeWord

# make SetKey display the MPW keyboard
EditKeymap MPW_like

#uncomment these to use emacs emulation
#SetDefaultKeymap emacs_like
#EditKeymap emacs_like
#SetAlternate1Keymap emacs_like_alternate1
#SetAlternate2Keymap emacs_like_Meta
