## UserStartup for Eddie
##
## To turn on Emacs emulation mode, uncomment the appropriate lines at the
## end 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 'p4 edit $DOCUMENT >/dev/null 2>/dev/null && p4 lock $DOCUMENT' -worksheet -appendToEnd
AddToExecuteDialog 'File $DOCUMENT' -worksheet -appendToEnd -pasteOnly
AddToExecuteDialog 'p4 diff $DOCUMENT' -worksheet -appendToEnd
AddToExecuteDialog 'p4 revert $DOCUMENT' -worksheet -appendToEnd
AddToExecuteDialog 'p4 add $DOCUMENT' -worksheet -appendToEnd
AddToExecuteDialog 'p4 edit $DOCUMENT' -worksheet -appendToEnd
AddToExecuteDialog 'chmod +w $DOCUMENT'
AddToExecuteDialog 'chmod -w $DOCUMENT'
AddToExecuteDialog 'grep -n $SELECTED_TEXT "$DOCUMENT_DIR"/*.[ch]*' -worksheet -pasteOnly
AddToExecuteDialog 'grep -n $SELECTED_TEXT "$TARGET_DIR"/*.[ch]*' -worksheet -appendToEnd
# AddToExecuteDialog '# available variables: doc: $DOCUMENT $DOCUMENT_DIR worksheet: $WORKSHEET $WORKSHEET_DIR target: $TARGET $TARGET_DIR selection: $SELECTED_TEXT eddie: $EDDIE $EDDIE_HOME' -worksheet -pasteOnly


## add items to the worksets window context menu
## first add items for a context menu invoked on files

AddToWorksetsFileContextMenu -name 'Touch files' 'touch $SELECTED_DOCUMENTS'
AddToWorksetsFileContextMenu -name 'Check out' 'p4 edit $SELECTED_DOCUMENTS >/dev/null 2>/dev/null && p4 lock $SELECTED_DOCUMENTS' -worksheet -appendToEnd
AddToWorksetsFileContextMenu -name 'chw' 'p4 edit $SELECTED_DOCUMENTS' -worksheet -appendToEnd
AddToWorksetsFileContextMenu -name 'add' 'p4 add $SELECTED_DOCUMENTS' -worksheet -appendToEnd
AddToWorksetsFileContextMenu -name 'Cancel check out' 'p4 revert $SELECTED_DOCUMENTS' -worksheet -appendToEnd
AddToWorksetsFileContextMenu -name 'Diff' 'p4 diff $SELECTED_DOCUMENTS' -worksheet -appendToEnd
AddToWorksetsFileContextMenu -name 'Make read only' 'chmod -w $SELECTED_DOCUMENTS'
AddToWorksetsFileContextMenu -name 'Make writable' 'chmod +w $SELECTED_DOCUMENTS'

## next add items for a context menu invoked either on groups or files

AddToWorksetsContextMenu -name 'Paste path' '$SELECTED_DOCUMENTS' -worksheet -pasteOnly

# 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" notatition 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-Control-D 			OpenHeader
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

# Mac-style selection expansion shortcuts
# 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 Control-Shift-LeftArrow		ExtendOrShrinkToSubwordLeft
SetKey Option-Shift-LeftArrow 		ExtendOrShrinkToWordLeft
SetKey Command-Shift-LeftArrow 		ExtendOrShrinkToLineLeft
SetKey Control-Shift-RightArrow		ExtendOrShrinkToSubwordRight
SetKey Option-Shift-RightArrow 		ExtendOrShrinkToWordRight
SetKey Command-Shift-RightArrow 	ExtendOrShrinkToLineRight

SetKey Shift-Home 					ExtendToDocumentBeginning
SetKey Shift-End			 		ExtendToDocumentEnd

SetKey Shift-Control-UpArrow		FPGoToPreviousFunction
SetKey Shift-Control-DownArrow		FPGoToNextFunction

# deleting
SetKey Command-Backspace			DeleteToDocumentEnd
SetKey Command-Delete				DeleteToDocumentEnd
SetKey Command-Shift-Backspace		DeleteFromDocumentBeginning
SetKey Command-Shift-Delete			DeleteFromDocumentBeginning
SetKey Option-Backspace				DeleteToLineEnd
SetKey Option-Shift-Backspace		DeleteFromLineBeginning
SetKey Option-Delete				DeleteToLineEnd
SetKey Option-Shift-Delete			DeleteFromLineBeginning
SetKey Control-Backspace			DeleteLine
SetKey Control-Delete				DeleteLine
SetKey Shift-Delete					Delete
SetKey Shift-Backspace				Backspace

# 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 Option-Command-LeftArrow		SwapWordLeft
SetKey Option-Command-RightArrow	SwapWordRight
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
SetKey Kp3							PasteExtended3
SetKey Option-Kp3					PasteFromStackExtended3
SetKey Command-Kp3					CopyExtended3
SetKey Command-Shift-Kp3			CopyAndAppendExtended3
SetKey Command-Option-Kp3			CopyOnStackExtended3
SetKey Control-Kp3					ClearClipboardExtended3
SetKey Command-Control-Kp3			SwapWithClipboardExtended3

# search/replace
SetKey Command-E 					EnterFindString
SetKey Command-Option-E				EnterReplaceString
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 Option-Tab					ShellInsertTab

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

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

##commenter
SetKey Command-/ 					UncommentOrPreferredComment
SetKey Command-Option-/ 			UncommentOrAlternateComment

##functionPopup
SetKey Control-Shift-UpArrow		FPGoToPreviousFunction
SetKey Control-Shift-DownArrow		FPGoToNextFunction

##find settings

SetKey Command-Control-S			ToggleCaseSensitiveSearch
SetKey Command-Control-W			ToggleWholeWordSearch
SetKey Command-Control-X			ToggleRegExpSearch
SetKey Command-Control-A			ToggleWrapAroundSearch
SetKey Command-Control-F			FindPanelToggleKeepInFront

# FindWindow specific keyboard shortcuts

EditKeymap Find_map

SetKey Command-Control-S			ToggleCaseSensitiveSearch
SetKey Command-Control-W			ToggleWholeWordSearch
SetKey Command-Control-X			ToggleRegExpSearch
SetKey Command-Control-A			ToggleWrapAroundSearch
SetKey Command-Control-F			FindPanelToggleKeepInFront
SetKey Option-Return				FindPanelInsertReturn
SetKey Option-Tab					FindPanelInsertTab
SetKey Option-Return				FindPanelInsertReturn
SetKey Tab							FindPanelFocusNext
SetKey Shift-Tab					FindPanelFocusPrevious
SetKey Return						FindPanelInvokeDefault

# QuickFindWindow specific keyboard shortcuts

EditKeymap QuickFind_map

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

############# alternative keymaps ###################################
## if you never use the following maps, you may delete them, this
## will take a millisecond or two of Eddie launch time
 
###### 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 Option-Tab					ShellInsertTab

# non-emacs 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 Control-Command-LeftArrow	SwapWithPreviousCharacter
SetKey Control-Command-RightArrow	SwapWithNextCharacter
SetKey Option-Command-LeftArrow		SwapWordLeft
SetKey Option-Command-RightArrow	SwapWordRight

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
SetKey Kp3							PasteExtended3
SetKey Option-Kp3					PasteFromStackExtended3
SetKey Command-Kp3					CopyExtended3
SetKey Command-Shift-Kp3			CopyAndAppendExtended3
SetKey Command-Option-Kp3			CopyOnStackExtended3
SetKey Control-Kp3					ClearClipboardExtended3
SetKey Command-Control-Kp3			SwapWithClipboardExtended3

## 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

################# Language support defines ###############################
########### User defined words for the syntax coloring plugin ############
### keep these in long lines to shave off a millisecond during startup ###

SCAddUserDefinedCWords uchar int8 uint8 int16 uint16 int32 uint32 int64 uint64 status_t thread_id team_id bigtime_t time_t off_t size_t
SCAddUserDefinedCWords BMessage BView BWindow BRect BButton BControl

SCAddUserDefinedMakeWords AR AS CC CXX YACC BISON LEX FLAX LD TAGS CFLAGS CPPFLAGS CXXFLAGS LDFLAGS INCLUDES 
SCAddUserDefinedMakeWords MAKE MAKEFILES VPATH SHELL MAKELEVEL MAKEFLAGS SUFFIXES
SCAddUserDefinedMakeWords clean all install tar
SCAddUserDefinedMakeWords BELIBFILES BELIBRARIES BUILDHOME BEINCLUDES OBJS

