Parinfer
Parinfer plugin for Sublime Text
Details
Installs
- Total 3K
- Win 556
- Mac 1K
- Linux 688
Feb 28 | Feb 27 | Feb 26 | Feb 25 | Feb 24 | Feb 23 | Feb 22 | Feb 21 | Feb 20 | Feb 19 | Feb 18 | Feb 17 | Feb 16 | Feb 15 | Feb 14 | Feb 13 | Feb 12 | Feb 11 | Feb 10 | Feb 9 | Feb 8 | Feb 7 | Feb 6 | Feb 5 | Feb 4 | Feb 3 | Feb 2 | Feb 1 | Jan 31 | Jan 30 | Jan 29 | Jan 28 | Jan 27 | Jan 26 | Jan 25 | Jan 24 | Jan 23 | Jan 22 | Jan 21 | Jan 20 | Jan 19 | Jan 18 | Jan 17 | Jan 16 | Jan 15 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Mac | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 | 1 | 0 | 0 | 0 | 0 | 0 |
Linux | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 | 0 | 0 | 0 | 0 | 0 |
Readme
- Source
- raw.githubusercontent.com
Parinfer for Sublime Text
A Parinfer package for Sublime Text.
What is Parinfer?
Parinfer is a text editing mode that can infer Lisp code structure from indentation (and vice versa). A detailed explanation of Parinfer can be found here.
Put simply: the goal of Parinfer is to make it so you never have to think about “balancing your parens” when writing or editing Lisp code. Just indent your code as normal and Parinfer will infer the intended paren structure.
Installation
Package Control
If you have Package Control installed, you can easily install the Parinfer package:
- In Sublime Text, open the Command Palette by typing Ctrl+Shift+p (Cmd+Shift+p on Mac)
- Type
install
and selectPackage Control: Install Package
- A text prompt should appear shortly after Package Control loads a list of packages from the Internet.
- Type
parinfer
and press Enter - That's it! Parinfer is now installed.
Linux / OSX
You can symlink this repo to the Sublime Text Packages directory:
cd ~
git clone git@github.com:oakmac/sublime-text-parinfer.git
ln -s ~/sublime-text-parinfer ~/Library/Application\ Support/Sublime\ Text/Packages/Parinfer
Windows
cd %APPDATA%\Sublime Text 2\Packages
git clone https://github.com/oakmac/sublime-text-parinfer.git Parinfer
Usage
File Extensions
Once installed, Parinfer will automatically activate when you open a file with a known file extension.
You can change the list of watched file extensions by going to Preferences –> Package Settings –> Parinfer –> Settings.
Opening a File
When a file with a recognized extension is opened, Parinfer will enter
Parinfer: Waiting
mode and wait for the first edit to the buffer. When
the first edit occurs, Parinfer will enter Parinfer: Indent
mode and begin
controlling closing parenthesis based on indentation.
Behavior Change for v1.0.0
Before v1.0.0, when a file was opened Parinfer would run Paren Mode on the entire file first before entering Indent Mode (see Fixing existing files for more details). This was not a problem for regular users of Parinfer because running Paren Mode on a file written using Parinfer will not result in any changes.
However, this behavior was sometimes confusing for users new to Parinfer when they would open a file not written using Parinfer and see edits in places they did not intend to make.
Starting with v1.0.0, Parinfer will first enter “Waiting” mode and only begin
controlling closing parens after the first modification to the buffer. If you
desire the pre-v1.0.0 behavior, set the config setting
run_paren_mode_when_file_opened
to true
.
Additionally, there is a new Parinfer: Run Paren Mode on Current Buffer
command that can be executed at anytime and will run Paren Mode over the
entire active buffer.
Hotkeys and Status Bar
Command | Windows/Linux | Mac |
---|---|---|
Turn on / Toggle Mode | Ctrl+( | Cmd+( |
Turn off | Ctrl+) | Cmd+) |
The status bar will indicate which mode you are in or show nothing if Parinfer is turned off.
The “parent expression” hack
This extension uses a hack for performance reasons that may result in odd
behavior in rare cases. It assumes that an open paren followed by an alpha
character - ie: regex ^\([a-zA-Z]
- at the start of a line is the beginning
of a new “parent expression” and tells the Parinfer algorithm to start
analyzing from there until the next line that matches the same regex. Most of
the time this is probably a correct assumption, but might break inside
multi-line strings or other non-standard circumstances. This is tracked at
Issue #23; please add to that if you experience problems.