<commit_before>! Copyright (C) 2013 <NAME>.
! See http://factorcode.org/license.txt for BSD license.
USING: editors io.pathnames io.standard-paths kernel make
math.parser namespaces sequences system ;
IN: editors.sublime

SINGLETON: sublime
sublime editor-class set-global

HOOK: find-sublime-path os ( -- path )

M: object find-sublime-path "sublime" ;

M: macosx find-sublime-path
    "com.sublimetext.2" find-native-bundle [
        "Contents/SharedSupport/bin/subl" append-path
    ] [
        f
    ] if* ;

ERROR: editor-not-found editor ;

: sublime-path  ( -- path )
    \ sublime-path get-global [
        find-sublime-path [ "sublime" editor-not-found ] unless*
    ] unless* ;

M: sublime editor-command ( file line -- command )
    [
        sublime-path , "-a" , number>string ":" glue ,
    ] { } make ;
<commit_msg>editors.sublime: Prefer sublime 3 over sublime 2 on mac.<commit_after>! Copyright (C) 2013 <NAME>.
! See http://factorcode.org/license.txt for BSD license.
USING: editors io.pathnames io.standard-paths kernel make
math.parser namespaces sequences system ;
IN: editors.sublime

SINGLETON: sublime
sublime editor-class set-global

HOOK: find-sublime-path os ( -- path )

M: object find-sublime-path "sublime" ;

M: macosx find-sublime-path
    { "com.sublimetext.3" "com.sublimetext.2" } [ find-native-bundle ] find nip [
        "Contents/SharedSupport/bin/subl" append-path
    ] [
        f
    ] if* ;

ERROR: editor-not-found editor ;

: sublime-path  ( -- path )
    \ sublime-path get-global [
        find-sublime-path [ "sublime" editor-not-found ] unless*
    ] unless* ;

M: sublime editor-command ( file line -- command )
    [
        sublime-path , "-a" , number>string ":" glue ,
    ] { } make ;

{'fraction_non_alphanumeric': 0.13275862068965516, 'fraction_numerical': 0.007471264367816092, 'mean_word_length': 2.851769911504425, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 7, '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': '4315327', 'n_tokens_mistral': 637, 'n_tokens_neox': 612, 'n_words': 145}