Skip to content

Instantly share code, notes, and snippets.

@jamesmacaulay
Last active January 18, 2021 19:01
Show Gist options
  • Select an option

  • Save jamesmacaulay/5457344 to your computer and use it in GitHub Desktop.

Select an option

Save jamesmacaulay/5457344 to your computer and use it in GitHub Desktop.

Revisions

  1. jamesmacaulay revised this gist May 19, 2013. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion Main.sublime-menu
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,8 @@
    // If you need to customize the SublimeREPL settings for Clojure, you can copy Main.sublime-menu
    // from Packages/SublimeREPL/config/Clojure into Packages/User and edit as necessary.
    // from Packages/SublimeREPL/config/Clojure into Packages/User and edit as necessary. This will
    // change the behaviour of the REPL when selected from the menu (Tools > SublimeREPL > Clojure >
    // Clojure) but if you launch the REPL from the default shortcut or the command palette, it will
    // use the original unedited settings from the package.
    // This is the unedited file from the version of SublimeREPL I have right now:
    [
    {
  2. jamesmacaulay revised this gist May 19, 2013. 1 changed file with 41 additions and 0 deletions.
    41 changes: 41 additions & 0 deletions Main.sublime-menu
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,41 @@
    // If you need to customize the SublimeREPL settings for Clojure, you can copy Main.sublime-menu
    // from Packages/SublimeREPL/config/Clojure into Packages/User and edit as necessary.
    // This is the unedited file from the version of SublimeREPL I have right now:
    [
    {
    "id": "tools",
    "children":
    [{
    "caption": "SublimeREPL",
    "mnemonic": "r",
    "id": "SublimeREPL",
    "children":
    [
    {"caption": "Clojure",
    "id": "Clojure",
    "children":[
    {"command": "repl_open",
    "caption": "Clojure",
    "id": "repl_clojure",
    "args": {
    "type": "subprocess",
    "encoding": "utf8",
    "cmd": {"windows": ["lein.bat", "repl"],
    "linux": ["lein", "repl"],
    "osx": ["lein", "repl"]},
    "soft_quit": "\n(. System exit 0)\n",
    "cwd": {"windows":"c:/Clojure", // where the lein.bat lives!
    "linux": "$file_path",
    "osx": "$file_path"},
    "syntax": "Packages/Clojure/Clojure.tmLanguage",
    "external_id": "clojure",
    "extend_env": {"INSIDE_EMACS": "1"}
    }
    },
    {"command": "clojure_auto_telnet_repl",
    "id": "repl_clojure_telnet",
    "caption": "Clojure-Telnet"}]}
    ]
    }]
    }
    ]
  3. jamesmacaulay revised this gist May 18, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Clojure.sublime-settings
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    // Packages in use for Clojure:
    // installed Clojure packages:
    //
    // * BracketHighlighter
    // * lispindent
  4. jamesmacaulay revised this gist May 18, 2013. 1 changed file with 19 additions and 16 deletions.
    35 changes: 19 additions & 16 deletions Default (OSX).sublime-keymap
    Original file line number Diff line number Diff line change
    @@ -11,21 +11,6 @@
    { "keys": ["super+shift+t"], "command": "reopen_last_file" },
    { "keys": ["ctrl+super+r"], "command": "reveal_in_side_bar" },

    // sublime-paredit fixes:
    // ======================

    // Don't constrain close-parens unless we're in paredit mode:
    { "keys": [")"], "command": "insert_snippet", "args": {"contents": ")"}, "context":
    [{ "key": "setting.paredit_enabled", "operator": "equal", "operand": false }]},
    { "keys": [")"], "command": "run_macro_file", "args": {"file": "Packages/sublime-paredit/Paredit Closing Bracket.sublime-macro_"}, "context":
    [{ "key": "setting.paredit_enabled", "operator": "equal", "operand": true }]},
    { "keys": [")"], "command": "move", "args": {"by": "characters", "forward": true}, "context":
    [
    { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
    { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
    { "key": "following_text", "operator": "regex_contains", "operand": "^\\)", "match_all": true }
    ]
    },

    // SublimeREPL bindings:
    // =====================
    @@ -36,6 +21,7 @@
    { "keys": ["alt+super+x"], "command": "run_clojure_tests_from_current_namespace_in_repl"},
    { "keys": ["alt+super+a"], "command": "run_all_clojure_tests_from_project_in_repl"},


    // BracketHighlighter bindings:
    // ===========================

    @@ -57,5 +43,22 @@

    // Toggle high visibility mode
    { "keys": ["alt+super+="],
    "command": "bh_toggle_high_visibility"}
    "command": "bh_toggle_high_visibility"},


    // sublime-paredit fixes:
    // ======================

    // Don't constrain close-parens unless we're in paredit mode:
    { "keys": [")"], "command": "insert_snippet", "args": {"contents": ")"}, "context":
    [{ "key": "setting.paredit_enabled", "operator": "equal", "operand": false }]},
    { "keys": [")"], "command": "run_macro_file", "args": {"file": "Packages/sublime-paredit/Paredit Closing Bracket.sublime-macro_"}, "context":
    [{ "key": "setting.paredit_enabled", "operator": "equal", "operand": true }]},
    { "keys": [")"], "command": "move", "args": {"by": "characters", "forward": true}, "context":
    [
    { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
    { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
    { "key": "following_text", "operator": "regex_contains", "operand": "^\\)", "match_all": true }
    ]
    }
    ]
  5. jamesmacaulay revised this gist May 18, 2013. 2 changed files with 33 additions and 28 deletions.
    13 changes: 11 additions & 2 deletions Clojure.sublime-settings
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,12 @@
    // Packages in use for Clojure:
    //
    // * BracketHighlighter
    // * lispindent
    // * SublimeREPL
    // * sublime-paredit

    {
    "word_separators": "/\\()\"',;!@$%^&|+=[]{}`~?"
    }
    "word_separators": "/\\()\"',;!@$%^&|+=[]{}`~?",
    "paredit_enabled": true,
    "paredit_dont_match_single_quotes": true
    }
    48 changes: 22 additions & 26 deletions Default (OSX).sublime-keymap
    Original file line number Diff line number Diff line change
    @@ -11,31 +11,30 @@
    { "keys": ["super+shift+t"], "command": "reopen_last_file" },
    { "keys": ["ctrl+super+r"], "command": "reveal_in_side_bar" },

    // Clojure bindings:
    // =================

    // don't match single quotes
    { "keys": ["'"],
    "command": "insert_snippet",
    "args": {"contents": "'$0"},
    "context": [{ "key": "selector", "operator": "equal", "operand": "source.clojure" }]
    // sublime-paredit fixes:
    // ======================

    // Don't constrain close-parens unless we're in paredit mode:
    { "keys": [")"], "command": "insert_snippet", "args": {"contents": ")"}, "context":
    [{ "key": "setting.paredit_enabled", "operator": "equal", "operand": false }]},
    { "keys": [")"], "command": "run_macro_file", "args": {"file": "Packages/sublime-paredit/Paredit Closing Bracket.sublime-macro_"}, "context":
    [{ "key": "setting.paredit_enabled", "operator": "equal", "operand": true }]},
    { "keys": [")"], "command": "move", "args": {"by": "characters", "forward": true}, "context":
    [
    { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
    { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
    { "key": "following_text", "operator": "regex_contains", "operand": "^\\)", "match_all": true }
    ]
    },

    // SublimeREPL bindings:
    // =====================

    { "keys": ["alt+super+b"],
    "command": "repl_transfer_current",
    "args": {"scope": "block"}},
    { "keys": ["alt+super+r"],
    "command": "refresh_namespaces_in_repl"},
    { "keys": ["alt+super+i"],
    "command": "switch_to_current_namespace_in_repl"},
    { "keys": ["alt+super+x"],
    "command": "run_clojure_tests_from_current_namespace_in_repl"},
    { "keys": ["alt+super+a"],
    "command": "run_all_clojure_tests_from_project_in_repl"},

    { "keys": ["alt+super+b"], "command": "repl_transfer_current", "args": {"scope": "block"}},
    { "keys": ["alt+super+r"], "command": "refresh_namespaces_in_repl"},
    { "keys": ["alt+super+i"], "command": "switch_to_current_namespace_in_repl"},
    { "keys": ["alt+super+x"], "command": "run_clojure_tests_from_current_namespace_in_repl"},
    { "keys": ["alt+super+a"], "command": "run_all_clojure_tests_from_project_in_repl"},

    // BracketHighlighter bindings:
    // ===========================
    @@ -46,18 +45,15 @@

    // Swap quotes (only goes boths ways in supported languages...)
    { "keys": ["ctrl+shift+'"],
    "command": "bh_key",
    "args": {"lines" : true, "plugin": {"type": ["single_quote", "double_quote", "py_single_quote", "py_double_quote"], "command": "bh_modules.swapquotes"} }},
    "command": "bh_key", "args": {"lines" : true, "plugin": {"type": ["single_quote", "double_quote", "py_single_quote", "py_double_quote"], "command": "bh_modules.swapquotes"} }},

    // Select text between brackets
    { "keys": ["ctrl+alt+a"],
    "command": "bh_key",
    "args": {"lines" : true, "plugin": {"type": ["__all__"], "command": "bh_modules.bracketselect"} } },
    "command": "bh_key", "args": {"lines" : true, "plugin": {"type": ["__all__"], "command": "bh_modules.bracketselect"} } },

    // Select tag name of HTML/XML tag (both opening name and closing)
    { "keys": ["ctrl+alt+t"],
    "command": "bh_key",
    "args": {"plugin": {"type": ["cfml", "html", "angle"], "command": "bh_modules.tagnameselect"} } },
    "command": "bh_key", "args": {"plugin": {"type": ["cfml", "html", "angle"], "command": "bh_modules.tagnameselect"} } },

    // Toggle high visibility mode
    { "keys": ["alt+super+="],
  6. jamesmacaulay revised this gist May 18, 2013. 1 changed file with 9 additions and 0 deletions.
    9 changes: 9 additions & 0 deletions Default (OSX).sublime-keymap
    Original file line number Diff line number Diff line change
    @@ -11,6 +11,15 @@
    { "keys": ["super+shift+t"], "command": "reopen_last_file" },
    { "keys": ["ctrl+super+r"], "command": "reveal_in_side_bar" },

    // Clojure bindings:
    // =================

    // don't match single quotes
    { "keys": ["'"],
    "command": "insert_snippet",
    "args": {"contents": "'$0"},
    "context": [{ "key": "selector", "operator": "equal", "operand": "source.clojure" }]
    },

    // SublimeREPL bindings:
    // =====================
  7. jamesmacaulay revised this gist May 18, 2013. 1 changed file with 8 additions and 10 deletions.
    18 changes: 8 additions & 10 deletions ClojureHelpers.py
    Original file line number Diff line number Diff line change
    @@ -1,19 +1,17 @@
    import re, sublime, sublime_plugin, sublimerepl, text_transfer

    # class CallClojureFunctionInReplCommand(text_transfer.ReplTransferCurrent):
    # def run(self, edit):
    # text = "(" + self.selected_text() + ")"
    # self.view.window().run_command("repl_view_write", {"external_id": self.repl_external_id(), "text": text, "file_name": self.view.file_name()})


    class RefreshNamespacesInReplCommand(text_transfer.ReplTransferCurrent):
    def run(self, edit):
    text = "(clojure.tools.namespace.repl/refresh)"
    self.view.window().run_command("repl_send", {"external_id": self.repl_external_id(), "text": text, "file_name": self.view.file_name()})

    # class EvalClojureInReplCommand(text_transfer.ReplTransferCurrent):
    # def run(self, edit, text):
    # self.view.window().run_command("repl_send", {"external_id": self.repl_external_id(), "text": text, "file_name": self.view.file_name()})
    class SwitchToCurrentNamespaceInReplCommand(text_transfer.ReplTransferCurrent):
    def run(self, edit):
    if sublimerepl.manager.repl_view(self.view):
    return
    ns = re.sub("ns\s*", "", self.view.substr(self.view.find("ns\s*\S+",0)))
    text = "(in-ns '" + ns + ")"
    self.view.window().run_command("repl_send", {"external_id": self.repl_external_id(), "text": text, "file_name": self.view.file_name()})

    class RunAllClojureTestsFromProjectInReplCommand(text_transfer.ReplTransferCurrent):
    def run(self, edit):
    @@ -29,6 +27,6 @@ def run(self, edit):

    default_test_ns = re.sub("(.*)(?<!-test)\\Z","\\1-test", ns, 1)
    alt_style_test_ns = re.sub("\A([^\\.]*\\.)(?!test)","\\1test.", ns, 1)
    form = "(try (clojure.test/run-tests '" + default_test_ns + ") (catch Exception e (clojure.test/run-tests '" + alt_style_test_ns + ")))"
    form = "(try (clojure.test/run-tests '" + default_test_ns + ")\n (catch Exception e\n (clojure.test/run-tests '" + alt_style_test_ns + ")))"
    self.view.window().run_command("refresh_namespaces_in_repl")
    self.view.window().run_command("repl_send", {"external_id": self.repl_external_id(), "text": form, "file_name": self.view.file_name()})
  8. jamesmacaulay revised this gist May 18, 2013. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions Default (OSX).sublime-keymap
    Original file line number Diff line number Diff line change
    @@ -15,8 +15,9 @@
    // SublimeREPL bindings:
    // =====================

    { "keys": ["alt+super+b"], "command": "repl_transfer_current", "args": {"scope": "block"}},
    // { "keys": ["alt+super+c"], "command": "call_clojure_function_in_repl"},
    { "keys": ["alt+super+b"],
    "command": "repl_transfer_current",
    "args": {"scope": "block"}},
    { "keys": ["alt+super+r"],
    "command": "refresh_namespaces_in_repl"},
    { "keys": ["alt+super+i"],
  9. jamesmacaulay revised this gist May 18, 2013. 1 changed file with 8 additions and 8 deletions.
    16 changes: 8 additions & 8 deletions Default (OSX).sublime-keymap
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,12 @@
    [
    { "keys": ["escape"], "command": "auto_complete", "context":
    [
    { "key": "auto_complete_visible", "operator": "equal", "operand": false },
    { "key": "overlay_visible", "operator": "equal", "operand": false },
    { "key": "panel_visible", "operator": "equal", "operand": false },
    { "key": "num_selections", "operator": "equal", "operand": 1 }
    ]
    },
    { "keys": ["escape"], "command": "auto_complete", "context":
    [
    { "key": "auto_complete_visible", "operator": "equal", "operand": false },
    { "key": "overlay_visible", "operator": "equal", "operand": false },
    { "key": "panel_visible", "operator": "equal", "operand": false },
    { "key": "num_selections", "operator": "equal", "operand": 1 }
    ]
    },

    { "keys": ["super+shift+t"], "command": "reopen_last_file" },
    { "keys": ["ctrl+super+r"], "command": "reveal_in_side_bar" },
  10. jamesmacaulay revised this gist May 18, 2013. 1 changed file with 0 additions and 4 deletions.
    4 changes: 0 additions & 4 deletions Default (OSX).sublime-keymap
    Original file line number Diff line number Diff line change
    @@ -49,10 +49,6 @@
    "command": "bh_key",
    "args": {"plugin": {"type": ["cfml", "html", "angle"], "command": "bh_modules.tagnameselect"} } },

    // Surround selection with brackets from quick panel
    { "keys": ["ctrl+alt+w"],
    "command": "wrap_brackets" },

    // Toggle high visibility mode
    { "keys": ["alt+super+="],
    "command": "bh_toggle_high_visibility"}
  11. jamesmacaulay revised this gist May 18, 2013. 1 changed file with 3 additions and 11 deletions.
    14 changes: 3 additions & 11 deletions Default (OSX).sublime-keymap
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    [
    { "keys": ["escape"], "command": "auto_complete", "context":
    { "keys": ["escape"], "command": "auto_complete", "context":
    [
    { "key": "auto_complete_visible", "operator": "equal", "operand": false },
    { "key": "overlay_visible", "operator": "equal", "operand": false },
    @@ -19,6 +19,8 @@
    // { "keys": ["alt+super+c"], "command": "call_clojure_function_in_repl"},
    { "keys": ["alt+super+r"],
    "command": "refresh_namespaces_in_repl"},
    { "keys": ["alt+super+i"],
    "command": "switch_to_current_namespace_in_repl"},
    { "keys": ["alt+super+x"],
    "command": "run_clojure_tests_from_current_namespace_in_repl"},
    { "keys": ["alt+super+a"],
    @@ -37,16 +39,6 @@
    "command": "bh_key",
    "args": {"lines" : true, "plugin": {"type": ["single_quote", "double_quote", "py_single_quote", "py_double_quote"], "command": "bh_modules.swapquotes"} }},

    // Go to left bracket
    { "keys": ["ctrl+alt+super+,"],
    "command": "bh_key",
    "args": {"lines" : true, "plugin": {"type": ["__all__"], "command": "bh_modules.bracketselect", "args": {"select": "left"} } } },

    // Go to right bracket
    { "keys": ["ctrl+alt+super+."],
    "command": "bh_key",
    "args": {"lines" : true, "plugin": {"type": ["__all__"], "command": "bh_modules.bracketselect", "args": {"select": "right"} } } },

    // Select text between brackets
    { "keys": ["ctrl+alt+a"],
    "command": "bh_key",
  12. jamesmacaulay revised this gist May 18, 2013. 1 changed file with 3 additions and 7 deletions.
    10 changes: 3 additions & 7 deletions Preferences.sublime-settings
    Original file line number Diff line number Diff line change
    @@ -7,12 +7,8 @@
    "highlight_line": true,
    "match_brackets": false, // otherwise it gets confusing with BracketHighlighter installed
    "draw_indent_guides": true,
    "ignored_packages":
    [
    "Vintage",
    "PHP"
    ],
    "tab_size": 2,
    "ignored_packages": ["Vintage", "PHP"],
    "tab_size": 2,
    "detect_indentation": false,
    "translate_tabs_to_spaces": true
    "translate_tabs_to_spaces": true
    }
  13. jamesmacaulay revised this gist May 18, 2013. 1 changed file with 18 additions and 0 deletions.
    18 changes: 18 additions & 0 deletions Preferences.sublime-settings
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    {
    "theme": "Flatland.sublime-theme",
    "color_scheme": "Packages/Theme - Flatland/Flatland.tmTheme",
    "font_face": "Inconsolata",
    "font_size": 18.5,
    "caret_style": "wide",
    "highlight_line": true,
    "match_brackets": false, // otherwise it gets confusing with BracketHighlighter installed
    "draw_indent_guides": true,
    "ignored_packages":
    [
    "Vintage",
    "PHP"
    ],
    "tab_size": 2,
    "detect_indentation": false,
    "translate_tabs_to_spaces": true
    }
  14. jamesmacaulay revised this gist May 18, 2013. 1 changed file with 55 additions and 1 deletion.
    56 changes: 55 additions & 1 deletion Default (OSX).sublime-keymap
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,67 @@
    [
    { "keys": ["escape"], "command": "auto_complete", "context":
    [
    { "key": "auto_complete_visible", "operator": "equal", "operand": false },
    { "key": "overlay_visible", "operator": "equal", "operand": false },
    { "key": "panel_visible", "operator": "equal", "operand": false },
    { "key": "num_selections", "operator": "equal", "operand": 1 }
    ]
    },

    { "keys": ["super+shift+t"], "command": "reopen_last_file" },
    { "keys": ["ctrl+super+r"], "command": "reveal_in_side_bar" },


    // SublimeREPL bindings:
    // =====================

    { "keys": ["alt+super+b"], "command": "repl_transfer_current", "args": {"scope": "block"}},
    // { "keys": ["alt+super+c"], "command": "call_clojure_function_in_repl"},
    { "keys": ["alt+super+r"],
    "command": "refresh_namespaces_in_repl"},
    { "keys": ["alt+super+x"],
    "command": "run_clojure_tests_from_current_namespace_in_repl"},
    { "keys": ["alt+super+a"],
    "command": "run_all_clojure_tests_from_project_in_repl"}
    "command": "run_all_clojure_tests_from_project_in_repl"},


    // BracketHighlighter bindings:
    // ===========================

    // Swap bracket type
    { "keys": ["ctrl+shift+]"],
    "command": "swap_brackets"},

    // Swap quotes (only goes boths ways in supported languages...)
    { "keys": ["ctrl+shift+'"],
    "command": "bh_key",
    "args": {"lines" : true, "plugin": {"type": ["single_quote", "double_quote", "py_single_quote", "py_double_quote"], "command": "bh_modules.swapquotes"} }},

    // Go to left bracket
    { "keys": ["ctrl+alt+super+,"],
    "command": "bh_key",
    "args": {"lines" : true, "plugin": {"type": ["__all__"], "command": "bh_modules.bracketselect", "args": {"select": "left"} } } },

    // Go to right bracket
    { "keys": ["ctrl+alt+super+."],
    "command": "bh_key",
    "args": {"lines" : true, "plugin": {"type": ["__all__"], "command": "bh_modules.bracketselect", "args": {"select": "right"} } } },

    // Select text between brackets
    { "keys": ["ctrl+alt+a"],
    "command": "bh_key",
    "args": {"lines" : true, "plugin": {"type": ["__all__"], "command": "bh_modules.bracketselect"} } },

    // Select tag name of HTML/XML tag (both opening name and closing)
    { "keys": ["ctrl+alt+t"],
    "command": "bh_key",
    "args": {"plugin": {"type": ["cfml", "html", "angle"], "command": "bh_modules.tagnameselect"} } },

    // Surround selection with brackets from quick panel
    { "keys": ["ctrl+alt+w"],
    "command": "wrap_brackets" },

    // Toggle high visibility mode
    { "keys": ["alt+super+="],
    "command": "bh_toggle_high_visibility"}
    ]
  15. jamesmacaulay revised this gist May 18, 2013. 1 changed file with 0 additions and 35 deletions.
    35 changes: 0 additions & 35 deletions Main.sublime-menu
    Original file line number Diff line number Diff line change
    @@ -1,35 +0,0 @@
    [
    {
    "id": "tools",
    "children":
    [{
    "caption": "SublimeREPL",
    "mnemonic": "r",
    "id": "SublimeREPL",
    "children":
    [
    {"caption": "Clojure",
    "id": "Clojure",
    "children":[
    {"command": "repl_open",
    "caption": "Clojure",
    "id": "repl_clojure",
    "args": {
    "type": "subprocess",
    "encoding": "utf8",
    "cmd": {"windows": ["lein.bat", "repl"],
    "linux": ["lein", "repl"],
    "osx": ["lein", "repl"]},
    "soft_quit": "\n(exit)\n",
    "cwd": {"windows":"c:/Clojure", // where the lein.bat lives!
    "linux": "$file_path",
    "osx": "$file_path"},
    "syntax": "Packages/Clojure/Clojure.tmLanguage",
    "external_id": "clojure",
    "extend_env": {"INSIDE_EMACS": "1"}
    }
    }]}
    ]
    }]
    }
    ]
  16. jamesmacaulay revised this gist May 18, 2013. 1 changed file with 0 additions and 19 deletions.
    19 changes: 0 additions & 19 deletions Default (OSX).sublime-keymap
    Original file line number Diff line number Diff line change
    @@ -2,25 +2,6 @@
    { "keys": ["super+shift+t"], "command": "reopen_last_file" },
    { "keys": ["ctrl+super+r"], "command": "reveal_in_side_bar" },


    { "keys": ["ctrl+alt+super+r"],
    "command": "repl_open",
    "args": {
    "type": "subprocess",
    "encoding": "utf8",
    "cmd": {"windows": ["lein.bat", "repl"],
    "linux": ["lein", "repl"],
    "osx": ["lein", "repl"]},
    "soft_quit": "\n(exit)\n",
    "cwd": {"windows":"c:/Clojure", // where the lein.bat lives!
    "linux": "$file_path",
    "osx": "$file_path"},
    "syntax": "Packages/Clojure/Clojure.tmLanguage",
    "external_id": "clojure",
    "extend_env": {"INSIDE_EMACS": "1"}
    }
    },

    { "keys": ["alt+super+b"], "command": "repl_transfer_current", "args": {"scope": "block"}},
    // { "keys": ["alt+super+c"], "command": "call_clojure_function_in_repl"},
    { "keys": ["alt+super+r"],
  17. jamesmacaulay revised this gist May 18, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Clojure.sublime-settings
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,3 @@
    {
    "word_separators": "/\\()\"',;!@#$%^&|+=[]{}`~?"
    "word_separators": "/\\()\"',;!@$%^&|+=[]{}`~?"
    }
  18. jamesmacaulay created this gist Apr 25, 2013.
    3 changes: 3 additions & 0 deletions Clojure.sublime-settings
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    {
    "word_separators": "/\\()\"',;!@#$%^&|+=[]{}`~?"
    }
    34 changes: 34 additions & 0 deletions ClojureHelpers.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    import re, sublime, sublime_plugin, sublimerepl, text_transfer

    # class CallClojureFunctionInReplCommand(text_transfer.ReplTransferCurrent):
    # def run(self, edit):
    # text = "(" + self.selected_text() + ")"
    # self.view.window().run_command("repl_view_write", {"external_id": self.repl_external_id(), "text": text, "file_name": self.view.file_name()})


    class RefreshNamespacesInReplCommand(text_transfer.ReplTransferCurrent):
    def run(self, edit):
    text = "(clojure.tools.namespace.repl/refresh)"
    self.view.window().run_command("repl_send", {"external_id": self.repl_external_id(), "text": text, "file_name": self.view.file_name()})

    # class EvalClojureInReplCommand(text_transfer.ReplTransferCurrent):
    # def run(self, edit, text):
    # self.view.window().run_command("repl_send", {"external_id": self.repl_external_id(), "text": text, "file_name": self.view.file_name()})

    class RunAllClojureTestsFromProjectInReplCommand(text_transfer.ReplTransferCurrent):
    def run(self, edit):
    form = "(do (clojure.tools.namespace.repl/refresh) (apply clojure.test/run-tests (clojure.tools.namespace.find/find-namespaces-in-dir (clojure.java.io/file \"test\"))))"
    self.view.window().run_command("refresh_namespaces_in_repl")
    self.view.window().run_command("repl_send", {"external_id": self.repl_external_id(), "text": form, "file_name": self.view.file_name()})

    class RunClojureTestsFromCurrentNamespaceInReplCommand(text_transfer.ReplTransferCurrent):
    def run(self, edit):
    if sublimerepl.manager.repl_view(self.view):
    return
    ns = re.sub("ns\s*", "", self.view.substr(self.view.find("ns\s*\S+",0)))

    default_test_ns = re.sub("(.*)(?<!-test)\\Z","\\1-test", ns, 1)
    alt_style_test_ns = re.sub("\A([^\\.]*\\.)(?!test)","\\1test.", ns, 1)
    form = "(try (clojure.test/run-tests '" + default_test_ns + ") (catch Exception e (clojure.test/run-tests '" + alt_style_test_ns + ")))"
    self.view.window().run_command("refresh_namespaces_in_repl")
    self.view.window().run_command("repl_send", {"external_id": self.repl_external_id(), "text": form, "file_name": self.view.file_name()})
    32 changes: 32 additions & 0 deletions Default (OSX).sublime-keymap
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    [
    { "keys": ["super+shift+t"], "command": "reopen_last_file" },
    { "keys": ["ctrl+super+r"], "command": "reveal_in_side_bar" },


    { "keys": ["ctrl+alt+super+r"],
    "command": "repl_open",
    "args": {
    "type": "subprocess",
    "encoding": "utf8",
    "cmd": {"windows": ["lein.bat", "repl"],
    "linux": ["lein", "repl"],
    "osx": ["lein", "repl"]},
    "soft_quit": "\n(exit)\n",
    "cwd": {"windows":"c:/Clojure", // where the lein.bat lives!
    "linux": "$file_path",
    "osx": "$file_path"},
    "syntax": "Packages/Clojure/Clojure.tmLanguage",
    "external_id": "clojure",
    "extend_env": {"INSIDE_EMACS": "1"}
    }
    },

    { "keys": ["alt+super+b"], "command": "repl_transfer_current", "args": {"scope": "block"}},
    // { "keys": ["alt+super+c"], "command": "call_clojure_function_in_repl"},
    { "keys": ["alt+super+r"],
    "command": "refresh_namespaces_in_repl"},
    { "keys": ["alt+super+x"],
    "command": "run_clojure_tests_from_current_namespace_in_repl"},
    { "keys": ["alt+super+a"],
    "command": "run_all_clojure_tests_from_project_in_repl"}
    ]
    35 changes: 35 additions & 0 deletions Main.sublime-menu
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    [
    {
    "id": "tools",
    "children":
    [{
    "caption": "SublimeREPL",
    "mnemonic": "r",
    "id": "SublimeREPL",
    "children":
    [
    {"caption": "Clojure",
    "id": "Clojure",
    "children":[
    {"command": "repl_open",
    "caption": "Clojure",
    "id": "repl_clojure",
    "args": {
    "type": "subprocess",
    "encoding": "utf8",
    "cmd": {"windows": ["lein.bat", "repl"],
    "linux": ["lein", "repl"],
    "osx": ["lein", "repl"]},
    "soft_quit": "\n(exit)\n",
    "cwd": {"windows":"c:/Clojure", // where the lein.bat lives!
    "linux": "$file_path",
    "osx": "$file_path"},
    "syntax": "Packages/Clojure/Clojure.tmLanguage",
    "external_id": "clojure",
    "extend_env": {"INSIDE_EMACS": "1"}
    }
    }]}
    ]
    }]
    }
    ]
    3 changes: 3 additions & 0 deletions SublimeREPL.sublime-settings
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    {
    "default_extend_env": {"PATH": "/opt/boxen/homebrew/bin:{PATH}:/usr/local/bin"}
    }