[TxMt] BibDesk
Allan Odgaard
allan at macromates.com
Wed Apr 13 01:21:37 UTC 2005
On Apr 12, 2005, at 13:22, Thomas Schröder wrote:
> To use the service you type \cite{H}, leave the cursor at H and type
> Alt-Escape; this will give you a list of all references that contain
> H, but in TextMate this only cylcles through several words containing
> H. In TextMate the Escape key is set to "Next Completion", so I guess
> that this either clashes with BibDesk's hot key or TextMate doesn't
> support BibDesk at all.
I'm not exactly sure how BibDesk works -- it does install an input
manager, but maybe this is to patch the NSTextView of the application,
in which case it won't work with TM.
However, BibDesk does support AppleScript to lookup a search string for
completion, so what you can do is go to menu Automation / Run Command /
Edit Commands...
Make a new command with input: none, output: insert as snippet, key
equivalent: option-escape and the actual command:
res=`osascript <<EOF
tell application "Bibdesk" to set candidates to search for
"$TM_CURRENT_WORD" with for completion
tell application "System Events"
activate
choose from list candidates
end tell
EOF`
osascript -e 'tell app "TextMate" to activate' &>/dev/null &
echo -n ${res:${#TM_CURRENT_WORD}}
If you type something, press option-escape, it will lookup the word to
the left of the caret, showing matches (from BibDesk) using an AS
dialog, and if you select one, it'll insert that choice.
I have added the script to the subversion repository (in the LaTeX
bundle), incase anyone wishes to improve it (like not showing the
dialog for a single match, handling “cancel” and zero matches (though
which BibDesk doesn't seem to give) etc.).
More information about the textmate
mailing list