           for val in ary
             button.element.classList.add val.trim()
 
-        if ( btn.disable? && @grammarCondition(btn.disable) ) or ( btn.enable? && !@grammarCondition(btn.enable) )
+        if ( btn.disable? && @condition(btn.disable) ) or ( btn.enable? && !@condition(btn.enable) )
           button.setEnabled false
 
   removeCache: (filePath) ->

      devMode = atom.inDevMode()
      for btn in toolBarButtons

        if ( btn.hide? && @grammarCondition(btn.hide) ) or ( btn.show? && !@grammarCondition(btn.show) )
          continue

        continue if btn.mode and btn.mode is 'dev' and not devMode


    return config

  condition: (conditions) ->
    conditions = [conditions] if not Array.isArray conditions
    filePath = atom.workspace.getActivePaneItem()?.getPath?()

    for condition in conditions

      if typeof condition is 'string'
        reverse = false
        if /^!/.test condition
          condition = condition.replace '!', ''
          reverse = true

        if /^[^\/]+\.(.*?)$/.test condition
          result = true if filePath isnt undefined and filePath.match(condition)?.length > 0
        else
          result = true if @currentGrammar? and @currentGrammar.includes condition.toLowerCase()

        result = !result if reverse
        return true if result is true
      else

        if condition.pattern?
          if filePath isnt undefined
            result = globToRegexp(condition.pattern, extended: true).test filePath

          return true if result is true

        if condition.package?
          pkg = condition.package
          reverse = false
          if /^!/.test pkg
            pkg = pkg.replace '!', ''
            reverse = true

          result = atom.packages.isPackageLoaded(pkg) and not atom.packages.isPackageDisabled(pkg)
          result = !result if reverse
          return true if result is true


    return false

