Re: [SVN] New Quick Open… (suggestion)
Chris Thomas
chris at cjack.com
Fri Oct 14 18:50:53 UTC 2005
> Objecti0ons or comments (Chris)?
Sure, it's worth a shot. It's not like the Ruby one is particularly
fast, it's just that it's not nearly as slow as the previous find-
based version.
> Which would open the results as a project -- but would then require
> further actions to actually open one of the results (and mate
> should be moved to the bundle support dir).
That would be really cool if it only used a project when there's more
than one result.
Chris
On Oct 14, 2005, at 2:10 PM, Allan Odgaard wrote:
> Currently the Quick Open… requires a selection (or input from a
> dialog) and it cannot handle partial paths, only single files, e.g.
> “sys/wait.h” won't work (which could otherwise limit the number of
> results).
>
> I seem to recall Ruby's Find module being preferred because it was
> faster than the find shell command, but the shell command does make
> it easy to handle the partial paths.
>
> So I propose the following replacement:
>
> dirs=("/usr/include"
> "/System/Library/Frameworks/AppKit.framework/Headers"
> "/System/Library/Frameworks/Foundation.framework/Headers"
> "/System/Library/Frameworks/IOKit.framework/Headers"
> "/System/Library/Frameworks/CoreAudio.framework/Headers"
> "/System/Library/Frameworks/Quartz.framework/Versions/A/
> Frameworks/PDFKit.framework/Headers"
> "/System/Library/Frameworks/QuickTime.framework/Headers"
> "/System/Library/Frameworks/QTKit.framework/Headers"
> "/System/Library/Frameworks/Carbon.framework"
> "/System/Library/Frameworks/Kernel.framework"
> "/System/Library/Frameworks/ApplicationServices.framework"
> )
>
> if [[ -z "$TM_SELECTED_TEXT" && "$TM_CURRENT_LINE" = *\<*\> ]];
> then
> TM_SELECTED_TEXT="$(perl <<<"$TM_CURRENT_LINE" -pe 's/[^<]*<
> ([^>]*)>.*/$1/')"
> elif [[ -z "$TM_SELECTED_TEXT" ]]; then
> res=$(CocoaDialog inputbox --title "Open Header Quickly" --no-
> newline --informative-text "Header name?" --text "foobar" --
> button1 "Open" --button2 "Cancel")
> [[ $(head -n1 <<<"$res") == "2" ]] && exit
> TM_SELECTED_TEXT=$(tail -n1 <<<"$res")
> fi
>
> for dir in "${dirs[@]}"; do
> find "$dir" -path "*/$TM_SELECTED_TEXT" -exec open -a
> TextMate '{}' \;
> done &>/dev/null &
>
> The last part could perhaps be changed to:
>
> for dir in "${arr[@]}"; do
> find "$dir" -path "*/$TM_SELECTED_TEXT" -print0
> done|xargs -0 mate &>/dev/null &
>
> Which would open the results as a project -- but would then require
> further actions to actually open one of the results (and mate
> should be moved to the bundle support dir).
>
> Objections or comments (Chris)?
>
> _______________________________________________
> textmate-dev mailing list
> textmate-dev at lists.macromates.com
> http://lists.macromates.com/mailman/listinfo/textmate-dev
>
>
More information about the textmate-dev
mailing list