Syntax highlighting strongly varying from one color scheme to another - sublimetext2

I currently have lots of documentation to write in markdown and, therefore, I'd like my favorite editor to properly syntax-highlight it.
Problem is: the default color scheme of SublimeText (in my case, Monokai) doesn't seem to make a good use of colors with markdown. See by yourself.
That being, while searching for a solution, I found a comment on github mentioning other color schemes working way better for markdown: Cobalt, Dawn and Sunburst.
The thing is I'm pretty used to Monokai (never switched to another color scheme so far) and I'd like to avoid switching everytime I have to work with markdown.
Why does syntax highlight vary that much while I'm only using non-exotic themes ?
More important: what can I do ?

It's slightly annoying, but you can customize the existing color scheme. You simply need to determine the scopes for certain blocks of code, then create a color "binding" for that. I'd recommend copying the contents of the Monokai color scheme out and saving it in Packages/User. That way, you aren't messing up the built in one if you accidentally mess things up beyond repair. This also makes it easy to move the color scheme between machines (if that applies to you).
To determine scope, I'd recommend using ScopeHunter. There is built in functionality also, but I like ScopeHunter better (but that's a personal preference). To find the default key bindings, search for the command "show_scope_name`. You can look at the entries already there for an example of how to set up colors, though if you need some additional clarification, please comment as such. Oh and if you would rather work in JSON instead of XML, you might also want to take a look at PlistJsonConverter
As an alternative, you can try to find someone who has already made the appropriate modifications to the color scheme file.

Related

Vim plugs to work with custom HTML tags and SCSS

My Vim level is about intermediate - I've been using it about 10 years, but on "newbie" level - find file, delete something, add something, save and quit.
Now I decided to make Vim my only code editor.
I'm working with Ionic framework (it's Angular + SCSS) and I have a question about some useful things:
Is there a way to add all non-standard HTML tag to Syntastic? It's highlights all of Ionic tags, such as <ion-list>, <ion-button>, <ion-radio> and so on. If my google skills are good enough, there's no full Ionic plugin, which will add snippets, syntastic checkers and so on.
Is there a way to find and add classes from HTML to SCSS and from SCSS to HTML? I mean, if I'll write .my-very-important-class in SCSS file and then go to HTML file (which is in the same directory with same name and differs by .html or .scss) and in class="" attribute start to input "my" I'll get autocomplete suggest for this class. Is it real to make or maybe someone did already?
There is also main file for theming an app, called variables.scss. I need this file to be scanned and match colors (in this file there is an color section, where I can put all colors, I'll need in app, and in .scss file of any page I can get color I need with just color: color($colors, colorname) where colorname is the name of color variable. It's awesome feature, except no color highlighting in code. So it would be great to get color mappings and then highlighting with correct color in .scss file of page.
I didn't found any plugins for this. If there some existing plugins I've missed - I'll be happy to try it. If it's no - I will be glad to made one myself (if it's not very hard). Anyway, I think this are useful things not just for me.
UPD: #1 was fixed - I'm not sure, how exactly, but now it's fine in HTML and I have no errors or warnings from syntastic about wrong tags. I'm feeling newbie, but seems like I forgot to install Vim-ionic2 plugin - just added it to my .vimrc.
And #2 seems to be answered - does what I need.
Syntastic is a frontend to several linters. Find the linter used by Syntastic and look for a way to make it accept those custom tags.
If you have the CSS file opened, <C-n> should let you complete the CSS class.
You might need something like set iskeyword+=- for Vim to complete the whole class name.
I think this would be totally useless. That said, if you didn't find such a thing… write it.
respect to the first point I'll say that vim for itself doesn't highlights all the HTML elements (main, header,etc) because the default html.vim file is a little outdated. However, I've just created a repository in which I added all the remaining elements to be highlighted.
If you encounter that something in the language you're working on doesn't get highlighted you should create a .vim file adding the keywords you want to be highlighted. I share you the repository I've talked about: github repo
It'll be nice that people can contribute so we don't have to create repeated vim files.
You can read more about syntax here: vimdocumentation
First off, I'd really recommend you split this into three separate questions. I feel like they could easily have dedicated answers that are not really connected. And someone might have a good suggestion for one of them, but not for the others. On my side, I can give you suggestions about 2) and 3) only.
For 2), you could use romainl's suggestion for completing keywords. You could also try generating tags for your CSS files using ctags. Here's one possible way to do it: https://github.com/rstacruz/ctags-css. Once you have the tags, you could use tag completion. See :help ins-completion, in particular the "tags" section. It would be a pretty good idea to read up the entire section, though, to get an overview of what's possible.
For 3), there's plugins around for this. Try this one: https://github.com/lilydjwg/colorizer

sublime text 2 list of xml tags for themes

Where can I find a list of all available xml tags to build a color theme?
ie.
<key>findHighlight</key>
<string>#FFE792</string>
where is a list for all of the tags such as findHighlight, findHighlightForeground, etc ...
I can't find it on the sublime site.
Thank you
The best way to learn how to construct themes is to take apart existing ones - that's how I learned. I have yet to find a comprehensive resource on theming in Sublime Text and TextMate (which heavily influenced Jon Skinner, the author of ST). There are bits here and there with a few scopes, or a couple tips, so if someone else has found (or written) something I'd love to hear about it too.
And, a bit of blatant self-promotion - if you'd like a large collection of scopes from which to start designing your own, check out my Neon Color Scheme, also available via Package Control. It's goal is to make as many languages as possible look as good as possible, and to that end I've assembled as many unique scopes as I can get my hands on. Feel free to fork it on GitHub and play around with it; if you end up releasing something for the world to see just drop me a line so I can check it out!
Another tool I'd highly recommend is facelessuser's ScopeHunter plugin. It has a lot more functionality than the built-in scope-viewing options, and is invaluable if you're doing theming.
Finally, check out Color Highlighter and ColorPicker - the first highlights hex color codes (among other formats) in your file with that color, allowing you to see what you're working with, and the second pulls up your OS's color picker widget so you can choose a new one if you want.

In MediaWiki is there a way to force a group of pages to have a particular skin?

The reason I am keen to do this is that we have a wiki which works great, but I would like to store help pages for an internal application in the wiki and link to those pages direct from the app. Although we wouldn't have concerns with people seeing the non-article stuff (i.e. the help pages) when viewing the pages from the rest of the wiki, for it to be streamlined when viewed from the application I thought it would be ideal if I gave it a simplified skin which I would design.
I have already found out that URLs can have the useskin= added (e.g. as is done in the Preview Skin page within the User Preferences pages), but following the links will revert you to your normal chosen skin.
Is there perhaps some way to adjust the skin, so that all the links contain useskin=? (I think this might have issues, since you appear to need the full pagename for useskin to work (e.g. ..../w/index.php?title=blah....&useskin=cologneblue as opposed to the short URLs).
If this isn't a smart way to go, I could consider different approaches (I run the box the wiki is on and could create a distinct wiki perhaps, although there might be disadvantages to this, such as needing to combine the user tables and maybe this would still pick up the user's preferred skin unless I re-coded things).
Any sensible suggestions gratefully received! Let me know if there's any more info you might need or if I need to clarify any points about my objective.
[I did submit this on the MediaWiki.org Support Desk page, but it got no response... I hope my question isn't that bad!!]
You could put all your content in its own namespace, then set the skin for that namespace using this extension (I've used it, it works well enough):
http://www.mediawiki.org/wiki/Extension:SkinPerNamespace
If you don't want to lock them all into a single namespace, you can also use the SkinPerPage extension to mark the pages individually.
Why not change the default skin to the skin you want?

track and display changes in html

I am looking for a tool to display/track changes in text a little bit like it is done on stackoverflow when a question is edited. Does anybody know of a tool to achieve that?
You may want to use diff for that.
If you can use PHP on your server there's a handy pear package to perform the task you require. Here's an example :
https://web.archive.org/web/1/http://articles.techrepublic%2ecom%2ecom/5100-10878_11-6174867.html
There's actually a actually Javascript implementations outhere as well, not tested though:
http://ejohn.org/projects/javascript-diff-algorithm/
http://aignes.net/
Commercial tool though. I have no idea of a F/OSS alternative.
A copy of my own answer from here.
What about DaisyDiff (Java and PHP vesions available).
Following features are really nice:
Works with badly formed HTML that can be found "in the wild".
The diffing is more specialized in HTML than XML tree differs. Changing part of a text node will not cause the entire node to be changed.
In addition to the default visual diff, HTML source can be diffed coherently.
Provides easy to understand descriptions of the changes.
The default GUI allows easy browsing of the modifications through keyboard shortcuts and links.

What is the best way of adding in regularly used blocks of code when marking up in TextMate?

Caveat: I'm relatively new to coding as well as TextMate, so apologies if there is an obvious answer I'm missing here.
I do a lot of HTML/CSS markup, there are certain patterns that I use a lot, for example, forms, navigation menus etc. What I would like is a way to store those patterns and insert them quickly when I need them.
Is there a way to do this using TextMate?
You can do this very easily in TextMate using Snippets. Just add a new snippet in the bundle editor, and set up how you want to trigger it. You can set a key shortcut, or have it pop up when you hit Tab after a certain word/pattern.
There are many things you can do with them—in your case, it would probably be very useful to set so-called "placeholders" in your snippets, which are the parts that change every time (e.g. the names of the fields in the form). Then, as soon as you insert the snippet, you can hit Tab to move between these.
Along with the links provided above, I think you'll find this screencast useful. It gives a run through of some of the tools TextMate's HTML bundle already provides.
It's probably slightly off-topic though, but worth a look nonetheless.
As mentioned prior snippets are what you are looking for.
For reference look here:
http://manual.macromates.com/en/snippets
http://screenflicker.com/mike/code/div-snippets/