Sublime Forum

PerlTidy for ST2

#1

Hi all,

I have adapted the perltidy plugin to ST2, you can find my version on github [1].

Many thanks to the author of the original pluging [2].

Cheers
Robert

[1] https://github.com/rbo/st2-perltidy
[2] http://sublime-text-community-packages.googlecode.com/svn/trunk/PerlTidy/

0 Likes

#2

Robert,

Thank you for your code. As a Sublime neophyte I must be missing something though. On Mac OS X, here’s what I see after a re-start of the app:

523 ~/Library/Application Support/Sublime Text 2/Packages/PerlTidy>ls
total 1064
4 Default.sublime-keymap 4 PerlTidyCommand.pyc 4 README.txt
4 PerlTidyCommand.py 4 PerlTidyCommand.py~ 1044 perltidy

So I view some Perl, do a select-all, but after a ctrl-t or a ctrl-shift-t I’m not seeing any “tidying”. Should I?

This is ST2, alpha, build 2065.

Thanks again.

0 Likes

#3

Fixed now, after re-install, no explanation.

0 Likes

#4

So I know this is a SUPER old post, sorry to bring it back. But I am trying to get this plugin to work on my windows machine and no matter what I do I cannot get it to work! I use Perl a lot and have to revert to using either the command line or notepad++ (shudders) to get it formatted the way I want. I would LOVE to do this inside of Sublime so I don’t have to keep switching between tools! Can anyone offer any help as to how to get this setup?

Thanks!

Nathan

0 Likes

#5

CTRL+`
What shows?

0 Likes

#6

I get this errors, after adding: “perltidy_cmd”: “perltidy”
I have perltidy in PATH

run perltidy perltidy Traceback (most recent call last): File ".\sublime_plugin.py", line 362, in run_ File ".\PerlTidyCommand.py", line 35, in run File ".\PerlTidyCommand.py", line 83, in tidy_region File ".\subprocess.py", line 701, in communicate File ".\subprocess.py", line 911, in _communicate UnicodeEncodeError: 'ascii' codec can't encode characters in position 53-57: ordinal not in range(128)

And for “perltidy_cmd”: “/C/Perl/site/bin/perltidy” I get

Unable to open /C/Documents and Settings/KES.HOMEUSER/Application Data/Sublime Text 2/Packages/User/Distraction Free.sublime-settings run /C/Perl/site/bin/perltidy /C/Perl/site/bin/perltidy Traceback (most recent call last): File ".\sublime_plugin.py", line 362, in run_ File ".\PerlTidyCommand.py", line 35, in run File ".\PerlTidyCommand.py", line 83, in tidy_region File ".\subprocess.py", line 701, in communicate File ".\subprocess.py", line 911, in _communicate UnicodeEncodeError: 'ascii' codec can't encode characters in position 53-57: ordinal not in range(128)

0 Likes

#7

Hi folks,

the current open bugs for the PerlTidy plugin have been fixed and I’ve sent a pull request to Robert, to accept the patches (https://github.com/rbo/st2-perltidy/pull/9). Meanwhile, you can get the latest version of the plugin here: https://github.com/vifo/st2-perltidy.

Cheers,
V.

0 Likes