import React from 'react';
import Settings from './Settings';

/**
 * Plugin to show app settings in results list
 * @param  {String} term
 */
const settingsPlugin = (term, callback) => {
  if (!term.match(/^(show\s+)?(settings|preferences)\s*/i)) return;
  callback([{
    icon: '/Applications/Cerebro.app',
    title: 'Cerebro settings',
    id: `settings`,
    getPreview: () => <Settings />
  }]);
};

export default {
  name: 'Cerebro settings',
  icon: '/Applications/Cerebro.app',
  keyword: 'Settings',
  fn: settingsPlugin
};

@@ -31,34 +31,226 @@
 ort 
-Settings from './Settings'
+search from 'lib/search';%0Aimport Settings from './Settings';%0A%0A// Settings plugin name%0Aconst NAME = 'Cerebro Settings';%0A%0A// Phrases that used to find settings plugins%0Aconst KEYWORDS = %5B%0A  NAME,%0A  'Cerebro Preferences'%0A%5D
 ;%0A%0A/
@@ -379,88 +379,97 @@
 %7B%0A  
-if (!term.match(/%5E(show%5Cs+)?(settings%7Cpreferences)%5Cs*/i)) return;%0A  callback(
+const found = search(KEYWORDS, term).length %3E 0;%0A  if (found) %7B%0A    const results = 
 %5B%7B%0A
+  
     
@@ -511,52 +511,60 @@
     
+  
 title: 
-'Cerebro settings'
+NAME,%0A      term: NAME
 ,%0A    
+ 
+ 
 id: 
-%60
+'
 settings
 %60,%0A 
@@ -563,11 +563,13 @@
 ings
-%60
+'
 ,%0A
+  
     
@@ -605,120 +605,73 @@
 %3E%0A  
-%7D%5D);%0A%7D;%0A%0Aexport default %7B%0A  name: 'Cerebro settings',%0A  icon: '/Applications/Cerebro.app',%0A  keyword: 'Settings'
+  %7D%5D;%0A    callback(results);%0A  %7D%0A%7D%0A%0Aexport default %7B%0A  name: NAME
 ,%0A  

Improve search if settings plugin Now available by settings and preferences words