|
Programming C, bash, Python, Perl, PHP, Java, you name it. |
|
Thread Tools | Display Modes |
|
|
|||
Syntax Highlighting
Hello,
What is your take on syntax highlighting? I must admit, I find it a very useful feature - but not all editors support it.
__________________
And the WORD was made flesh, and dwelt among us. (John 1:14) |
|
|||
Quote:
I also use Vim and just pick a color scheme that provides decent highlighting without driving me insane. I find that I use different color schemes on different computers probably because of differences in monitors and lighting. |
|
|||
It seems many editors, particularly on Windows machines, make your editor look like a circus. I ran my code through an editor once and counted seven different colors including hot pink. Too often, code words are highlighted because they can but it serves no purpose.
I can see where highlighting of certain significant keywords can be helpful, but I'm not entirely convinced of this either. I frequently find highlighting just grabbing my attention while scanning and distracting me. In typography, highlighting is used just for that. To grab your attention so you don't miss something. Do you want to do that while reading through the logic of your code? I always tell myself I'm going to experiment with this but haven't yet. I might like highlighting when I'm searching for a keyword but not otherwise. I think some like colored highlighting because it seems to make the page more attractive to look at. I also think this is only a temporary effect which quickly wears off and, again, only causes distraction and confusion. |
|
||||
Quote:
|
|
||||
I suppose when it comes to text editing, decent editing keybindings/mappings (e.g. no need for a mouse) and syntax highlighting is probably about all I really ask for.
I think I agree with people in #vim, code should _not_ look like a Christmas tree !!! I like syntax highlighting because I spend a lot of time in text editors, which is probably why I like nvi and vim. The first time I tried creating a color scheme for Vim that took over my syntax highlighting.. I found the colours to distracting and chucked it. In Vim I use the 'astronaut' colo in a pseudo transparent terminal and find find it to have very good effects on syntax highlighting. Some keywords are underlined and coloured, keywords and some types of things coloured, strings colored differently + diff colour for %stu \ff and coloured comments. I loved astronaut so much for Perl and felt so at home with it for Python, that I created my own personal colour scheme based on it. I like syntax highlighting when it _helps_ me. If you really know how your syntax highlighting works, you can use it to quickly scan bits of information and differentiate parts of code quickly. One thing I do like is providing a highlight of some sort for {}. (), [], and when XML/SGML based stuff is around <tag></tag>. I've found syntax highlighting very helpful for Perl, PHP, LaTeX, and XHTML in particular. Especially if I forget a freaking sigil or start a string with ' or " and end it with the opposite one by mistake I can use the warning/error messages and the syntax highlighting to quickly locate the offending code. Now if only there was a way to make vim add missing ';'s on :w hehe.
__________________
My Journal Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''. |
|
|||
I "gave it a try" years ago, for years, so I don't need to do that. In geany, I tried setting some simple highlighting but I'm not sure what works best. I kind of like bold function names in dark blue but when I'm not searching for function names, they get in the way. Some of the posts here mention certain highlighting functions which aren't syntax highlighting but error checking. And as far as staring at monochrome all day, it's my preferred method and with no X.
|
|
|||
Hello,
Could you expound on some alternatives then for said error checking?
__________________
And the WORD was made flesh, and dwelt among us. (John 1:14) |
|
||||
On a similar note, paren-highlighting is also a coder-friendly feature, especially when you've nested several levels of parens and brackets. It's one of the things I really enjoy about the language major modes in emacs. When your cursor is on a paren or you type in a paren, if it has a partner the cursor flashes on it briefly, or you get a status message indicating an unmatched paren. It saves a lot of counting =)
__________________
perl -e "eval pack(q{H*}, join q{},qw{7072696e74207061636b28717b482a7d2c717b34393 23036333631366532303666366536633739323036313733373 33735366436353230373936663735323036353738373036353 63337343635363432303734363836393733323037343666323 03632363532303631323036633639373437343663363532303 66436663732363532303635366537343635373237343631363 93665363936653637326530617d293b})" |
|
|||
Hello,
Some of the benefits of syntax highlighting (at least as in done in vim) are: If you mistype a keyword or forget a quote or semicolon, the coloring is all out of whack - no need to wait until compile time to realize a mistake is made. Brace matching allows you to easily if you have enough braces and to see logical deliminations of blocks of code. I have heard that staring at large chunks of plain code for hours on end - it all looks the same (I haven't spent hours at a time in front of plain code to know this first hand). ^^^ The second item could be easily lived without, but as to the other two - those who do not use syntax highlighting, could you please expound on why plain code is superior to syntax highlighting or where syntax highlighting falls short of desired results.
__________________
And the WORD was made flesh, and dwelt among us. (John 1:14) |
|
|||
Hello,
Most vi clones (i.e., vim) have developed syntax highlighting as part of their editor. Is there anyway to incorporate syntax highlighting with (n)vi?
__________________
And the WORD was made flesh, and dwelt among us. (John 1:14) |
|
|||
Your thread is about syntax highlighting, not error highlighting.
|
|
||||
Quote:
If missing an ending " makes the rest of my file highlight as a string until I type the ending quote, I ain't got a problem that feature. I consider it just a part of selectively changing text colours (highlighting) based on syntax ;-)
__________________
My Journal Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''. |
|
||||
I find syntax highlighting very useful, not only does it let you scan text much faster, it also lets easily detect simple errors (like a missing */).
I use Vim's default color scheme, it works well, although I do recommend enabled 256 colors, it offers just that extra little bit of extra contrast over the default 16 colors ... See: http://vim.wikia.com/wiki/256_colors_in_vim
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things. |
|
||||
It's been mentioned twice that it helps with PERL... and I would completely agree with that... perhaps a junky color scheme might be distracting, but one that is contrasting enough but that also isn't offensive seems to be the most useful for me concerning PERL scripting.
__________________
Network Firefighter |
|
|||
I don't think there's anything that irritates me more than syntax highlighting.
I'm not 100% sure why i don't like it but i think i focus more on the colours than the actual code. Drives me nuts logging into a *nix machine where i can't navigate around the fs or edit a file without getting a rainbow appearing in my terminal window hehe
__________________
"No, that's wrong, Cartman. But don't worry, there are no stupid answers, just stupid people." -- Mr. Garrison Forum Netiquette |
|
|||
My point exactly, corey, but I wonder if it's a matter of personal preference or not really noticing the difference.
|
Tags |
vim |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
perl expression syntax | qsecofr | Programming | 3 | 16th February 2009 12:56 PM |
C/C++ Syntax highlighting in emacs | rex | FreeBSD General | 1 | 12th October 2008 03:21 AM |
I need help with make.conf syntax | troberts | FreeBSD Ports and Packages | 4 | 1st June 2008 03:58 AM |
Vi type syntax applications | corey_james | Off-Topic | 9 | 28th May 2008 04:15 PM |
relayd (and hoststated) give syntax error for 'check script' | gwl | OpenBSD Security | 2 | 2nd May 2008 04:53 PM |