Page 1 of 2

Which Editor for C Programs

Posted: Tue Apr 05, 2016 7:56 pm
by RDS
I am familiar with the IDLE screens for Programming in Python 2 or 3 but I would like to have a play around with the C Language.

I apologise for such a very basic question but which Editor is used for the C Language on the Pi.

Re: Which Editor for C Programs

Posted: Tue Apr 05, 2016 7:59 pm
by fruit-uk
Any text editor will do but you may find it easier with one that has highlighting schemas

Re: Which Editor for C Programs

Posted: Tue Apr 05, 2016 8:07 pm
by MarkHaysHarris777
RDS wrote:I apologize for such a very basic question but which Editor is used for the C Language on the Pi.
If you are genuinely serious about the question -- big if -- then you will learn vi (or vim). The reason for this answer is that its traditional (not just the PI) and it works across the network on any normal terminal.

You should learn vi because its a cultural piece of unix and a traditional piece of unix programming, um, C.

Having said that, folks around here (and in lots of publications too) use nano. It also works across the network, but not consistently in all terminals.

Most vi and nano based editors today have highlighting available and closures (like for braces and parens). But, like with most other things coke and pepsi, what do you like? Try them, learn them, and then choose one.

My choice is vi. Let me know what you choose.

Re: Which Editor for C Programs

Posted: Tue Apr 05, 2016 8:12 pm
by davenull
onboard C-Editor on the Pi?

why not use the Geany editor of the Geany IDE?
You can even compile then out of the editor, but its not a must of course.

Code: Select all

sudo apt-get install geany
parameters for compile and build:
make -> commands for make (compile and build)

Re: Which Editor for C Programs

Posted: Tue Apr 05, 2016 9:34 pm
by RDS
fruit-uk wrote:Any text editor will do but you may find it easier with one that has highlighting schemas
Thanks but do you have any suggestions.
Also, having edited the program, how do you run it.

On IDLE with Python, I just press F5.

Re: Which Editor for C Programs

Posted: Tue Apr 05, 2016 9:36 pm
by RDS
davenull wrote:onboard C-Editor on the Pi?

why not use the Geany editor of the Geany IDE?
You can even compile then out of the editor, but its not a must of course.
I think this may be the answer I am looking for.

Re: Which Editor for C Programs

Posted: Wed Apr 06, 2016 7:31 am
by davenull
yes, having read this:
when correctly configured in preferences, you may
compile (F8)
build (F9)
run (F5)
your program, out of the IDE

I wrote a short "Quick Guide" about this (because to my experience as a newbie it's almost impossible to find something out of the blue to make C/C++ things run on the Pi),
but although it's in German you perhaps might find it helpful!

http://www.mindstormsforum.de/viewtopic ... 769#p67771

edit,
In the TOP is an overview about the most important sub-topics:
http://www.mindstormsforum.de/viewtopic ... 769#p67768

share and enjoy!

Re: Which Editor for C Programs

Posted: Wed Apr 06, 2016 7:42 am
by RDS
@davenull
That is very helpful and as soon as I loaded the page, my computer translated it for me.
Danke.

Re: Which Editor for C Programs

Posted: Wed Apr 06, 2016 7:50 am
by davenull
Bitteschön, you're welcome! 8-)

(Hope Google Translate will work comprehensible though ;) )

Re: Which Editor for C Programs

Posted: Wed Apr 06, 2016 11:43 am
by jahboater
If you are running a GUI/X the "gedit" editor is great.
Full colour syntax display of course.
sudo apt-get install gedit.

Re: Which Editor for C Programs

Posted: Wed Apr 06, 2016 12:55 pm
by JRV
I used to use gedit but the new version of gedit that comes with jessie does not let you change the font, and in the font supplied all the characters are not the same width. I switched to geany and I love it.

Re: Which Editor for C Programs

Posted: Wed Apr 06, 2016 2:05 pm
by experix
I like nano, especially my personal version of it, but does anybody know how to avoid the annoying slow-down that it exhibits when displaying far down in a long file, with syntax highlighting turned on? I guess the problem is that every time it needs to re-write the screen, it starts at the top of the file in order to figure out whether the currently displayed location is inside a comment. Maybe something smarter could be done.

Re: Which Editor for C Programs

Posted: Sat Apr 09, 2016 12:25 am
by swampdog
'nano'

I've used 'vi' and 'emacs' in my time. Nano (-w) beats them all.

Re: Which Editor for C Programs

Posted: Mon Apr 11, 2016 2:05 pm
by topguy
swampdog wrote:'nano'

I've used 'vi' and 'emacs' in my time. Nano (-w) beats them all.
Then you have actually never used vi or emacs, you have just looked at them. ;)

Re: Which Editor for C Programs

Posted: Mon Apr 11, 2016 3:07 pm
by jamesh
Keep it sane people. Editor wars will not be accepted.

Re: Which Editor for C Programs

Posted: Mon Apr 11, 2016 5:38 pm
by jahboater
These editors are simply not comparable (apart from the basic fact that they are all text editors).

Nano is simple, usable directly, and great for beginners or people new to Linux.

Vi has an intense learning curve, is very powerful and fast when you know it. It is universally available. You can do far more work in far fewer key strokes in Vi (with its bi-modal paradigm) than you ever could with Nano.

Emacs is a complete development IDE all in one. If you can program in Lisp, it is supremely extensible.

All three are great editors!

Re: Which Editor for C Programs

Posted: Mon Apr 11, 2016 5:53 pm
by buja
jahboater wrote:...
All three are great editors!
No, no, no, it doesn't work that way!
You must choose one editor that you love and hate all others and curse their users. And you must defend your choice until death and most of all against better judgment, otherwise it's no fun at all :twisted:

Re: Which Editor for C Programs

Posted: Mon Apr 11, 2016 6:01 pm
by jahboater
buja wrote:
jahboater wrote:...
All three are great editors!
No, no, no, it doesn't work that way!
You must choose one editor that you love and hate all others and curse their users. And you must defend your choice until death and most of all against better judgement, otherwise it's no fun at all :twisted:
Actually I don't use any of them, I use an editor I wrote myself.
But you are right of course!

Re: Which Editor for C Programs

Posted: Mon Apr 11, 2016 6:13 pm
by buja
jahboater wrote:Actually I don't use any of them, I use an editor I wrote myself.
...
Respect :!:

Re: Which Editor for C Programs

Posted: Mon Apr 11, 2016 6:18 pm
by davenull
vi? nano? emacs? homebrewed?
:lol:

the OP is supposed to have already chosen the ultimate answer to C, Raspi, and everything!
:mrgreen:
RDS wrote:
davenull wrote:onboard C-Editor on the Pi?

why not use the Geany editor of the Geany IDE?
You can even compile then out of the editor, but its not a must of course.
I think this may be the answer I am looking for.

Re: Which Editor for C Programs

Posted: Mon Apr 11, 2016 6:43 pm
by jahboater
davenull wrote:vi? nano? emacs? homebrewed?
:lol:
As @buja pointed out, any topic entitled "Which is the best editor for ..." will immediately start an intense heated debate lasting forever (called an editor war). Its been true ever since the early days of usenet and probably before. This forum stands out for the decorum and patience shown by the participants!

Re: Which Editor for C Programs

Posted: Mon Apr 11, 2016 6:45 pm
by davenull
no way, no war, just funny :lol:

Re: Which Editor for C Programs

Posted: Mon Apr 11, 2016 6:55 pm
by hippy
jahboater wrote:Actually I don't use any of them, I use an editor I wrote myself.
I favour that route, then one can make it exactly how one wants it, add things which others never thought of and might not even like. It does require having the skills to create it and the time to do it.

The big question of course; which editor did you use to code your own editor :D

Re: Which Editor for C Programs

Posted: Mon Apr 11, 2016 7:05 pm
by davenull
Actually - apart of funny, entertainment, or flame war purposes - this discussion actually won't lead to anything any more, because, as I already statet:
davenull wrote:
the OP is supposed to have already chosen the ultimate answer to C, Raspi, and everything!
RDS wrote:
davenull wrote:onboard C-Editor on the Pi?

why not use the Geany editor of the Geany IDE?
You can even compile then out of the editor, but its not a must of course.
I think this may be the answer I am looking for.

Re: Which Editor for C Programs

Posted: Mon Apr 11, 2016 7:19 pm
by jahboater
hippy wrote:
jahboater wrote:Actually I don't use any of them, I use an editor I wrote myself.
I favour that route, then one can make it exactly how one wants it.
Exactly, and emacs is also popular for just that reason.
Once its basically working, you MUST use the editor itself, then you quickly find any bugs.
But in the first instance, the bootstrap, I'm not telling ... :-)