├── .gitignore ├── QuickFind.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcshareddata │ └── xcschemes │ └── QuickFind.xcscheme ├── QuickFind ├── IDEEditorContext.h ├── Info.plist ├── QuickFind.h └── QuickFind.m ├── README.md ├── images └── QuickFind.gif └── install.sh /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .AppleDouble 3 | .LSOverride 4 | Icon 5 | ._* 6 | .Spotlight-V100 7 | .Trashes 8 | .AppleDB 9 | .AppleDesktop 10 | Network Trash Folder 11 | Temporary Items 12 | .apdisk 13 | build/ 14 | *.pbxuser 15 | !default.pbxuser 16 | *.mode1v3 17 | !default.mode1v3 18 | *.mode2v3 19 | !default.mode2v3 20 | *.perspectivev3 21 | !default.perspectivev3 22 | xcuserdata 23 | *.xccheckout 24 | *.moved-aside 25 | DerivedData 26 | *.xcuserstate 27 | *.framework -------------------------------------------------------------------------------- /QuickFind.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | D8AC6CD51A2CA79C0017B790 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D8F2F8131A2A1A2F00167888 /* Foundation.framework */; }; 11 | D8F2F8121A2A1A2F00167888 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D8F2F8111A2A1A2F00167888 /* AppKit.framework */; }; 12 | D8F2F8191A2A1A2F00167888 /* QuickFind.xcscheme in Resources */ = {isa = PBXBuildFile; fileRef = D8F2F8181A2A1A2F00167888 /* QuickFind.xcscheme */; }; 13 | D8F2F81C1A2A1A2F00167888 /* QuickFind.m in Sources */ = {isa = PBXBuildFile; fileRef = D8F2F81B1A2A1A2F00167888 /* QuickFind.m */; }; 14 | /* End PBXBuildFile section */ 15 | 16 | /* Begin PBXFileReference section */ 17 | D8F2F80E1A2A1A2F00167888 /* QuickFind.xcplugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = QuickFind.xcplugin; sourceTree = BUILT_PRODUCTS_DIR; }; 18 | D8F2F8111A2A1A2F00167888 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 19 | D8F2F8131A2A1A2F00167888 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 20 | D8F2F8171A2A1A2F00167888 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 21 | D8F2F8181A2A1A2F00167888 /* QuickFind.xcscheme */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = QuickFind.xcscheme; path = QuickFind.xcodeproj/xcshareddata/xcschemes/QuickFind.xcscheme; sourceTree = SOURCE_ROOT; }; 22 | D8F2F81A1A2A1A2F00167888 /* QuickFind.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QuickFind.h; sourceTree = ""; }; 23 | D8F2F81B1A2A1A2F00167888 /* QuickFind.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QuickFind.m; sourceTree = ""; }; 24 | D8F2F8281A2A301900167888 /* IDEEditorContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IDEEditorContext.h; sourceTree = ""; }; 25 | /* End PBXFileReference section */ 26 | 27 | /* Begin PBXFrameworksBuildPhase section */ 28 | D8F2F80C1A2A1A2F00167888 /* Frameworks */ = { 29 | isa = PBXFrameworksBuildPhase; 30 | buildActionMask = 2147483647; 31 | files = ( 32 | D8F2F8121A2A1A2F00167888 /* AppKit.framework in Frameworks */, 33 | D8AC6CD51A2CA79C0017B790 /* Foundation.framework in Frameworks */, 34 | ); 35 | runOnlyForDeploymentPostprocessing = 0; 36 | }; 37 | /* End PBXFrameworksBuildPhase section */ 38 | 39 | /* Begin PBXGroup section */ 40 | D8F2F8051A2A1A2F00167888 = { 41 | isa = PBXGroup; 42 | children = ( 43 | D8F2F8151A2A1A2F00167888 /* QuickFind */, 44 | D8F2F8101A2A1A2F00167888 /* Frameworks */, 45 | D8F2F80F1A2A1A2F00167888 /* Products */, 46 | ); 47 | sourceTree = ""; 48 | }; 49 | D8F2F80F1A2A1A2F00167888 /* Products */ = { 50 | isa = PBXGroup; 51 | children = ( 52 | D8F2F80E1A2A1A2F00167888 /* QuickFind.xcplugin */, 53 | ); 54 | name = Products; 55 | sourceTree = ""; 56 | }; 57 | D8F2F8101A2A1A2F00167888 /* Frameworks */ = { 58 | isa = PBXGroup; 59 | children = ( 60 | D8F2F8111A2A1A2F00167888 /* AppKit.framework */, 61 | D8F2F8131A2A1A2F00167888 /* Foundation.framework */, 62 | ); 63 | name = Frameworks; 64 | sourceTree = ""; 65 | }; 66 | D8F2F8151A2A1A2F00167888 /* QuickFind */ = { 67 | isa = PBXGroup; 68 | children = ( 69 | D8F2F81A1A2A1A2F00167888 /* QuickFind.h */, 70 | D8F2F81B1A2A1A2F00167888 /* QuickFind.m */, 71 | D8F2F8161A2A1A2F00167888 /* Supporting Files */, 72 | D8F2F8281A2A301900167888 /* IDEEditorContext.h */, 73 | ); 74 | path = QuickFind; 75 | sourceTree = ""; 76 | }; 77 | D8F2F8161A2A1A2F00167888 /* Supporting Files */ = { 78 | isa = PBXGroup; 79 | children = ( 80 | D8F2F8171A2A1A2F00167888 /* Info.plist */, 81 | D8F2F8181A2A1A2F00167888 /* QuickFind.xcscheme */, 82 | ); 83 | name = "Supporting Files"; 84 | sourceTree = ""; 85 | }; 86 | /* End PBXGroup section */ 87 | 88 | /* Begin PBXNativeTarget section */ 89 | D8F2F80D1A2A1A2F00167888 /* QuickFind */ = { 90 | isa = PBXNativeTarget; 91 | buildConfigurationList = D8F2F81F1A2A1A2F00167888 /* Build configuration list for PBXNativeTarget "QuickFind" */; 92 | buildPhases = ( 93 | D8F2F80A1A2A1A2F00167888 /* Sources */, 94 | D8F2F80B1A2A1A2F00167888 /* Resources */, 95 | D8F2F80C1A2A1A2F00167888 /* Frameworks */, 96 | ); 97 | buildRules = ( 98 | ); 99 | dependencies = ( 100 | ); 101 | name = QuickFind; 102 | productName = QuickFind; 103 | productReference = D8F2F80E1A2A1A2F00167888 /* QuickFind.xcplugin */; 104 | productType = "com.apple.product-type.bundle"; 105 | }; 106 | /* End PBXNativeTarget section */ 107 | 108 | /* Begin PBXProject section */ 109 | D8F2F8061A2A1A2F00167888 /* Project object */ = { 110 | isa = PBXProject; 111 | attributes = { 112 | LastUpgradeCheck = 0610; 113 | ORGANIZATIONNAME = Fenice; 114 | TargetAttributes = { 115 | D8F2F80D1A2A1A2F00167888 = { 116 | CreatedOnToolsVersion = 6.1; 117 | }; 118 | }; 119 | }; 120 | buildConfigurationList = D8F2F8091A2A1A2F00167888 /* Build configuration list for PBXProject "QuickFind" */; 121 | compatibilityVersion = "Xcode 3.2"; 122 | developmentRegion = English; 123 | hasScannedForEncodings = 0; 124 | knownRegions = ( 125 | en, 126 | ); 127 | mainGroup = D8F2F8051A2A1A2F00167888; 128 | productRefGroup = D8F2F80F1A2A1A2F00167888 /* Products */; 129 | projectDirPath = ""; 130 | projectRoot = ""; 131 | targets = ( 132 | D8F2F80D1A2A1A2F00167888 /* QuickFind */, 133 | ); 134 | }; 135 | /* End PBXProject section */ 136 | 137 | /* Begin PBXResourcesBuildPhase section */ 138 | D8F2F80B1A2A1A2F00167888 /* Resources */ = { 139 | isa = PBXResourcesBuildPhase; 140 | buildActionMask = 2147483647; 141 | files = ( 142 | D8F2F8191A2A1A2F00167888 /* QuickFind.xcscheme in Resources */, 143 | ); 144 | runOnlyForDeploymentPostprocessing = 0; 145 | }; 146 | /* End PBXResourcesBuildPhase section */ 147 | 148 | /* Begin PBXSourcesBuildPhase section */ 149 | D8F2F80A1A2A1A2F00167888 /* Sources */ = { 150 | isa = PBXSourcesBuildPhase; 151 | buildActionMask = 2147483647; 152 | files = ( 153 | D8F2F81C1A2A1A2F00167888 /* QuickFind.m in Sources */, 154 | ); 155 | runOnlyForDeploymentPostprocessing = 0; 156 | }; 157 | /* End PBXSourcesBuildPhase section */ 158 | 159 | /* Begin XCBuildConfiguration section */ 160 | D8F2F81D1A2A1A2F00167888 /* Debug */ = { 161 | isa = XCBuildConfiguration; 162 | buildSettings = { 163 | ALWAYS_SEARCH_USER_PATHS = NO; 164 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 165 | CLANG_CXX_LIBRARY = "libc++"; 166 | CLANG_ENABLE_MODULES = YES; 167 | CLANG_ENABLE_OBJC_ARC = YES; 168 | CLANG_WARN_BOOL_CONVERSION = YES; 169 | CLANG_WARN_CONSTANT_CONVERSION = YES; 170 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 171 | CLANG_WARN_EMPTY_BODY = YES; 172 | CLANG_WARN_ENUM_CONVERSION = YES; 173 | CLANG_WARN_INT_CONVERSION = YES; 174 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 175 | CLANG_WARN_UNREACHABLE_CODE = YES; 176 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 177 | COPY_PHASE_STRIP = NO; 178 | ENABLE_STRICT_OBJC_MSGSEND = YES; 179 | GCC_C_LANGUAGE_STANDARD = gnu99; 180 | GCC_DYNAMIC_NO_PIC = NO; 181 | GCC_OPTIMIZATION_LEVEL = 0; 182 | GCC_PREPROCESSOR_DEFINITIONS = ( 183 | "DEBUG=1", 184 | "$(inherited)", 185 | ); 186 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 187 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 188 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 189 | GCC_WARN_UNDECLARED_SELECTOR = YES; 190 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 191 | GCC_WARN_UNUSED_FUNCTION = YES; 192 | GCC_WARN_UNUSED_VARIABLE = YES; 193 | MTL_ENABLE_DEBUG_INFO = YES; 194 | ONLY_ACTIVE_ARCH = YES; 195 | }; 196 | name = Debug; 197 | }; 198 | D8F2F81E1A2A1A2F00167888 /* Release */ = { 199 | isa = XCBuildConfiguration; 200 | buildSettings = { 201 | ALWAYS_SEARCH_USER_PATHS = NO; 202 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 203 | CLANG_CXX_LIBRARY = "libc++"; 204 | CLANG_ENABLE_MODULES = YES; 205 | CLANG_ENABLE_OBJC_ARC = YES; 206 | CLANG_WARN_BOOL_CONVERSION = YES; 207 | CLANG_WARN_CONSTANT_CONVERSION = YES; 208 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 209 | CLANG_WARN_EMPTY_BODY = YES; 210 | CLANG_WARN_ENUM_CONVERSION = YES; 211 | CLANG_WARN_INT_CONVERSION = YES; 212 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 213 | CLANG_WARN_UNREACHABLE_CODE = YES; 214 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 215 | COPY_PHASE_STRIP = YES; 216 | ENABLE_NS_ASSERTIONS = NO; 217 | ENABLE_STRICT_OBJC_MSGSEND = YES; 218 | GCC_C_LANGUAGE_STANDARD = gnu99; 219 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 220 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 221 | GCC_WARN_UNDECLARED_SELECTOR = YES; 222 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 223 | GCC_WARN_UNUSED_FUNCTION = YES; 224 | GCC_WARN_UNUSED_VARIABLE = YES; 225 | MTL_ENABLE_DEBUG_INFO = NO; 226 | }; 227 | name = Release; 228 | }; 229 | D8F2F8201A2A1A2F00167888 /* Debug */ = { 230 | isa = XCBuildConfiguration; 231 | buildSettings = { 232 | COMBINE_HIDPI_IMAGES = YES; 233 | DEPLOYMENT_LOCATION = YES; 234 | DSTROOT = "$(HOME)"; 235 | FRAMEWORK_SEARCH_PATHS = ( 236 | "$(inherited)", 237 | "$(PROJECT_DIR)", 238 | ); 239 | INFOPLIST_FILE = QuickFind/Info.plist; 240 | INSTALL_PATH = "/Library/Application Support/Developer/Shared/Xcode/Plug-ins"; 241 | MACOSX_DEPLOYMENT_TARGET = 10.10; 242 | PRODUCT_NAME = "$(TARGET_NAME)"; 243 | WRAPPER_EXTENSION = xcplugin; 244 | }; 245 | name = Debug; 246 | }; 247 | D8F2F8211A2A1A2F00167888 /* Release */ = { 248 | isa = XCBuildConfiguration; 249 | buildSettings = { 250 | COMBINE_HIDPI_IMAGES = YES; 251 | DEPLOYMENT_LOCATION = YES; 252 | DSTROOT = "$(HOME)"; 253 | FRAMEWORK_SEARCH_PATHS = ( 254 | "$(inherited)", 255 | "$(PROJECT_DIR)", 256 | ); 257 | INFOPLIST_FILE = QuickFind/Info.plist; 258 | INSTALL_PATH = "/Library/Application Support/Developer/Shared/Xcode/Plug-ins"; 259 | MACOSX_DEPLOYMENT_TARGET = 10.10; 260 | PRODUCT_NAME = "$(TARGET_NAME)"; 261 | WRAPPER_EXTENSION = xcplugin; 262 | }; 263 | name = Release; 264 | }; 265 | /* End XCBuildConfiguration section */ 266 | 267 | /* Begin XCConfigurationList section */ 268 | D8F2F8091A2A1A2F00167888 /* Build configuration list for PBXProject "QuickFind" */ = { 269 | isa = XCConfigurationList; 270 | buildConfigurations = ( 271 | D8F2F81D1A2A1A2F00167888 /* Debug */, 272 | D8F2F81E1A2A1A2F00167888 /* Release */, 273 | ); 274 | defaultConfigurationIsVisible = 0; 275 | defaultConfigurationName = Release; 276 | }; 277 | D8F2F81F1A2A1A2F00167888 /* Build configuration list for PBXNativeTarget "QuickFind" */ = { 278 | isa = XCConfigurationList; 279 | buildConfigurations = ( 280 | D8F2F8201A2A1A2F00167888 /* Debug */, 281 | D8F2F8211A2A1A2F00167888 /* Release */, 282 | ); 283 | defaultConfigurationIsVisible = 0; 284 | defaultConfigurationName = Release; 285 | }; 286 | /* End XCConfigurationList section */ 287 | }; 288 | rootObject = D8F2F8061A2A1A2F00167888 /* Project object */; 289 | } 290 | -------------------------------------------------------------------------------- /QuickFind.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /QuickFind.xcodeproj/xcshareddata/xcschemes/QuickFind.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 46 | 47 | 58 | 60 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /QuickFind/IDEEditorContext.h: -------------------------------------------------------------------------------- 1 | // 2 | // IDEEditorContext.h 3 | // QuickFind 4 | // 5 | // Created by Joey on 11/29/14. 6 | // Copyright (c) 2014 www.joeyio.com. All rights reserved. 7 | // 8 | 9 | 10 | #import 11 | 12 | @interface DVTTextDocumentLocation : NSObject 13 | @property (readonly) NSRange characterRange; 14 | @property (readonly) NSRange lineRange; 15 | @end 16 | 17 | @interface DVTTextPreferences : NSObject 18 | + (id)preferences; 19 | @property BOOL trimWhitespaceOnlyLines; 20 | @property BOOL trimTrailingWhitespace; 21 | @property BOOL useSyntaxAwareIndenting; 22 | @end 23 | 24 | @interface DVTSourceTextStorage : NSTextStorage 25 | - (void)replaceCharactersInRange:(NSRange)range withString:(NSString *)string withUndoManager:(id)undoManager; 26 | - (NSRange)lineRangeForCharacterRange:(NSRange)range; 27 | - (NSRange)characterRangeForLineRange:(NSRange)range; 28 | - (void)indentCharacterRange:(NSRange)range undoManager:(id)undoManager; 29 | @end 30 | 31 | @interface DVTFileDataType : NSObject 32 | @property (readonly) NSString *identifier; 33 | @end 34 | 35 | @interface DVTFilePath : NSObject 36 | @property (readonly) NSURL *fileURL; 37 | @property (readonly) DVTFileDataType *fileDataTypePresumed; 38 | @end 39 | 40 | @interface IDEContainerItem : NSObject 41 | @property (readonly) DVTFilePath *resolvedFilePath; 42 | @end 43 | 44 | @interface IDEGroup : IDEContainerItem 45 | 46 | @end 47 | 48 | @interface IDEFileReference : IDEContainerItem 49 | 50 | @end 51 | 52 | @interface IDENavigableItem : NSObject 53 | @property (readonly) IDENavigableItem *parentItem; 54 | @property (readonly) id representedObject; 55 | @end 56 | 57 | @interface IDEFileNavigableItem : IDENavigableItem 58 | @property (readonly) DVTFileDataType *documentType; 59 | @property (readonly) NSURL *fileURL; 60 | @end 61 | 62 | @interface IDEStructureNavigator : NSObject 63 | @property (retain) NSArray *selectedObjects; 64 | @end 65 | 66 | @interface IDENavigableItemCoordinator : NSObject 67 | - (id)structureNavigableItemForDocumentURL:(id)arg1 inWorkspace:(id)arg2 error:(id *)arg3; 68 | @end 69 | 70 | @interface IDENavigatorArea : NSObject 71 | - (id)currentNavigator; 72 | @end 73 | 74 | @interface IDEWorkspaceTabController : NSObject 75 | @property (readonly) IDENavigatorArea *navigatorArea; 76 | @end 77 | 78 | @interface IDEDocumentController : NSDocumentController 79 | + (id)editorDocumentForNavigableItem:(id)arg1; 80 | + (id)retainedEditorDocumentForNavigableItem:(id)arg1 error:(id *)arg2; 81 | + (void)releaseEditorDocument:(id)arg1; 82 | @end 83 | 84 | @interface IDESourceCodeDocument : NSDocument 85 | - (DVTSourceTextStorage *)textStorage; 86 | - (NSUndoManager *)undoManager; 87 | - (id)findStringMatchingDescriptor:(id)arg1 backwards:(BOOL)arg2 from:(id)arg3 to:(id)arg4; 88 | @end 89 | 90 | @interface IDESourceCodeComparisonEditor : NSObject 91 | @property (readonly) NSTextView *keyTextView; 92 | @property (retain) NSDocument *primaryDocument; 93 | @end 94 | 95 | @interface IDESourceCodeEditor : NSObject 96 | @property (retain) NSTextView *textView; 97 | - (IDESourceCodeDocument *)sourceCodeDocument; 98 | 99 | - (struct _NSRange)selectedRangeForFindBar:(id)arg1; 100 | - (id)startingLocationForFindBar:(id)arg1 findingBackwards:(BOOL)arg2; 101 | - (void)dvtFindBar:(id)arg1 didUpdateCurrentResult:(id)arg2; 102 | - (void)dvtFindBar:(id)arg1 didUpdateResults:(id)arg2; 103 | 104 | @end 105 | 106 | @interface DVTFindBar : NSObject 107 | { 108 | NSPopUpButton *_finderModePopUpButton; 109 | NSSegmentedControl *_segmentedControl; 110 | NSTextField *_replaceTextField; 111 | NSTimer *_editedTimer; 112 | NSMutableArray *_recents; 113 | id _findObject; 114 | double _preferredViewHeight; 115 | NSAttributedString *_findAttributedString; 116 | NSAttributedString *_replaceAttributedString; 117 | unsigned long long _finderMode; 118 | BOOL _canReplace; 119 | BOOL _hasResults; 120 | BOOL _recentsNeedUpdate; 121 | long long _numberOfMatches; 122 | NSView *_findBarView; 123 | NSSegmentedControl *_replaceSegmentedControl; 124 | NSSegmentedControl *_doneSegmentedButtom; 125 | } 126 | 127 | + (id)keyPathsForValuesAffectingReplaceString; 128 | + (id)keyPathsForValuesAffectingFindRegularExpression; 129 | + (id)keyPathsForValuesAffectingFindString; 130 | + (void)initialize; 131 | @property __weak NSSegmentedControl *doneSegmentedButtom; // @synthesize doneSegmentedButtom=_doneSegmentedButtom; 132 | @property __weak NSSegmentedControl *replaceSegmentedControl; // @synthesize replaceSegmentedControl=_replaceSegmentedControl; 133 | @property __weak NSView *findBarView; // @synthesize findBarView=_findBarView; 134 | @property(nonatomic) long long numberOfMatches; // @synthesize numberOfMatches=_numberOfMatches; 135 | @property BOOL recentsNeedUpdate; // @synthesize recentsNeedUpdate=_recentsNeedUpdate; 136 | @property double preferredViewHeight; // @synthesize preferredViewHeight=_preferredViewHeight; 137 | @property(nonatomic) BOOL hasResults; // @synthesize hasResults=_hasResults; 138 | @property BOOL canReplace; // @synthesize canReplace=_canReplace; 139 | @property(nonatomic) unsigned long long finderMode; // @synthesize finderMode=_finderMode; 140 | @property(copy, nonatomic) NSAttributedString *replaceAttributedString; // @synthesize replaceAttributedString=_replaceAttributedString; 141 | @property(copy, nonatomic) NSAttributedString *findAttributedString; // @synthesize findAttributedString=_findAttributedString; 142 | @property(retain, nonatomic) id findObject; // @synthesize findObject=_findObject; 143 | - (void)primitiveInvalidate; 144 | - (BOOL)control:(id)arg1 textView:(id)arg2 doCommandBySelector:(SEL)arg3; 145 | - (void)didPressDismissOnScopeBar:(id)arg1; 146 | - (void)controlTextDidEndEditing:(id)arg1; 147 | - (void)_endedEditing:(id)arg1; 148 | - (void)findBarLostFocus; 149 | - (void)controlTextDidChange:(id)arg1; 150 | - (void)findPatternField:(id)arg1 findPatternDoubleClicked:(id)arg2; 151 | - (BOOL)hasFindPattern; 152 | - (id)replaceFieldForField:(id)arg1; 153 | - (id)findFieldForField:(id)arg1; 154 | - (id)_replaceField; 155 | - (id)_findField; 156 | - (BOOL)supportsPatterns; 157 | - (id)_recentsMenu; 158 | - (void)_showFindOptionsPopover:(id)arg1; 159 | - (void)_clearRecents; 160 | - (void)_restoreFindHistory:(id)arg1; 161 | - (void)_replaceSegmentedControlClicked:(id)arg1; 162 | - (void)_dismiss:(id)arg1; 163 | - (void)_replaceAllInSelectionButtonAction:(id)arg1; 164 | - (void)_segmentedControlAction:(id)arg1; 165 | - (void)_replaceStringFieldAction:(id)arg1; 166 | - (void)_findStringFieldAction:(id)arg1; 167 | - (void)cancel:(id)arg1; 168 | - (void)_insertFindPattern:(id)arg1; 169 | - (void)_optionsChanged:(id)arg1; 170 | - (BOOL)supportsCaseInsensitiveMatch; 171 | - (BOOL)supportsTextMatchStyle:(int)arg1; 172 | - (BOOL)supportsFindBarMode:(unsigned long long)arg1; 173 | - (BOOL)supportsFindBarType:(unsigned long long)arg1; 174 | - (void)performFindHighlightingFirstResult:(BOOL)arg1 informDelegate:(BOOL)arg2; 175 | - (void)clearResults; 176 | - (void)updateStatusInformingDelegate:(BOOL)arg1; 177 | - (void)invalidateResults; 178 | - (void)invalidateResultsAndUpdate:(BOOL)arg1; 179 | - (double)invalidationDelayInterval; 180 | - (void)_updateAfterInvalidate:(id)arg1; 181 | - (void)changeFinderMode:(id)arg1; 182 | - (void)replaceAllInSelection:(id)arg1; 183 | - (void)replaceAll:(id)arg1; 184 | - (void)replaceAndFindPrevious:(id)arg1; 185 | - (void)replaceAndFindNext:(id)arg1; 186 | - (void)replace:(id)arg1; 187 | @property(readonly) BOOL supportsReplace; 188 | - (void)findPrevious:(id)arg1; 189 | - (void)findNext:(id)arg1; 190 | @property(readonly) BOOL replaceFieldHasFocus; 191 | - (void)selectReplaceField:(id)arg1; 192 | @property(readonly) BOOL findFieldHasFocus; 193 | - (void)selectFindField:(id)arg1; 194 | @property(readonly) BOOL viewIsInstalled; 195 | //@property(readonly) DVTFindBarOptionsCtrl *optionsCtrl; 196 | //@property(readonly) DVTLogAspect *logAspect; 197 | @property BOOL ignoreNextInvalidate; 198 | @property BOOL findResultsValid; 199 | - (BOOL)shouldCloseOnEscape; 200 | - (void)wasAssociatedWithScopeBarController:(id)arg1; 201 | @property(readonly, nonatomic) NSString *replaceExpression; 202 | @property(copy) NSString *replaceString; 203 | @property(readonly, nonatomic) NSString *findRegularExpression; 204 | @property(copy, nonatomic) NSString *findString; 205 | - (void)setFindAttributedStringAndUpdate:(id)arg1; 206 | - (void)setFindAttributedString:(id)arg1 andUpdate:(BOOL)arg2; 207 | - (void)updateRecentsMenu; 208 | - (void)sanitizeStrings; 209 | - (BOOL)validateUserInterfaceItem:(id)arg1; 210 | - (void)_updateSharedFindStateReplaceAttributedString:(id)arg1; 211 | - (void)_updateSharedFindStateFindAttributedString:(id)arg1; 212 | - (void)windowDidUpdate:(id)arg1; 213 | - (void)viewWillUninstall; 214 | - (void)viewDidInstall; 215 | - (void)loadView; 216 | - (id)initWithNibName:(id)arg1 bundle:(id)arg2; 217 | 218 | @end 219 | 220 | 221 | @interface IDEEditorContext : NSObject { 222 | DVTFindBar *_findBar; 223 | } 224 | 225 | @property(retain, nonatomic) id editor; // returns the current editor(IDEEditor). If the editor is the code editor, the class is `IDESourceCodeEditor` 226 | 227 | - (void)replaceAndFindPrevious:(id)arg1; 228 | - (void)replaceAndFindNext:(id)arg1; 229 | - (void)replaceAll:(id)arg1; 230 | - (void)replace:(id)arg1; 231 | - (void)findPrevious:(id)arg1; 232 | - (void)findNext:(id)arg1; 233 | - (void)findAndReplace:(id)arg1; 234 | - (void)find:(id)arg1; 235 | - (id)_findScopeBar; 236 | - (id)_findBar; 237 | - (void)_installFindBar; 238 | @end 239 | 240 | 241 | @interface IDEDebugArea : NSObject 242 | 243 | + (id)createShowRightViewButton; 244 | + (id)createShowLeftViewButton; 245 | - (void)activateConsole; 246 | - (BOOL)canActivateConsole; 247 | - (void)clearConsole; 248 | - (BOOL)canClearConsole; 249 | @property(readonly) NSString *stateSavingIdentifier; 250 | @end 251 | 252 | @interface IDEConsoleArea : NSObject 253 | 254 | - (void)findPrevious:(id)arg1; 255 | - (void)findNext:(id)arg1; 256 | - (void)find:(id)arg1; 257 | 258 | - (id)_findBar:(BOOL)arg1; 259 | - (id)_createFindBar; 260 | - (void)_installFindBar; 261 | - (BOOL)_isFindBarInstalled; 262 | 263 | @end 264 | 265 | @interface IDEDefaultDebugArea : NSObject 266 | 267 | @property(readonly) IDEConsoleArea *consoleArea; 268 | 269 | @end 270 | 271 | 272 | //@interface IDEConsoleTextView : NSObject 273 | // 274 | //@end 275 | 276 | //@interface DVTSourceTextView : NSObject 277 | // 278 | //@end 279 | 280 | 281 | @interface IDEEditorArea : NSObject 282 | - (IDEEditorContext *)lastActiveEditorContext; 283 | 284 | @property(retain) IDEDebugArea *activeDebuggerArea; // @synthesize activeDebuggerArea=_activeDebuggerArea; 285 | //@property(retain) IDEDebugBar *activeDebuggerBar; // @synthesize activeDebuggerBar=_activeDebuggerBar; 286 | 287 | @property(nonatomic) int versionEditorSubmode; // @synthesize versionEditorSubmode=_versionEditorSubmode; 288 | @property(nonatomic) int editorMode; // @synthesize editorMode=_editorMode 289 | 290 | @end 291 | 292 | @interface IDEWorkspaceWindowController : NSObject 293 | @property (readonly) IDEWorkspaceTabController *activeWorkspaceTabController; 294 | @property(readonly, getter=isInMiniDebuggingMode) BOOL inMiniDebuggingMode; // @synthesize inMiniDebuggingMode=_inMiniDebuggingMode; 295 | 296 | - (IDEEditorArea *)editorArea; 297 | 298 | 299 | @end 300 | 301 | @interface IDEWorkspace : NSObject 302 | @property (readonly) DVTFilePath *representingFilePath; 303 | @end 304 | 305 | @interface IDEWorkspaceDocument : NSDocument 306 | @property (readonly) IDEWorkspace *workspace; 307 | @end 308 | 309 | @interface DVTFindDescriptor : NSObject 310 | { 311 | } 312 | 313 | + (id)keyPathsForValuesAffectingDisplayAttributedString; 314 | - (id)firstMatchingResultInString:(id)arg1 backwards:(BOOL)arg2 inRange:(struct _NSRange)arg3 withWordFindingBlock:(id)arg4 docLocationCreationBlock:(void)arg5; 315 | - (id)firstMatchingResultInString:(id)arg1 backwards:(BOOL)arg2 inRange:(struct _NSRange)arg3 docLocationCreationBlock:(id)arg4; 316 | @property(readonly) BOOL caseSensitive; 317 | @property(readonly) NSString *displayString; 318 | @property(readonly) NSAttributedString *displayAttributedString; 319 | - (id)copyWithZone:(struct _NSZone *)arg1; 320 | - (void)encodeWithCoder:(id)arg1; 321 | - (id)initWithCoder:(id)arg1; 322 | 323 | @end 324 | 325 | @interface DVTFindTextualDescriptor : DVTFindDescriptor 326 | { 327 | NSString *_findString; 328 | int _matchStyle; 329 | BOOL _caseSensitive; 330 | } 331 | 332 | @property(readonly) int matchStyle; // @synthesize matchStyle=_matchStyle; 333 | - (BOOL)caseSensitive; 334 | @property(readonly) NSString *findString; // @synthesize findString=_findString; 335 | - (id)firstMatchingResultInString:(id)arg1 backwards:(BOOL)arg2 inRange:(struct _NSRange)arg3 withWordFindingBlock:(id)arg4 docLocationCreationBlock:(void)arg5; 336 | - (struct _NSRange)_wordBoundaryAtIndex:(unsigned long long)arg1 forString:(id)arg2; 337 | - (id)description; 338 | - (id)displayString; 339 | - (BOOL)isEqual:(id)arg1; 340 | - (unsigned long long)hash; 341 | - (id)initWithString:(id)arg1 ignoreCase:(BOOL)arg2 matchStyle:(int)arg3; 342 | - (void)encodeWithCoder:(id)arg1; 343 | - (id)initWithCoder:(id)arg1; 344 | - (id)copyWithZone:(struct _NSZone *)arg1; 345 | 346 | @end 347 | 348 | 349 | 350 | -------------------------------------------------------------------------------- /QuickFind/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.joeyio.$(PRODUCT_NAME:rfc1034identifier) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | BNDL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | DVTPlugInCompatibilityUUIDs 26 | 27 | C4A681B0-4A26-480E-93EC-1218098B9AA0 28 | AD68E85B-441B-4301-B564-A45E4919A6AD 29 | FEC992CC-CA4A-4CFD-8881-77300FCB848A 30 | 992275C1-432A-4CF7-B659-D84ED6D42D3F 31 | A16FF353-8441-459E-A50C-B071F53F51B7 32 | 33 | LSMinimumSystemVersion 34 | $(MACOSX_DEPLOYMENT_TARGET) 35 | NSPrincipalClass 36 | QuickFind 37 | XC4Compatible 38 | 39 | XCPluginHasUI 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /QuickFind/QuickFind.h: -------------------------------------------------------------------------------- 1 | // 2 | // QuickFind.h 3 | // QuickFind 4 | // 5 | // Created by Joey on 11/29/14. 6 | // Copyright (c) 2014 www.joeyio.com. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface QuickFind : NSObject 12 | 13 | + (instancetype)sharedPlugin; 14 | 15 | @property (nonatomic, strong, readonly) NSBundle* bundle; 16 | @end -------------------------------------------------------------------------------- /QuickFind/QuickFind.m: -------------------------------------------------------------------------------- 1 | // 2 | // QuickFind.m 3 | // QuickFind 4 | // 5 | // Created by Joey on 11/29/14 6 | // Copyright (c) 2014 www.joeyio.com. All rights reserved. 7 | // 8 | 9 | #import "QuickFind.h" 10 | #import "IDEEditorContext.h" 11 | 12 | typedef NS_ENUM(NSUInteger, QuickFindType) { 13 | QuickFindTypeSourceEditor = 0, 14 | QuickFindTypeConsoleEditor = 1 15 | }; 16 | 17 | static NSString *const QUICKFindNextTitle = @"Quick Find Next"; 18 | static NSString *const QUICKFindPreviousTitle = @"Quick Find Previous"; 19 | 20 | static QuickFind *sharedPlugin; 21 | 22 | @interface QuickFind() 23 | 24 | @property (nonatomic, strong, readwrite) NSBundle *bundle; 25 | @property (nonatomic, copy) NSString *selectedText; 26 | @property (nonatomic, strong) NSMenuItem *menuItem; 27 | @property (nonatomic, assign) QuickFindType quickFindType; 28 | 29 | @end 30 | 31 | @implementation QuickFind 32 | 33 | + (void)pluginDidLoad:(NSBundle *)plugin 34 | { 35 | static dispatch_once_t onceToken; 36 | NSString *currentApplicationName = [[NSBundle mainBundle] infoDictionary][@"CFBundleName"]; 37 | if ([currentApplicationName isEqual:@"Xcode"]) { 38 | dispatch_once(&onceToken, ^{ 39 | sharedPlugin = [[self alloc] initWithBundle:plugin]; 40 | }); 41 | } 42 | } 43 | 44 | + (instancetype)sharedPlugin 45 | { 46 | return sharedPlugin; 47 | } 48 | 49 | - (id)initWithBundle:(NSBundle *)plugin 50 | { 51 | if (self = [super init]) { 52 | _bundle = plugin; 53 | _quickFindType = QuickFindTypeSourceEditor; 54 | 55 | NSMenuItem *menuItem = [[NSApp mainMenu] itemWithTitle:@"Find"]; 56 | if (menuItem) { 57 | [[menuItem submenu] addItem:[NSMenuItem separatorItem]]; 58 | [[menuItem submenu] addItem:({ 59 | NSMenuItem *menuItem = [[NSMenuItem alloc] initWithTitle:QUICKFindNextTitle 60 | action:@selector(quickFindAction:) 61 | keyEquivalent:@""]; 62 | menuItem.target = self; 63 | menuItem; 64 | })]; 65 | [[menuItem submenu] addItem:({ 66 | NSMenuItem *menuItem = [[NSMenuItem alloc] initWithTitle:QUICKFindPreviousTitle 67 | action:@selector(quickFindAction:) 68 | keyEquivalent:@""]; 69 | menuItem.target = self; 70 | menuItem; 71 | })]; 72 | } 73 | _menuItem = menuItem; 74 | 75 | [[NSNotificationCenter defaultCenter] addObserver:self 76 | selector:@selector(selectionDidChange:) 77 | name:NSTextViewDidChangeSelectionNotification 78 | object:nil]; 79 | } 80 | return self; 81 | } 82 | 83 | - (void)dealloc 84 | { 85 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 86 | } 87 | 88 | - (void)selectionDidChange: (NSNotification*) notification { 89 | if ([[notification object] isKindOfClass:[NSTextView class]]) { 90 | NSTextView* textView = (NSTextView *)[notification object]; //IDEConsoleTextView and DVTSourceTextView 91 | 92 | BOOL validTextView = NO; 93 | NSString *className = NSStringFromClass([textView class]); 94 | if ([className isEqualToString:@"DVTSourceTextView"]) { // I do not use isKindOfClass method , just because I don't wanna include DVTKit.framework, it's too large (20+ M) for Alcatraz to download. (The plugin manager Alcatraz will clone the whole project with git, and build plugins locally, so if the project is very large, it would be very slow.) 95 | self.quickFindType = QuickFindTypeSourceEditor; 96 | validTextView = YES; 97 | } else if ([className isEqualToString:@"IDEConsoleTextView"]){ //IDEKit.framework is large too 98 | self.quickFindType = QuickFindTypeConsoleEditor; 99 | validTextView = YES; 100 | } 101 | 102 | if (validTextView) { 103 | NSArray* selectedRanges = [textView selectedRanges]; 104 | if (selectedRanges.count > 0) { 105 | NSRange selectedRange = [[selectedRanges objectAtIndex:0] rangeValue]; 106 | if (selectedRange.length != 0) { 107 | self.selectedText = [textView.textStorage.string substringWithRange:selectedRange]; 108 | } 109 | } 110 | } 111 | } 112 | } 113 | 114 | - (void)quickFindAction:(id)sender { 115 | 116 | NSMenuItem *menuItem = (NSMenuItem *)sender; 117 | BOOL shouldFindNext = ([menuItem.title isEqualToString:QUICKFindNextTitle]); 118 | 119 | switch (self.quickFindType) { 120 | case QuickFindTypeSourceEditor: { 121 | IDEEditorContext *context = [self currentEditorContext]; 122 | DVTFindBar *findBar = [context _findBar]; 123 | findBar.findString = self.selectedText ?: @"" ; 124 | 125 | if (self.selectedText.length > 0) { 126 | if (shouldFindNext) { 127 | [context findNext:nil]; 128 | } else { 129 | [context findPrevious:nil]; 130 | } 131 | } else { 132 | [context find:self.menuItem]; 133 | } 134 | } break; 135 | case QuickFindTypeConsoleEditor: { 136 | IDEConsoleArea *consoleArea = [self consoleArea]; 137 | DVTFindBar *findBar = [consoleArea _findBar:NO]; 138 | findBar.findString = self.selectedText ?: @""; 139 | if (self.selectedText.length > 0) { 140 | if (shouldFindNext) { 141 | [consoleArea findNext:nil]; 142 | } else { 143 | [consoleArea findPrevious:nil]; 144 | } 145 | } else { 146 | [consoleArea find:self.menuItem]; 147 | } 148 | } break; 149 | default: 150 | break; 151 | } 152 | } 153 | 154 | - (IDEEditorContext *)currentEditorContext { 155 | NSWindowController *currentWindowController = [[NSApp keyWindow] windowController]; 156 | if ([currentWindowController isKindOfClass:NSClassFromString(@"IDEWorkspaceWindowController")]) { 157 | IDEWorkspaceWindowController *workspaceController = (IDEWorkspaceWindowController *)currentWindowController; 158 | IDEEditorArea *editorArea = (IDEEditorArea *)[workspaceController editorArea]; 159 | return [editorArea lastActiveEditorContext]; 160 | } 161 | return nil; 162 | } 163 | 164 | - (IDEConsoleArea *)consoleArea { 165 | NSWindowController *currentWindowController = [[NSApp keyWindow] windowController]; 166 | if ([currentWindowController isKindOfClass:NSClassFromString(@"IDEWorkspaceWindowController")]) { 167 | IDEWorkspaceWindowController *workspaceController = (IDEWorkspaceWindowController *)currentWindowController; 168 | IDEEditorArea *editorArea = (IDEEditorArea *)[workspaceController editorArea]; 169 | IDEDefaultDebugArea *debugArea = (IDEDefaultDebugArea *)editorArea.activeDebuggerArea; 170 | return [debugArea consoleArea]; 171 | } 172 | return nil; 173 | } 174 | 175 | @end 176 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #QuickFind 2 | 3 | QuickFind is a Xcode plugin to help you find/search something more conveniently and makes your `CMD + F` more powerful, in QuickFind's world, `CMD + F = (CMD + E) + (CMD + G)` and `CMD + F = (CMD + G)` 4 | 5 | ###Before: 6 | When you want to find something in source code, you may select some text first, and press `CMD + E`, then press `CMD + G` to find next. 7 | 8 | ###Now using QuickFind: 9 | Now with QuickFind, you just need to select something, and press `CMD + F`, QuickFind will open the find bar, put what you selected in the find bar and start to find the next one. You can also press `CMD + F` again and again to find the next one (just forget `CMD + E` and `CMD + G`, you may only need `CMD + F` ), just like this: 10 | 11 | ![](https://raw.githubusercontent.com/qiaoxueshi/QuickFind/master/images/QuickFind.gif) 12 | 13 | #Install and configuration 14 | 3 steps: 15 | 16 | 1. **Install QuickFind.** Install QuickFind in [Alcatraz](https://github.com/supermarin/Alcatraz) (recommend), or open up your terminal and paste this: 17 | ``` 18 | curl -fsSL https://raw.githubusercontent.com/qiaoxueshi/QuickFind/master/install.sh | sh 19 | ``` 20 | 21 | Of course you also can clone this project, and build your own. 22 | 2. **Remove defualt Find shortcut.** Open `Xcode` - `Preferences` - `Key Binding`, remove Shortcut of 'Find' (default is CMD + F) 23 | 24 | 3. **Add shortcut for QuickFind.** Open `System Preferences` - `KeyBoard` - `Shortcuts` - `App Shortcuts`, add a shortcut for Qucick Find like this: 25 | ![](https://raw.githubusercontent.com/qiaoxueshi/QuickFind_OLD/master/images/add_shortcut.png) 26 | 27 | When you open `Find` menu again, you will see: 28 | 29 | ![](https://raw.githubusercontent.com/qiaoxueshi/QuickFind_OLD/master/images/shortcut.png) 30 | 31 | Done, enjoy~ 32 | -------------------------------------------------------------------------------- /images/QuickFind.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XueshiQiao/QuickFind/03670ed28c0cc750678134ccc0d5cedc2940977d/images/QuickFind.gif -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | DOWNLOAD_URI=https://github.com/qiaoxueshi/QuickFind/releases/download/0.1.1/QuickFind.xcplugin.tar.gz 4 | PLUGINS_DIR="${HOME}/Library/Application Support/Developer/Shared/Xcode/Plug-ins" 5 | 6 | mkdir -p "${PLUGINS_DIR}" 7 | curl -L $DOWNLOAD_URI | tar xvz -C "${PLUGINS_DIR}" 8 | 9 | echo "QuickFind successfuly installed!!!🍻 Please restart your Xcode." 10 | 11 | --------------------------------------------------------------------------------