## Main UserStartup for Eddie
##
## Contains setup of all the keyboard shortcuts and other customizable entries
##
## While it is perfectly OK to make changes in this file to suit your preferences,
## customization to UserStartup is best done in a local UserStartup file
## in /boot/home/config/settings/Eddie/UserStartup. That way your changes
## will not get overwritten each time you install a new copy of Eddie. This
## UserStartup file gets opened first, the local UserStartup second. You can
## therefore add and even undo the settings of this file in the local UserStartup
## in /boot/home/config/settings/Eddie/UserStartup.

## To turn on Emacs emulation mode, uncomment the appropriate lines near 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 Alt-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 Alt-Tab 						SwapWithHeaderFile
SetKey 'Alt-\' 						SwitchWithNext
SetKey Alt-D 						OpenSelection
SetKey Alt-Option-D 				SimpleOpenSelection
SetKey Alt-Control-D 				OpenHeader
SetKey Alt-Option-P 				ActivateNextWindow
SetKey Shift-Alt-Option-P 			ActivatePreviousWindow
SetKey Alt-0 						ActivateWorksheet
SetKey Alt-Option-0					ActivateWorkset
SetKey Alt-Option-O					OpenFromDocumentsDir
SetKey Alt-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 Alt-LeftArrow 				SelectLineBeginning
SetKey Control-RightArrow			SelectSubwordEnd
SetKey Option-RightArrow 			SelectWordEnd
SetKey Alt-RightArrow 				SelectLineEnd
SetKey Alt-UpArrow 					GoToHome
SetKey Option-UpArrow 				GoToPageUp
SetKey Alt-DownArrow 				GoToEnd
SetKey Option-DownArrow 			GoToPageDown
SetKey Option-PageUp 				GoToPageUp
SetKey Option-PageDown	 			GoToPageDown
SetKey Option-Home 					GoToHome
SetKey Option-End	 				GoToEnd
SetKey Control-UpArrow 				ScrollLineUp
SetKey Control-DownArrow 			ScrollLineDown
SetKey Control-Option-UpArrow 		ShowLineUp
SetKey Control-Option-DownArrow 	ShowLineDown

# Mac-style selection expansion shortcuts
# SetKey Control-Shift-LeftArrow	ExtendToSubwordBeginning
# SetKey Option-Shift-LeftArrow 	ExtendToWordBeginning
# SetKey Alt-Shift-LeftArrow 		ExtendToLineBeginning
# SetKey Control-Shift-RightArrow	ExtendToSubwordEnd
# SetKey Option-Shift-RightArrow 	ExtendToWordEnd
# SetKey Alt-Shift-RightArrow 		ExtendToLineEnd

SetKey Control-Shift-LeftArrow		ExtendOrShrinkToSubwordLeft
SetKey Option-Shift-LeftArrow 		ExtendOrShrinkToWordLeft
SetKey Alt-Shift-LeftArrow 			ExtendOrShrinkToLineLeft
SetKey Control-Shift-RightArrow		ExtendOrShrinkToSubwordRight
SetKey Option-Shift-RightArrow 		ExtendOrShrinkToWordRight
SetKey Alt-Shift-RightArrow 		ExtendOrShrinkToLineRight

SetKey Shift-Home 					ExtendToDocumentBeginning
SetKey Shift-End			 		ExtendToDocumentEnd

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

# deleting
SetKey Alt-Backspace				DeleteToDocumentEnd
SetKey Alt-Delete					DeleteToDocumentEnd
SetKey Alt-Shift-Backspace			DeleteFromDocumentBeginning
SetKey Alt-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 Alt-B 						Balance
SetKey Alt-[ 						IndentLeft
SetKey Alt-] 						IndentRight
SetKey Control-Alt-UpArrow			SwapWithPreviousLine
SetKey Control-Alt-DownArrow		SwapWithNextLine
SetKey Control-Alt-LeftArrow		SwapWithPreviousCharacter
SetKey Control-Alt-RightArrow		SwapWithNextCharacter
SetKey Option-Alt-LeftArrow			SwapWordLeft
SetKey Option-Alt-RightArrow		SwapWordRight
SetKey Alt-U						UpperCaseWord

# extended clipboard functions
SetKey Alt-Option-C 				CopyOnStack
SetKey Alt-Option-V 				PasteFromStack
SetKey Alt-Control-V 				SwapWithClipboard
SetKey Alt-Option-X 				CutOnStack
SetKey Alt-Shift-C					CopyAndAppend
SetKey Alt-Shift-X					CutAndAppend
SetKey Kp1							PasteExtended1
SetKey Option-Kp1					PasteFromStackExtended1
SetKey Alt-Kp1						CopyExtended1
SetKey Alt-Shift-Kp1				CopyAndAppendExtended1
SetKey Alt-Option-Kp1				CopyOnStackExtended1
SetKey Control-Kp1					ClearClipboardExtended1
SetKey Alt-Control-Kp1				SwapWithClipboardExtended1
SetKey Kp2							PasteExtended2
SetKey Option-Kp2					PasteFromStackExtended2
SetKey Alt-Kp2						CopyExtended2
SetKey Alt-Shift-Kp2				CopyAndAppendExtended2
SetKey Alt-Option-Kp2				CopyOnStackExtended2
SetKey Control-Kp2					ClearClipboardExtended2
SetKey Alt-Control-Kp2				SwapWithClipboardExtended2
SetKey Kp3							PasteExtended3
SetKey Option-Kp3					PasteFromStackExtended3
SetKey Alt-Kp3						CopyExtended3
SetKey Alt-Shift-Kp3				CopyAndAppendExtended3
SetKey Alt-Option-Kp3				CopyOnStackExtended3
SetKey Control-Kp3					ClearClipboardExtended3
SetKey Alt-Control-Kp3				SwapWithClipboardExtended3

# search/replace
SetKey Alt-E 						EnterFindString
SetKey Alt-Control-E				EnterReplaceString
SetKey Alt-F 						OpenFindPanel
SetKey Alt-Option-F					OpenQuickFindPanel
SetKey Alt-Control-F				OpenQuickFindPanelFromCurrentPos
SetKey Alt-G 						FindAgain
SetKey Shift-Alt-G 					ReverseFindAgain
SetKey Alt-H 						EnterAndFind
SetKey Shift-Alt-H 					EnterAndFindReverse
SetKey Alt-= 						ReplaceAndFind
SetKey Alt-T 						FindInNextDocument
SetKey Alt-Shift-T					FindInPreviousDocument

SetKey Alt-L 						GoToLine

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

#shell only shortcuts
SetKey Control-C					ShellBreak
SetKey Alt-.						ShellBreak
SetKey Return						ShellExecute
SetKey Alt-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 Alt-Option-B 				IfdefBalancerBalance
SetKey Alt-Shift-B 					IfdefBalancerInclusiveBalance

##commenter
SetKey Alt-/ 						UncommentOrPreferredComment
SetKey Alt-Option-/ 				UncommentOrAlternateComment
SetKey Control-Alt-/ 				UncommentOrCCommentSelection

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

##find settings

SetKey Alt-Control-S				ToggleCaseSensitiveSearch
SetKey Alt-Control-W				ToggleWholeWordSearch
SetKey Alt-Control-X				ToggleRegExpSearch
SetKey Alt-Control-A				ToggleWrapAroundSearch
SetKey Alt-Control-F				FindPanelToggleKeepInFront
SetKey Alt-Control-M 				ToggleMultiFileSearch
SetKey Alt-Control-G 				SetMultiFileSearchInWorkset
SetKey Alt-Control-P 				SetMultiFileSearchInDocumentDir

# FindWindow specific keyboard shortcuts

EditKeymap Find_map

SetKey Alt-Control-S				ToggleCaseSensitiveSearch
SetKey Alt-Control-W				ToggleWholeWordSearch
SetKey Alt-Control-X				ToggleRegExpSearch
SetKey Alt-Control-A				ToggleWrapAroundSearch
SetKey Alt-Control-F				FindPanelToggleKeepInFront
SetKey Alt-Control-M 				ToggleMultiFileSearch
SetKey Alt-Control-G 				SetMultiFileSearchInWorkset
SetKey Alt-Control-P 				SetMultiFileSearchInTargetDir
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 Alt-G						QuickFindNext
SetKey Alt-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 Alt-V						GoToPageUp

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

SetKey Alt-B						SelectWordBeginning
SetKey Alt-F						SelectWordEnd

SetKey Control-A					SelectLineBeginning
SetKey Control-E					SelectLineEnd

SetKey Alt-Shift-.					GoToEnd
SetKey Alt-Shift-,					GoToHome

# deleting
SetKey Backspace					Backspace
SetKey Control-D					Delete

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

# yank
SetKey Control-Y					EmacsYank
SetKey Alt-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 Alt-L						LowerCaseWord
SetKey Alt-U						UpperCaseWord
SetKey Alt-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 Alt-.						ShellBreak
SetKey Return						ShellExecute
SetKey Alt-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-Alt-UpArrow			SwapWithPreviousLine
SetKey Control-Alt-DownArrow		SwapWithNextLine
SetKey Control-Alt-LeftArrow		SwapWithPreviousCharacter
SetKey Control-Alt-RightArrow		SwapWithNextCharacter
SetKey Option-Alt-LeftArrow			SwapWordLeft
SetKey Option-Alt-RightArrow		SwapWordRight

SetKey Alt-G						GoToLine

SetKey Kp1							PasteExtended1
SetKey Option-Kp1					PasteFromStackExtended1
SetKey Alt-Kp1						CopyExtended1
SetKey Alt-Shift-Kp1				CopyAndAppendExtended1
SetKey Alt-Option-Kp1				CopyOnStackExtended1
SetKey Control-Kp1					ClearClipboardExtended1
SetKey Alt-Control-Kp1				SwapWithClipboardExtended1
SetKey Kp2							PasteExtended2
SetKey Option-Kp2					PasteFromStackExtended2
SetKey Alt-Kp2						CopyExtended2
SetKey Alt-Shift-Kp2				CopyAndAppendExtended2
SetKey Alt-Option-Kp2				CopyOnStackExtended2
SetKey Control-Kp2					ClearClipboardExtended2
SetKey Alt-Control-Kp2				SwapWithClipboardExtended2
SetKey Kp3							PasteExtended3
SetKey Option-Kp3					PasteFromStackExtended3
SetKey Alt-Kp3						CopyExtended3
SetKey Alt-Shift-Kp3				CopyAndAppendExtended3
SetKey Alt-Option-Kp3				CopyOnStackExtended3
SetKey Control-Kp3					ClearClipboardExtended3
SetKey Alt-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 BMessenger BView BWindow BRect BButton BControl BHandler BCheckBox BRadioButton BMenuField BMenu BMenuItem

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

