odyssomay / paredit

A paredit mode for lisps in Sublime Text.
104 stars 9 forks source link

Enable/disable paredit mode based on file type? #7

Closed xpe closed 10 years ago

xpe commented 11 years ago

When I'm editing a non-LISP document, I don't want paredit mode to be enabled. I'd also rather not have to switch manually. It would be nice if it enabled itself based on the file type or language type.

odyssomay commented 11 years ago

Sorry for the late answer, I don't know why I did that. :S

It's already possible to enable on file type and/or syntax. Press Preferences->Paredit->Settings in the menu to open the settings file.

It should look something like this:

{
    "enabled": true,
    "strict_mode": true,
    "syntax": ["."],
    "file_name": ["."]
}

Syntax and _filename works exactly the same way, on the syntax name and file name respectively. It's a list of regexes that tries to find a match within the name. For example, if you have ["Clojure", "Lisp"] as the syntax option, paredit will be enabled for syntaxes that contains one of those words. Same way for file_name. Note that you have to set file_name to [] or it will match on everything, effectively overriding the syntax option.

There is no way to disable paredit based on file name/syntax, is that something that would be useful?

xpe commented 11 years ago

For example, if you have ["Clojure", "Lisp"] as the syntax option, paredit will be enabled for syntaxes that contains one of those words.

I think that would be a reasonable default.

Unfortunately, I can't try this right now: here is what is happening at the moment. Given the current package settings, paredit won't let me change:

"syntax": ["."],

To

"syntax": ["Clojure", "Lisp"],

See #12.

xpe commented 10 years ago

This works well. Thanks. Closing.