           item.replacementPrefix = prefix
           suggestions.push item
       suggestions.sort((a, b) ->
-        return a.displayText.indexOf(prefix) - b.displayText.indexOf(prefix))
+        if a.displayText.indexOf(prefix) isnt b.displayText.indexOf(prefix)
+          return a.displayText.indexOf(prefix) - b.displayText.indexOf(prefix)
+        else
+          return b.counts - a.counts
+      )
       return suggestions
     if !@latex.manager.findAll()
       return suggestions


    suggestions = suggestions.concat @additionalSuggestions
    suggestions.sort((a, b) ->
      return -1 if a.displayText < b.displayText
      return 1)
    suggestions.unshift(
      text: '\n'

          type: 'function'
          latexType: 'command'
          chainComplete: chainComplete
          counts: 1
      else
        items[result[1]].counts += 1
    return items

  suggestions:
