<commit_before># Written by <NAME> (<EMAIL>)
# based on Search DevDocs Plugin by Vitor Britto (<EMAIL> / vitorbritto.<EMAIL>.br)

import sublime
import sublime_plugin

import subprocess
import webbrowser


def SearchFor(text):
    url = 'http://cfdocs.org/' + text.replace(' ', '%20')
    webbrowser.open_new_tab(url)


class CfDocsSearchSelectionCommand(sublime_plugin.TextCommand):
    def run(self, edit):
        for selection in self.view.sel():
            # if the user didn't select anything, search the currently highlighted word
            if selection.empty():
                text = self.view.word(selection)

            text = self.view.substr(selection)
            SearchFor(text)


class CfDocsSearchFromInputCommand(sublime_plugin.WindowCommand):
    def run(self):
        # Get the search item
        self.window.show_input_panel('Search CFDocs for', '',
            self.on_done, self.on_change, self.on_cancel)<commit_msg>Search by selection will now choose word from current cursor position if no selection was made<commit_after># Written by <NAME> (<EMAIL>)
# based on Search DevDocs Plugin by Vitor Britto (<EMAIL> / vitorbritto.com.br)

import sublime
import sublime_plugin

import subprocess
import webbrowser


def SearchFor(text):
    url = 'http://cfdocs.org/' + text.replace(' ', '%20')
    webbrowser.open_new_tab(url)


class CfDocsSearchSelectionCommand(sublime_plugin.TextCommand):
    def run(self, edit):
        for selection in self.view.sel():
            # if the user didn't select anything, search the currently highlighted word
            if selection.empty():
                text = self.view.word(selection)
                text = self.view.substr(text)
                SearchFor(text)
                break
            text = self.view.substr(selection)
            SearchFor(text)


class CfDocsSearchFromInputCommand(sublime_plugin.WindowCommand):
    def run(self):
        # Get the search item
        self.window.show_input_panel('Search CFDocs for', '',
            self.on_done, self.on_change, self.on_cancel)
{'fraction_non_alphanumeric': 0.09816247582205029, 'fraction_numerical': 0.0019342359767891683, 'mean_word_length': 2.9334600760456273, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6378249', 'n_tokens_mistral': 623, 'n_tokens_neox': 587, 'n_words': 160}