Code editors with modal syntax highlighting - editor

Do any of the code editors, IDEs, etc, offer many different modes of syntax highlighting to be switched on briefly during refactoring missions to make certain identifiers or sentences really stand out to aid refactoring or just aid moving bits of code around for readability?

I am unaware of any editor that does this by default, but it is certainly possible to add modes to, say, emacs, specifically for this purpose.

Related

What is a powerful, lightweight text editor with intuitive GUI/functionality?

To date in my programming career I've been using gedit for everything, but I am beginning to feel it isn't powerful enough.
However, I find that EMACS and VIM are too annoying because of the massive number of unintuitive keyboard shortcuts, and the inability to do simple things like click and drag to select things, ctrl+c, ctrl+v, etc. Also, any editor with different modes is really annoying to me.
On the other hand, gedit lacks a lot of the powerful things VIM and EMACS seem to be able to do. I have seen my coworkers do things like pop open a list of all files containing a certain regular expression to open, or compile and execute a selected block of code in a single stroke.
I've installed all the gedit plugins I can find, but it's hard to customize them to the extent I want to, and a lot of them just suck. For example, ctrl-alt-o for quick open seems to simply provide a short list of recently opened files. And the integrated command line plugin is pretty awful. The autocomplete plugin is decent, but it would be much better if it could show me a list of all the available methods of an object the way ipython does.
Is there an editor out there that functions more or less like normal text editors, but with the customizability and support you get from VIM/EMACS? Or is there a build for VIM/EMACS out there that feels like a normal editor without all the confusing modes or need for encyclopedic knowledge of keyboard shortcuts?
I mostly program in python, coffeescript, java, and am about to start using C++ a lot, plus I occasionally do things in other languages, so functionality across multiple languages is a must.
A coworker of mine likes Geany and he uses it for C and Javascript development. I don't know anything about except that it's more powerful than Gedit, but doesn't have the same feel as VIM/EMACS.
You can also try behave mswin in VIM: https://superuser.com/questions/10588/how-to-make-cut-copy-paste-in-gvim-on-ubuntu-work-with-ctrlx-ctrlc-ctrlv. I don't like it, but another coworker does. It changes the whole feel of VIM, which might be what you want.
I would just recommend picking a more powerful editor and get used to it. VIM/EMACS are good editors, but trying to make them behave other than they were designed may cause problems down the line (especially when looking for help).
I would really recommend taking the time to learn something like Vim. You might find it easier than you think.
Cream is a version of Vim modified to have an easier user interface.
http://cream.sourceforge.net/

How to make VS2008 auto insert indent for F#?

Just as my title . I want my VS to auto indent for me like in VBNET . Please help.
As far as I know, the F# language integration doesn't support this feature.
Also, automatic formatting is not as useful in F# as it is in Visual Basic. In VB, the formatting is not really important (so you can write code with crazy indentation and the formatter can fix it). In F#, the indenation (partly) determines what code means, so you need to write correctly indented code (although I agree that the automatic formatting could make the code more consistent).
In principle it should be possible to implement this feature as a Visual Studio plugin using the open source release of F#. There is a similar plugin that adds colors for nested expressions by Brian, so that could be used as an inspiration, but it's definitely not something I could write in the answer box :-).
Sadly, the indentation-sensitive syntax that F# inherited from languages like Haskell makes it impossible to auto-indent. This is actually my only major gripe with the F# language because, in addition to making it impossible to implement professional tools like auto-indenters, it renders programs fragile in the absence of correct indentation which means an accidental change in whitespace can silently corrupt a program and cut-and-paste (e.g. from blogs) is prone to breaking or corrupting programs. F# almost always screws up if you feed it OCaml code, partly because it cannot handle tabs.
The damn crying shame is that OCaml already got this right by providing a concise unambiguous syntax and powerful tools. For example, you can autoindent any definition by pressing ALT+Q in Emacs. This makes it much easier to manipulate OCaml code and can be an enormous time saver. I often find myself trawling through F# code trying to reindent it by hand, having to read the code in detail and understand the algorithm just to indent it is seriously frustrating. Having done this many times, I can also state quite confidently that the verbosity savings of the #light syntax are insignificant. In fact, F# is almost always more verbose than OCaml in practice.
I prefer to pour cold water all over this question. In principle, it's impossible to provide an auto-formatter for a whitespace-significant language.
(Pragmatically, you could add a few small niceties to the editor, e.g. if you type a line of code that starts with if and ends with the matching then and press enter, the editor could get smart and also insert the next indent so you don't also have to press tab. But this is a far cry from auto-formatting, which I think would be wrong-headed to even attempt.)

WYSIWYG vs WYSIWYM

Which one is better and ideal in a web based application?
Edit:
Actually I am developing a community site. So the level of users may vary. Heard about XSS security issues with WYSIWYG editors. Also I am not familiar with WYSIWYM editors and its features. As far as I know the features in WYSIWYM editor is less compared to the other one. I figured one named as "WMD: The Wysiwym Markdown Editor". Its quite easy to use.
So security and ease of usability should be there. In such a situation which editor will be better.
If your users can handle WYSIWYM, I'd go with that.
I'm considering your system will be visual, that is, if you say something is a title it'll look like a title (otherwise the WYS part wouldn't apply). If the user has to manually type markup, then only the most savvy or technical users will be able to handle it.
What I've seen with most users is that they have trouble giving meaning to what they want in a document. They don't think "this is a title", they think "this should be bigger and bold". People that cannot think "this is a title" can't handle a WYSIWYM or they'll find it hard.
Who is going to be your user base? If it's people writing academic papers I'd go with WYSIWYM because they'll have no trouble handling it. If it's for house wives writing recipes, they may not be able to handle it or they'll find it so hard that they'll decide it's not worth the effort.
For me the ideal is WYSIWYM, but do it only if you think your target users will be able to handle it, otherwise you'll have to go with WYSIWYG.
I personally love the WYSIWYM mechanism. I use it for my own work as much as possible. I like it so much that I try to get others to try it too.
Boy, that goes over like a fart in a space-suit.
My cynical self assumes this to mean that most folks are ruined by tools like Word. Everyone knows to make a meaningful document. They also know what a meaningful document looks like. If it doesn't look like that, the tool is wrong! What's actually happening is these document producers don't actually know what they mean, and are used to hiding that fact with pretty borders and adjusting tab-stops.
What I really think is happening, though, is that these folks who are resistant to WYSIWYM are that way because it's a harder way of thinking about something they already invested in learning. This is a level of abstraction above WYSIWYG, though not quite as far removed as composing documents in markup like LaTeX or HTML. And since they can already create any sort of document in a tool that requires no abstraction, it's just a hard sell.
That being said, I think you should force WYSIWYM on your users if that is feasable. There are some good reasons for this
All of the benefits that naturally come with two stage composition. Formatting is not decidable until the document is composed, so any time spent before the document is finished on formatting is time wasted. Get it composed quickly.
The document is marked up with semantic information. This can be used in searches, or for other tasks that strictly visual markup cannot. This is especially useful for accessibility.
By depriving your users of arbitrary formatting decisions, all of your documents will follow company branding. Everything will be in a standard font and color. All text will use the same spacing and height. It will look to readers like it came from a single entity.
Check this
http://www.wymeditor.org/
Could you be a bit more specific? What kind of web application? How many users? Who will the users be?
In general though I've had quite of bit of experience implementing WYSIWYG editors for various CMSs and found them to be quite problematic because clients often like to go wild with formatting their content repeatedly over and over again and often end up having the editor generate HTML of poor quality. This causes all sorts of layout issues or simply pages that look really messy because everyone likes to fancy themselves as graphic designers.
If done properly WYSIWYG can work very well, but it is more work to really get it right, especially when taking into consideration CSS. Most of the good editors are nicely configurable and allow to specify just how much control to give the client over visual formatting.
As for the quality of the code they generate, tools such as FCKEditor and TinyMCE are very mature and do a good job of editing out the irrelevant crud in the source code, but be prepared to provide support for clients using a WYSIWYG when their content doesn't look the way they would like it to.
Since WYSIWYM editors are much like WYSIWYG with structural formatting instead of visual formatting, philosophically I think they are better and less problem prone. So if the client doesn't have a need to visually format the content I think WYSIWYM is bound to cause less headaches down the road.
The editor used here in Stack Overflow is a good example of restrained WYSIWYG. You can format the content visually but only to a certain extent.
If your users a tech savy and understand how the basics of markup go and you think they will feel more empowered using WYSIWYM, then use that. If your application is going to be used to people who have little technical knowledge, use WYSIWYG.
Unless you are doing a tool for print layout (i.e. Indesign or maybe a mailing list printing tool) you are probably better to stick with WYSIWYM.
It is likely to be easier to implement
Web browsers are highly configurable and you may not have fine grained control over items like font size.
The structure is explicit so rendering to different media is comparatively easy.
It avoids the temptation on the part of users to over-design the document or whatever they are entering.
Document structure facilitates indexing, table-of-contents generation and cross-referencing where this is relevant. Compare (for example) maintianing a large index in Word with doing in LaTeX or Framemaker.
Anecdotal experience from LaTeX users (in particular) suggests that organising a document by structure is likely to produce a better document.
From my experience with MYSIWYM, I was very seduced by the idea and the looks, but I was then deceived to know that the editor didn't give me a simple and efficient way to restrict the user, for example the user can insert images inside paragraphs... and I don't want that... I want more control over what the user can do.

Freeware "Structural Highlighting" for Delphi 2007 IDE

I'm in the middle of sorting out a nested set of if/then begin/end pairs, and missing the heck out of CodeRush's structural highlighting (which I used to have in Delphi 6, and loved). Is there a freeware IDE add-in out there that will accomplish the same for Delphi 2007?
Note: I know Castalia does this as well. I tried Castalia a while back, and had trouble w/its stability; also don't really feel like spending $99 at the meoment for just this one feature, (plus maybe the split-editor feature). I may anyway, but thought I'd ask here first to see if there are cheaper alternatives.
Thanks in advance.
cnPack has a feature like this (draws a tree showing the structure)
Step 1: edit the code to simply visually align the nested blocks according to good practice, with consistent indenting etc.
You might be able to use a "pretty printer" to assist in this one-off activity. There are lots of these out there (including one built in to Delphi 2010 these days, as of Delphi 2010, which is no use to you I imagine). I don't know how many of them work on code snippets, rather than relying on complete units however.
Step 2: if the number and level of nested blocks is such that it remains confusing and unclear, refactor to reduce the number and level of nesting.
The result: code that is readable in any medium, without needing to lean on IDE confections which won't always be available to you (e.g. if using SVN and viewing diffs via WebSVN or some other collaborative code review process that doesn't use an IDE with lots of bells and whistles installed).
GExpert is my favorite addin for Delphi. It is free, mature and I use it every day.
Some highlights:
VERY fast search in source. This is so valuable for me.
Convenient find function dialog by typing some characters en the name.
Match parantheses, begin/end, and some other types.
Everything can be handled by a shortcut.
Many other things that I don't use so much at the moment.

Latex styles - what do you use and where to find them

What Latex styles do you use and where do you find them?
The reason I'm asking this is that it seems that some 99.9999% of all styles on the internet are copies of each other and of a physics exam paper
However, when you try to find a style for a paper like this one... Good luck, you are never going to find it.
Creating your own style is often not really an option, because it requires you to dig quite deep into the very advanced features of TeX/LaTeX and fighting your way against possible incompatibilities with document classes/packages/whatnot.
LaTeX was originally designed as a reasonably flexible system on which a few standard classes were distributed — that were themselves rather inflexible.
In the current state of affairs, if you want a custom layout, you need to write a few amount of supporting code yourself. How else would it happen? It's not like HTML+CSS gives you templates to work with; you need to implement the design yourself.
Creating your own style is often not really an option
Ah, well, not unless you know how to program in LaTeX!
Seriously, it all depends on knowing where to start and what to build on top of. That catalogue you give as an example would, in my opinion, be reasonably easy to do in LaTeX; it's just a bunch of boxes.
You could write something like
\newcommand\catalogueEntry[4]{%
\parbox[t]{0.23\linewidth}{\textbf{#1}}%
\hfill
\parbox[t]{0.23\linewidth}{\includegraphics{#2}}%
\hfill
\parbox[t]{0.23\linewidth}{\textbf{Characteristics}\\ #3}%
\hfill
\parbox[t]{0.23\linewidth}{\textbf{Application}\\ #4}
}
and use it as so
\catalogueEntry{Spotlights}{spotlight.jpg}
{Eclipse spotlights are...}
{Narrow to medium...}
This is just a basic illustration of what could be knocked up quickly — much more sophistication could be used to turn this into a more flexible system.
I see LaTeX as an extensible markup system. If you separate your markup from its presentation on the page, it's not too hard to get your information represented in whichever form you wish. But getting started is a little tricky, I have to admit; the learning curve for LaTeX programming can be rather steep.
Memoir is a more flexible document class than the default ones, and its manual is excellent.
Well I think CTAN is the best resource for LaTeX and TeX-related stuff. Also lots of scientific organizations provide their own styles, it makes sense to try tracing who was the author/publisher of the paper you like and check their websites.

Resources