Chad writes "So I'm looking for an editor for my Perl programming. I realize that any old text editor will do, but I want something that will help me be a little more productive... At the risk of starting another Editor Holy War, the question I'd like to ask is: what editor do you use?"
He adds: "You know: color syntax highlighting, auto-indenting, code completion, error detection. I've pretty much settled on XEmacs because it offers the best set of features I have been able to find, but a major problem of XEmacs is that its syntax highlighter chokes on any but the most basic Perl constructs. [Ah, the great perl-mode/cperl-mode confusion... - S.] I've tried Komodo, which offers some nice features like running your code through Perl to find errors as you code, plus a perfect understanding of Perl syntax, a nifty regular expression toolkit, and a cool feature called code-folding, but it's still a bit buggy (copy and paste doesn't always work; code folding sometimes slurps in more lines than it should), and it sports a $300 price tag."
Re:VIM !
cmilfo on 2002-04-25T20:12:53
right on...
http://vim.sourceforge.net
Two of my favorite things:
Editing features for advanced users
.vimrc options to assist with perl coding
Cheers!Re:VIM !
pne on 2002-04-26T06:08:00
I generally use vim when I work under Linux (but not so much by choice, more because it's what comes up when I type 'vi', which is my editor more or less because it's the first Unix editor I became acquainted with). When I work on Windows, I usually use TextPad, and when I write code on our HP-UX machine at work, I usually use gvim.
I wouldn't necessarily advocate them since I didn't choose those based on careful evaluation of two dozen editors; they're just what I happen to use.
Re:more productive?
Mr_Perl on 2002-04-25T20:00:09
Code completion annoys me. It seems intended to be a crutch for those who don't yet know the language very well.
Syntax highlighting on the other hand makes it very easy to spot typos in Perl. If you mis-quote something, or leave off something you shouln't, you'll know it because the next few 'paragraphs' of code will be the wrong color.Code completion
lachoy on 2002-04-25T20:26:38
In Java, I find it useful for when I'm learning a new library. It's also decent for using libraries that
implementLongFunctionNamesForEverything()
so I can just type 'imp<TAB>' and pick the right one. In that other language, it's also useful for argument order, particularly for overloaded methods.Chris
M-x auto-bs-modeRe: Code Completion
Smylers on 2002-04-26T08:36:13
Code completion annoys me.Automatic code completion would probably annoy me too, but in Vim I find
Ctrl+P
invaluable for completing partially typed words.For example if you have a variable called
$inner_template_filename
then merely typing$inn
then pressingCtrl+P
will type this. It's a great time-saver, reduces typos, and means that using meaningful identifier names is much less painful.(There's actually slightly more to it:
SmylersCtrl+P
repeatedly cycles through different previously-used words that can complete what you've already typed;Ctrl+N
cycles t'other way (for the ‘next’ word); and once you've completed a wordCtrl+X Ctrl+P
will type the following word for you.)Re: Code Completion
Dom2 on 2002-04-26T08:46:39
Just for reference, that's the same as M-/ in emacs. It's called dynamic-abbrevs and it's a very handy tool.
-DomRe:more productive?
chicks on 2002-04-26T02:38:53
Does all of that stuff really make you more productve? I find that syntax highlighting and "code completion" just get in the way more times than not. Thus I use vi in all it's varied guises and I'm perfectly happy.I'd really hate to go without syntax highlighting for anything significant. It helps catch a lot of errors earlier. The implementation in vim catches a number of stupid typos before I try to run the code. I've tried various code completion things, but I've never found any that worked better than just typing. I had paren completion (it would put in the right of whatever left paren -- (, [, or < -- I put in. That was much more trouble than it was worth.
Hint! This seems like it'd be a nice survey!
Re:Kate ~ Kwrite
BillStone on 2005-01-27T15:58:36
My favorite editor is Professional Notepad. I do all my PHP PERL MySql stuff in it.
HTML editor - professional notepad
Smart editor with easy interface.
Both Unix and Windows:
Re:Unix or Windows?
quinkan on 2002-04-26T02:52:28
OptiPerl on Windows. Extensible, configurable, handles CGI via Apache or its own server. All kinds of enhancements... all of this and you +don't+ need the lazy $1000 sitting around -- it's budget priced.
I have it working with CS-RCS quite nicely.
If I want to use Devel::ptkdb instead of the built-in debugger, I switch to a tools menu item.
Inbuilt Perl-tidy, a code library tool for snippets, a pod extractor, a regex tester... etc.
I used Xemacs before, but wouldn't go back for Perl now. Syntax colouring seems to work better than Ilya's used to...:-)
Re:Unix or Windows?
djberg96 on 2002-04-26T03:40:43
Oh, thanks. Never heard of that one. I was just about to mention OpenIDE for Windows, only now I can't seem to find it. Don't tell me that it's gone! A google search reveals no relevant results.Bummer. I don't think I saved a copy, either.
Re:Unix or Windows?
sumarjaya on 2002-04-26T09:14:25
I usually use UltraEdit-32 version 8.2 both for text editting and to my Perl programming. You can use the syntax highligted feature and also the auto complete tags. I found it very useful for large code.Re:Unix or Windows?
2shortplanks on 2002-04-26T13:40:00
UltraEdit is a Windows program, though it runs quite happly under wine without many problems (it can't launch other programs, and some people say it's a little slow.)I use it when I have to use a Windows PC (it's small and easy to download) but I'm too hardwired to vi and emacs keyshortcuts these days to use a third editor
Re: What editor do you use for Perl programming?
lachoy on 2002-04-25T20:31:15
CPerl mode should let you determine not only colors but also indent style and length. I think in GNU Emacs you can do
M-x customize-group
and then enterCperl
to walk through the gory details. (Works in XEmacs anyway...)Chris
M-x auto-bs-mode
Re:Komodo or HTML-Kit
jwbozzy on 2002-04-25T21:12:52
Komodo can be had for $29.95 for personal use, and it supports Ctrl-C, Ctrl-V copy and paste better than normal mouse based cut and paste. What version were you using?Re:Komodo or HTML-Kit
Chad on 2002-04-25T21:44:39
I downloaded the trial version of Komodo 1.2 and had major problems with cut, copy, and paste. Specifically, sometimes when I would block out huge chunks of code, then hit Ctrl-X, all the code would disappear as expected. Then I would reposition my cursor to the desired insertion point, hit Ctrl-V, and.... nothing. It ate the cut text.
In addition, I had problems with code-folding, which is a great idea for coding. Sometimes the code folding would work great; other times it would fold up the entire rest of the file even though it should have only slurped up the next few lines. Other times it would slurp up about a page and a half, and then stop somewhere in the middle of another subroutine. Weird.
Another problem I had with Komodo is that while I was trying it out, I went through a file that I had been working on, and typed in a bunch of garbage all over the place, to see how it would handle things. When I got done, I exited the editor, and told it not to save any changes. When I opened it back up, a lot of that garbage was still in there. Apparently I got bit by the "auto-save" feature, which I had ignorantly assumed worked like the one in XEmacs. I turned that off in a big hurry.
The $29.95 version that you mention is not for personal use. It is for teaching/learning use. I can't honestly say that I would use it for teaching/learning, even though I would not be selling any programs that I write while using it. So the $295 version is the only one available to me, and with all the problems it has, it seems a bit steep.
If those problems were fixed, though, I like what Komodo offers, probably even enough to fork out the $295 for it. (Now if it only had incremental search...! )
Odds are, if an editor is good enough to pass that first test, it's ging to offer customizations, it's going to offer support for particular programming languages, then go look at those and decided if you want to use them. If you want syntax highlighting, turn it on; If you want auto indenting, turn it on; If you want code completion, turn it on. Personally, I hate code ompletion, but I love auto-tabbing and syntax highlighting. They help me see typos faster.
Personally, I use perl-mode, and the only problems I've ever had with it not highlighting the way I think it should is when I put funky characters like '#' or '"' inside qq() or qw(). The only time it doesn't auto-indent in a way that makes sense is when it sees something it thinkgs is code in here docs. I don't mind either of these, because it shows me places where other people would probably be confused by my code at first glance as well.
Again, any editor worth using is going to be customizable, if you don't like the default tabing depth in perl-mode, tweak it; if you don't like the colours used or comments, tweak it. But those aren't reasons NOT to use an editor, or not to use the language speciffic support in an editor.
I'm currently drinking the Emacs Kool-Aid. Choice of flavor: GNU.
I used to swear by VIM. From the day I discovered emacs, I had the feeling that I was supposed to learn it, and that I would, "some day." It just seemed like the thing a UNIX person was eventually supposed to do. My switch from straight vi to vim just about killed that desire; I figured it was good enough, and I was highly productive with it.
Then I started noticing that a lot of the programmers I respect use emacs. I started suspecting that there was something I was missing, and that if I changed editors, I would see some incredible results.
I'm reasonably emacs competent now. I force myself not to use the mouse so I can do everything with the keyboard and truly learn emacs features (I always did the same thing with vim.) I'm currently living with the emacs default indenting style for Perl. (I realize now there are at least two Perl modes; when I grow stronger in the ways of the emacs force, I'll check the other one out in detail.) What I really want is to some day program the way I did in THINK Pascal for Macintosh: I would never press return or tab; the editor handled it for me. Some day I hope to know enough about emacs to make that happen. Even (especially!) if it means I have to do LISP.
Today I discovered how emacs integrates with version control. I was ecstatic, and shared it with some coworkers who haven't started down this path yet. They thought it was neat, too.
Looking forward to all the wonderful things emacs has in store for me. Like UNIX, Perl, and vi, there seems to be something new to learn every day.
Re:Emacs
brianarn on 2002-04-26T03:38:32
I would never press return or tab; the editor handled it for me.
In cperl-mode in Emacs, it puts a Perl menu on the menubar, which allows for some extra features, and what you describe is (almost) implemented in one.
Auto newline (C-c C-a is the keyboard shortcut for ya, M-x cperl-mode to get into the mode) will automatically newline-and-indent for you after each semicolon, and it also seems to do the same when you write if (conditional) { right after the curly brace. It didn't seem to like doing it after else though, so you may have to hit tab or enter a time or two to fix the indentation. =)
~BrianRe:Emacs
jdavidb on 2002-04-26T04:33:27
Thank you! As it is now 11:33 in my timezone, I have officially learned two things about emacs today, making this a very good day indeed.
:) Re:Emacs
Mur on 2002-04-26T13:27:37
I too, got turned on by Emacs a long time ago, lost it for years (no good PC port), rediscovered it, and standardized on it on both Windows and Linux. I find that I can carry around a pretty basic.emacs file and be confident that I can do the same editing with the same keystrokes no matter where I am.
Re:simple...
torin on 2002-04-26T18:42:00
Vim is not vi on crack, it's a munged vi. It breaks several of my habits in vi. If I have to use a vi, I use nvi, the actual successor to vi.
If I need all the fancy gew-gaws of vim, I use something designed for gew-gaws: XEmacs...
Re:simple...
pne on 2002-04-30T13:55:40
It breaks several of my habits in vi.
Which ones? vim is supposed to be fairly compatible with vi (especially if the 'compatible' option is turned on).
The only thing that comes to my mind is that you can't type 'uu' to go to the last line where you changed something (since vim has multi-level undo by default, the second 'u' won't Undo the Undo -- but one can probably turn that hebaviour off). But then, I'm not a hard-core vi user. What, specifically, breaks for you? (Honest question.)
Re:simple...
sboss on 2002-05-01T21:32:41
I did not know of anything that it broke from being truely vi compatable. Please let me know. I have gotten used to vim and use it everywhere.
scott
I've been yearning to treat my code like a collapsable outline, hiding everything but the subroutine I'm working on and the names of other top-level subroutines. I think I remember cperl having something like that, so I guess it's time to RTFM
I've never needed fancy IDEs and graphical debuggers. Not because I'm super smart and never need a debugger or help with a function, but because I've never done anything complex enough to need that much debugging.
--Nat
Re:emacs + cperl
Chad on 2002-04-25T21:47:47
Okay, so I am unaware of the CPerl/perl-mode differences, and that may be part of my confusion. I just tried "M-x perl-mode" in XEmacs, and it *did* fix the syntax in pod, but it still couldn't handle the qq|text| constructs.
Is this normal? Or am I doing something wrong. Can someone explain how I can get perl-mode to come up automatically the way CPerl does?
Thanks.Re:emacs + cperl
IlyaM on 2002-04-26T07:11:07
cperl-mode is much more advanced Perl mode than perl-mode. But for some uncertaint reason perl-mode still is default. My advice: just stop using perl-mode. It can be easily get confused with various Perl code and has less feautures than cperl-mode.To prevent myself from entering perl-mode by accident I have added following line into my
.emacs: (defalias 'perl-mode 'cperl-mode)
It aliases cperl-mode to perl-mode.
Another hint: cperl-mode can handle allmost all Perl code correctly but sometimes you need to explicitly ask it to reparse buffer with commands M-x load-library cperl-mode RET M-x normal-mode RET. It may fix some highlighting problems.
Re:emacs + cperl
Chad on 2002-04-26T18:42:35
I am using XEmacs, and at the bottom in parentheses, where it lists the major mode, it says CPerl automatically whenever I edit a Perl file. However, just to make sure, I entered M-x cperl-mode.However, I still have problems with a line like this:
my $weird_highlighting=qq|Don't do this!|;
because the syntax highlighter doesn't seem to understand the qq function, and suddenly the rest of my code is marked as a string, which makes syntax highlighting worse than worthless.
I had been having problems with POD highlighting as well, but that seems to have been fixed by enabling hairy, whatever that means.
Re:emacs + cperl
IlyaM on 2002-04-26T21:17:16
My GNU Emacs 21.1 handles such syntax in cperl-mode just fine. Maybe XEmacs you are using has old version of cperl-mode. You may try downloading latest version from http://www.cpan.org/modules/by-module/CPAN/ILYAZ/cperl-mode/.
When writing code for CamelBones on my mac, I use Project Builder. Sure, it's not quite as full-featured as emacs, nor as keyboard-terse as vi, but it works pretty well, and as an integrated editor/build environment it more than meets my needs.
Re:ProjectBuilder's nice....
jonasbn on 2002-04-26T06:46:36
I just bought a Mac can you offer some tips on integrating Project Builder and Perl?
jonasbnRe:ProjectBuilder's nice....
Elian on 2002-04-26T16:13:06
Sure. Project builder works fine as a plain editor, or a plain editor with CVS connections. (And it's worth it to set CVS up)
For CamelBones, the easiest thing to do is check out the Peoject Builder extras from the repository and use them--they'll add a Cocoa-Perl template project with all the bits in it you need to build an app.
Just make sure you install the developer tools for all the pieces you need. It's worth it to sign up for the Apple Developer Connection program too, to get the reasonably latest versions of the dev tools.
Re:But for the want of an indenter...
Chad on 2002-04-25T22:00:49
The [Tab] key in CPerl is one of the main reasons I like XEmacs. It's wonderful! Why can't every text editor have something similar? Now if I could just figure out a way to tell XEmacs to [Tab] every line of a file with a single keystroke seyquence...Re:But for the want of an indenter...
jaffray on 2002-04-25T22:51:50
M-x indent-region. Bind something to it.Re:But for the want of an indenter...
Chad on 2002-04-26T18:44:02
For some reason using M-x indent-region indents at a different level than the [Tab] key does...Re:But for the want of an indenter...
cogent on 2002-04-26T00:18:54
I have this in my
.vimrc: set shiftwidth=8 " sw: a healthy tab stop
set textwidth=72 " tw: wrap at 72 characters
set autoindent " ai: indent to match previous line
set cindent " cin: Use C-indenting
set cinkeys=0{,0},!^F,o,O,e " cink: Perl-friendly reindent keys
set cinoptions=t0,+4,(0,)60,u0,*100 " cino: all sorts of options
set cinwords=if,else,while,do,for,elsif,sub
set comments=n:# " com: Perlish comments
set formatoptions=crql " fo: word wrap, format comments
set nosmartindent " nosi: Smart indent useless when C-indent is on
set showmatch " show matches on parens, bracketc, etc.(Actually, this is just my Perl config. I have a few that are set based on filetype. I can give you my
.vimrc if you're interested.) Then, things basically are just magically formatted. I've found a couple of bugs with Vim 6, but those are really rare, and I'm not sure I really found a bug. Use the :help
command to learn how these work. Particularly:help 'cinoptions'
In the cases where you need to reformat, use the
gq
+ movement command. (Incidentally, with the correct config--which I'll post if you want--you can usegq
to rewrap quotes sent in email. Which I find terribly useful.Re:But for the want of an indenter...
koschei on 2002-04-26T04:48:41
Either double-tap '=' on a line (i.e. == ) or do a motion with = (e.g. 4=j to format the line you're on and 4 below; or =% to format the paren pair you're in, or 1G0=G to reformat the entire file, although that can probably be made shorter it's a rare occurence since vim generally gets it right for me).
Re:NEdit
MythosTraecer on 2002-04-26T19:27:14
I use NEdit too. It's so cool.
It's unobtrusively simple-looking, which makes it easy to forget that it's nicely reconfigurable, esp. in keybindings. Apparently free, too!
It does have the odd problem with print
print qq(<!--#include
works in perl, but breaks in cperl-mode. Easy fix is just to escape the \#, which works in both.
So, does anyone have any extensive customizations to their cperl-mode, or some
Here's mine:
(add-hook 'cperl-mode-hook
(lambda ()
(set (make-local-variable 'compile-command)
(concat "perl -w " buffer-file-name))
(set-face-background 'modeline "slategray" (current-buffer))))
(setq cperl-hairy t)
(setq cperl-electric-parens-string nil)
(global-set-key "\C-j" 'cperl-linefeed)
~a
On my Linux box I've been using vim, but it's slow going because I don't have to use it every day (yet). Ideally I'd like to play with both emacs and vim for a couple days each and see which fits my brain better before I decide.
Re:Minority Voice
Matts on 2002-04-27T08:38:30
Try cream. It's vim, but with the keymappings changed so it's like a windows editor (ctrl-x/c/v for cut/copy/paste, ctrl-f for find, etc).