Sublime Forum

General Questions

#1

I’ve been using Sublime Text 2 for a couple of weeks now, and I’m considering making the switch from SciTE permanent but had a few problems/questions :

(1) There are a few problems with the syntax highlighting for C++, namely comments are not always highlighted correctly and a number of keywords (namespace, private, protected and public) are not always highlighted (at least with the Sunburst theme).

I’ve fixed the latter problems to my satisfaction by modifying the C++.tmLanguage file (attached). I don’t really understand the tmLanguage parsing well enough to fix the former, but it seems that the function highlighting captures everything up to the opening brace and therefore doesn’t apply a lot of other highlighting - however, in C++ it’s very common to have initialiser lists between the header and the body of a function in constructors so this can be problematic.

(2) I’m storing most of my custom settings in the Packages/User directory, which I’ve symlinked to Dropbox to keep everything in sync (I’m not entirely sure how I’m going to achieve the same thing on Windows, but I’ll cross that bridge when it comes to it). I’m curious as to if anyone else has a “Better Way”, in particular it means things like modifications to C++.tmLanguage won’t get synced (incidentally my first attempt linked the entire Packages directory but there seemed to be an incompatibility that messed up the interface under OSX). It also means that custom snippets appear in the User menu rather than their particular language menu.

(3) I realise that the spell checking functionality isn’t fulling integrated yet, but is it possible to control the word separators (’/’ doesn’t seem to be treated as a word separator) and is there some kind of user dictionary for all my favourite non-words? Obviously the latter could be achieved just by editing the source dictionary - but that seems like overkill somehow.

(4) The initial window size is horrible (under Ubuntu 10.04 at least)… what’s the easiest way to fix that? Ideally in terms of rows/columns of visible text verses brute force pixel size.

(5) How are conflicts in the syntax filename patterns resolved? Sublime has a built in txt syntax mode, and I have a custom tmLanguage file in my User directory for CMakeLists.txt - but Sublime always seems to prefer the the more general txt match - it would be preferable if it took the best match (in terms of most characters matched I guess) rather than, as it appears to, the first one it comes across.

(6) Is there a way to get Sublime to reload its settings without restarting? At the moment tweaking language definitions and configuration options is quite cumbersome because I have to restart to check the effects.

(7) For me, Ctrl+F, F3 appears to search backwards whilst Shift+F3 searches forwards (the Find and Find Prev buttons also appear to be reversed). I have not rebound any keys. I have no idea how I have managed this.

Any advice would be greatly appreciated!
C++.tmLanguage.zip (2.07 KB)

0 Likes

#2

It may be worth trying to sync the entire Packages dir again: it’s something that should be working ok.

I’ll put a fix in the next version so that it prefers full name matches over extension matches, as it should be.

Changes to .tmLanguage files never get reloaded on the fly yet, unfortunately. Other configuration files should be reloaded immediately, but I’ve had reports they may not be if there are symlinks involved.

There’s a ‘Reverse Direction’ button on the find panel you can click on revert this.

0 Likes

#3

Thanks for that, when I get a chance I’ll try syncing the entire packages directory again. Previously the background of the tab bar would gradually fill with red (as though it wasn’t being erased properly and new layers of transparency were being drawn on top). If I still have a problem I’ll try to track down the exact cause for you.

0 Likes