[TS EDITOR WARS] General thread for recommendations, discussion and tips on editors.

TheEcologist

Global Moderator
Code editors. Any serious programmer has his or her favorite. Some just use notepad, others go full feature like eclipse, some like it fancy (sublime text), others like it simple (gedit) while a few even go so far as to prefer ancient editors like Emacs and Vim.. What's your (current) editor? Why do you like it? Do you have some essential tips for it's use? What makes it the best? On this forum, we discuss some of the perks of this editor versus that weekly in the chatbox, but those ideas get lost. Which is wrong. Therefore, we need a thread. A permanent place - to be used as a reference - for all things editor wise.

I'll start with myself. After years if wandering from Notepad ++, Tinn-R, Geany, Sublime, Vi, Gedit, I ended up with Emacs.

It doesn't look great, but it's features are truly limitless if you can overcome the short learning curve required for its use.

Some reasons why I like it:

• It's free. Not just "free as in free beer" but it is free in the sense of all four freedoms.
• It enables rapid programming in any language through unique key bindings.
• It is endlessly customizable - and many technically savvy people use it and distribute their customization for free. New customization appear with a rapid pace - it is hard to keep up.

My tip:

Using the below lisp code, I found that I could add enormous amount of functionality to my work (e.g. send pieces of code to a server to be executed, while I code on).

Code:
defvar script-name "/foo/bar/my-script")

(defun call-my-script-with-word ()
(interactive)
(shell-command
(concat script-name
" "
(thing-at-point 'word))))
(global-set-key (kbd "C-c o") 'call-my-script-with-word)
Dirk Eddelbuettel said it better than me.

What is the core reason to learn Emacs? It has much to do with the saying "you can give a man a fish ...." . I'm positive that with the likes of Hadley Wickham developing R-Studio that such a integrated text-editor will soon be so feature rich that you will be able to do a great deal of what I can do with emacs. However you will never learn to implement such things yourself - with emacs you are only limited by your skill in lisp. This is the final freedom that (the church of) emacs gives you. Therefore, learn emacs if you want to catch your own fish.. otherwise rejoice in what the great fisherman Hadley, peace be with him, gives you.

EDIT (relevant):

Last edited:

vinux

Dark Knight
Re: [TS EDITOR WARS] General thread for recommendations, discussion and tips on edito

Emacs. I became a full time Emacs user after knowing about org-mode. I still like vi for small edits (I was a full time VI user till 2011).

There are many reasons for why I like Emacs. Frankly, I am not a good programmer or a perfectionist. But, Emacs is a big help for all my programming and documentation (I largely steal good Emacs practises from experts). The reasons are almost covered by TE and Dirk's post.

I will discuss more about orgmode. If anyone would like to master in Emacs, orgmode is the best way (mode details here).

In dirk's post there is a mention about orgmode. Here are some more good/fancy stuff about orgmode

TheEcologist

Global Moderator
Re: [TS EDITOR WARS] General thread for recommendations, discussion and tips on edito

Emacs.
In dirk's post there is a mention about orgmode. Here are some more good/fancy stuff about orgmode
This is good stuff thanks!

bryangoodrich

Probably A Mammal
Re: [TS EDITOR WARS] General thread for recommendations, discussion and tips on edito

wow!

So what else can this org-mode do, particularly in programming languages (sorry, html isn't a programming language lol)

trinker

ggplot2orBust
Re: [TS EDITOR WARS] General thread for recommendations, discussion and tips on edito

I personally like Notepad ++ and RStudio for R work.

I like both of these editors because they're ready to go straight out of the box and they both have tons of nice features and are pretty intuitive. I'll talk about them separately. By the way it sounds like emacs is very powerful but I just haven't had the time or been motivated to learn emacs because I'm pretty satisfied with my current setup workflow.

RStudio is a gui to R.
Pros
1. Great for beginners
2. Debugging tools
3. Syntax highlighting
4. Easy git interface
5. Built with Rmw/Rmd in mind
6. Shiny is set up just like Rstudio

Cons
1. Doesn't allow you to move panes outside of the gui (stinks if you have multiple screens)
2. The niceties come at the cost of speed

Note Pad ++ is a general editor
1. Easy to install and set up
2. Works out of the box
3. Syntax Highlighting
4. Customization (lots of features)

For my needs (mostly work in R and do some html/css work) and skill level (not a trained programmer) this setup is pretty nice.

Dason

Re: [TS EDITOR WARS] General thread for recommendations, discussion and tips on edito

Cons

1. It forces code indentation
That's a con in your book?

Lazar

Phineas Packard
Re: [TS EDITOR WARS] General thread for recommendations, discussion and tips on edito

I have started using emacs (terminal as that is all I have access to for the scientific computing cluster at my uni). I am liking it and see the potential but it is somewhat of a learning curve. For example I am still struggling with the shortcuts for regexp search and replace. If anyone can suggest some resources I would really appreciate it.

trinker

ggplot2orBust
Re: [TS EDITOR WARS] General thread for recommendations, discussion and tips on edito

Dason said:
trinker said:
It forces code indentation
That's a con in your book?
Yes. Forces is the key word here. I think this should be optional, if it were I'd consider it a pro. I hate this though. I know most like it and for them it's nice. I hate auto completion stuff for brackets, quotes, and auto indenting. Just a personal preference so when it auto indents and I can't turn this off I don't like it.

Dason

Re: [TS EDITOR WARS] General thread for recommendations, discussion and tips on edito

Hmm. Well I've seen the way that you used to indent your code so I'm glad it indents for you

I'm not always a fan of the autocompletion of brackets and quotes but you can turn that off easily enough.

But I honestly can't think of a time when the indenting wouldn't be a good thing. Most beginning programmers are TERRIBLE at indenting code. Any good editor will do the indenting for you. Sure it would be nice if you could turn it off but I really don't see a case when you should.

trinker

ggplot2orBust
Re: [TS EDITOR WARS] General thread for recommendations, discussion and tips on edito

My biggest problem is they show up as tab in some editors rather than spaces.

Dason

Re: [TS EDITOR WARS] General thread for recommendations, discussion and tips on edito

Then set the option to replace tabs with spaces.

trinker

ggplot2orBust
Re: [TS EDITOR WARS] General thread for recommendations, discussion and tips on edito

I also hate:

Code:
x <- c(44, 44, 44, 44, 44, 44, 44, 44, 44, 44
)
Rather than:

Code:
x <- c(44, 44, 44, 44, 44, 44, 44, 44, 44, 44
)

Dason

Re: [TS EDITOR WARS] General thread for recommendations, discussion and tips on edito

I'm not sure what you're getting at but both of those look crappy to me.

bryangoodrich

Probably A Mammal
Re: [TS EDITOR WARS] General thread for recommendations, discussion and tips on edito

LOL I agree, WTF are you trying to do with those examples?!

Anything like these would not be terrible (to me)

Code:
x <- c(44, 44, 44, 44,
44, 44, 44, 44,
44, 44)

x <- c(44, 44, 44, 44,
44, 44, 44, 44,
44, 44
)

x <-
c(44, 44, 44, 44,
44, 44, 44, 44,
44, 44)

x <- c(
44, 44, 44, 44,
44, 44, 44, 44,
44, 44
)

spunky

Can't make spagetti
Re: [TS EDITOR WARS] General thread for recommendations, discussion and tips on edito

i don't know what you guys are missing...

JUST LOOK AT THIS! THIS IS HORRIBLE!
I also hate:

Code:
x <- c(44, 44, 44, 44, 44, 44, 44, 44, 44, 44
)
this is just *so* much prettier...

Rather than:

Code:
x <- c(44, 44, 44, 44, 44, 44, 44, 44, 44, 44
)

trinker

ggplot2orBust
Re: [TS EDITOR WARS] General thread for recommendations, discussion and tips on edito

For a bunch of mathematicians you sure have a difficult time counting.

The point was I believe that in this case the indent should be 4 spaces, that's 1, 2, 3, 4 (use fingers if needed). However, RStudio uses 8ish spaces. IMO this is crap. Again you can come back with blah blah blah but the number of spaces on an indent is up to debate. It seems extremely wasteful to indent this 8 spaces, particularly if you are already indented some spaces. It means more frequent wrapping, which to me is less readable. My demo was to show how RStudio handles breaking a vector in a minimal way. In reality I wouldn't have broken this vector.

I suppose overestimated your powers of deduction or counting. My 2 1/2 year old could have explained the difference between the two though.

@BG I don't like any of your examples. I prefer:

Code:
x <- c(
44, 44, 44, 44,
44, 44, 44, 44,
44, 44
)
Or...

Code:
x <- c(44, 44, 44, 44,
44, 44, 44, 44,
44, 44)

TheEcologist

Global Moderator
Re: [TS EDITOR WARS] General thread for recommendations, discussion and tips on edito

This is the standard ESS indention.

Code:
x <- c(
44, 44, 44, 44,
44, 44, 44, 44,
44, 44
)
I am completely happy with it.

R's pager formats it like this
Code:
x <- c(44, 44, 44, 44, 44, 44, 44, 44, 44, 44)
Which is also fine

Dason

Re: [TS EDITOR WARS] General thread for recommendations, discussion and tips on edito

For a bunch of mathematicians you sure have a difficult time counting.

The point was I believe that in this case the indent should be 4 spaces, that's 1, 2, 3, 4 (use fingers if needed). However, RStudio uses 8ish spaces. IMO this is crap. Again you can come back with blah blah blah but the number of spaces on an indent is up to debate. It seems extremely wasteful to indent this 8 spaces, particularly if you are already indented some spaces. It means more frequent wrapping, which to me is less readable. My demo was to show how RStudio handles breaking a vector in a minimal way. In reality I wouldn't have broken this vector.
If you're just putting the closing paren on a new line then the purpose should be so that it looks good to you - why would you just choose an arbitrary number of spaces to indent a single closing paren?

I still don't quite get what you're complaining about though. You can configure the number of spaces an indent equals. You can configure whether the brackets will vertically align or not. You're basically complaining about features that RStudio actually has but you haven't bothered to set?

noetsi

No cake for spunky
Re: [TS EDITOR WARS] General thread for recommendations, discussion and tips on edito

I also hate:

Code:
x <- c(44, 44, 44, 44, 44, 44, 44, 44, 44, 44
)
Rather than:

Code:
x <- c(44, 44, 44, 44, 44, 44, 44, 44, 44, 44
)
I am sure I am missing a joke, but those look identical to me.... Spacing does not matter for any code I know...