Sublime Forum

New to Sublime - A few questions

#1

Hi

Sorry to stick all these in one post, and also apologies if the answers are elsewhere. I started trying sublime last week - I’m quite impressed but I still haven’t decided it I want to purchase it. It seems a bit too difficult to get my head around things as I’m used to editors with more in the GUI, meaning I can just click to choose things. I guess that this is also the advantage of sublime in that it makes it more flexible - once you’ve spent a while working it all out.

I’ve so far spent about 2 days going through the feature (mainly fidding with ftp stuff). Here’s what I still can’t work out:

Things my current editor can do:

How do I add the syntax highlighting for other filetypes - eg, tell aspx files to behave the same as asp?
Get every file that I open to use the HTML syntax highlighting
Is it possible to create my own snippet where I could select a load of text, over multiple lines and tell it to add a

at the beginning and

at the end?
Version Control (this one is a real deal breaker). If someone edits the same file as me on a different computer, could it tell me that they’ve edited it and allow me to either accept their changes or to ignore? My current text editor gives me this option if I tab to another file and tab back or when I try to save the file.
Highlight if a closing tag isn’t correct (eg if there’s

rather than

)

Things I’d like to be able to do:

Can I refresh a browser on file save
I also had a question elsewhere about the .less textmate bundle https://forum.sublimetext.com/t/support-for-less-files/2325/1

Again - Many thanks for this! PS - how do I “watch these topics?”

0 Likes

#2

For browser refresh check out http://livereload.com/

0 Likes

#3

[quote=“matsaukeo”]How do I add the syntax highlighting for other filetypes - eg, tell aspx files to behave the same as asp?
Get every file that I open to use the HTML syntax highlighting
Is it possible to create my own snippet where I could select a load of text, over multiple lines and tell it to add a

at the beginning and

at the end?
Version Control (this one is a real deal breaker). If someone edits the same file as me on a different computer, could it tell me that they’ve edited it and allow me to either accept their changes or to ignore? My current text editor gives me this option if I tab to another file and tab back or when I try to save the file.
Highlight if a closing tag isn’t correct (eg if there’s

rather than

)[/quote]
  1. Look in the asp folder for .tmLanguage files. There will be a fileTypes key. Add aspx as a value.
  2. Don’t know of a way by default, cmd+shift+p then “syn html” will let you set it manually
  3. ctrl+shift+t
  4. Possible with a plugin, don’t know if any actually do it
  5. Don’t know of a setting for mismatched tags, but flagging

    is sort of weird since that is actually valid html. I have the editor set up to auto close tags so I avoid the problem for my own markup.

0 Likes

#4

Thanks for the replies. Would LOVE to use livereload but I’m on a PC.Apart from Xrefresh (which I always found a bit buggy and i think they’ve stopped updating) I don’t know of any equivelent. Also I work on remote servers mostingly which makes it a bit more complicated.

[quote]1. Look in the asp folder for .tmLanguage files. There will be a fileTypes key. Add aspx as a value.
2. Don’t know of a way by default, cmd+shift+p then “syn html” will let you set it manually
2. ctrl+shift+t
3. Possible with a plugin, don’t know if any actually do it
4. Don’t know of a setting for mismatched tags, but flagging

is sort of weird since that is actually valid html. I have the editor set up to auto close tags so I avoid the problem for my own markup.[/quote]

1 - Wasn’t too sure where to add the key so I copied to asp files and I think it works. I think…
2- Hmmm that could get annoying. I open lots of aspx files but really I need the html syntax highlighting. I also notice that if I open using asp syntax and use the spell checker it tries to check the tags too!
2 - This doesn’t seem to do anything.
3 - Would be very interested to know if anyone else knows of a plugin. For me, I can’t use sublime without this feature. Too dangerous!
4 - you’re right. although my other editor would flag that up. I guess its must assume a strict doctype. This is a very useful feature.

Thanks again for the replies. I’m starting to think this just isn’t for me which is a shame as I’ve started to get used to it! I just can’t find an editor that does everything I need on a PC. there are a few Mac ones but that’s not an option.

Cheers

0 Likes

#5

It’s been a while since I posted this so I was wondering if any of these had been added since last October (2011)

These are all easy to do in my current editor but I’d still like to use sublime as it just looks so much prettier!! I’ll try and explain them a little better as last time it got a little confusing:

  1. Syntax highlighting for other file types (this was resolved) but would like to be able to tell Sublime to use the HTML highlighting for every .net file automatically
  2. Select a load of text, over multiple lines and tell it to add a

    at the beginning and

    at the end - I think this was resolved to but its not that important to me
  3. This is the real deal breaker for me - some kind of version control - so if someone opens the same file and saves it, when I press save I get the option to accept the changes or save my own changes.
  4. Flag up mis-matched html tags. Eg if a Div hasn’t been closed or a is finished by a etc

    Much appreciated!

0 Likes

#6

#2 is indeed resolved. I have it mapped to Shift+Alt+w (I don’t recall if that’s the default) It even defaults to

I’m not sure I understand the use case of #3. Are you both working on the same file in file system (ie using some network storage or network mounted file system)? Or does your editor have integrated source control?

If it’s the former, Sublime automatically applies new changes. I don’t know if there’s a way to modify this behavior so that it prompts instead. If it’s the latter, I’d like to know what editor your using so I can avoid it. The way you describe the process sounds dangerous to me. It sound to me like your editor is: 1. automagically committing all saved files to a central repo, or 2. automagically updating your local copy every time you save. The second is better than the first, but would be annoying to me. I would hate to have to deal with merge artifacts every time I saved my local copy of a file. With the first, well there’s a reason why we have revision control and working directories. I save frequently (a habit I gained in college. Losing 4 hours worth of work to a power outage drilled that one into me), and often the code I save isn’t in a working state, and definitely isn’t ready for consumption in any form. Some form of version control integration would be desirable, but I wouldn’t want to see it work the way you describe.

For #4, sublime sort of handles this. It’s more by omission than actual highlighting. By default, using any of the HTML syntax highlighting, Sublime underlines matching tags. If the tag under the cursor doesn’t have a match, it doesn’t get underlined. I don’t think that quite does what you’re asking for, because I think you’d like the ability for it to highlight any tag that doesn’t have a match, regardless of where the cursor is at.

Also, there’s one thing that annoys me about the current tag matching. It doesn’t work in vintage insert mode when the cursor is immediately after the closing > on a tag, but if I go to the next line prior to any text, it underlines the matching surrounding tags.

0 Likes

#7

I’m using Blumentals “web builder”. blumentals.net/webuilder/

The version control suits our environment. We all work in the same office next to each other so its just a simple check to make sure that someone else isn’t working on the same file. We don’t need extra software or have to check files out to use them etc. The process works like this:

Save a file, if someone else has edited it you get a warning. We then just ask what each other did and decide which changes to keep. The other person still sees their changes so could always copy the lines they wrote, tab away, tab back, choose to take the other person’s changes from the prompt and paste their changes in. That makes it sound much more complicated than it is! - Its just like if two people on a network opened the same excel or word document really.

We also save files every minute or so, so you soon know if someone else has a file open. We do most of our work live on a server even on live sites unless we are doing major work where we’d use a different server. This works well for us.

I’d still like to use Sublime, as I’m sure that some of the plugins would be useful and I’m hoping for features like .less integration in the future. Plus you can’t change the colours on Webbuilder and I’d like to use something a bit darker to help my eyes after 12 hours of coding!

The mis-matched tags in Webbuilder is great as you can open up a file and immediately see any problems.

0 Likes

#8

Regarding #1, if View -> Syntax -> Open all with current extenion as … doesn’t work for you, you can try DetectSyntax [1] (or do something like it).

[1] github.com/phillipkoebbe/DetectSyntax (available in Package Control)

0 Likes

#9

For text wrapping, it’s all fine and dandy to have hot keys to wrap the text - but please please check out multiple selections (see my signature below). It’s a killer feature. :smile:

0 Likes

#10

[quote=“matsaukeo”]
I’d still like to use Sublime, as I’m sure that some of the plugins would be useful and I’m hoping for features like .less integration in the future. [/quote]

This is my Less.sublime-build but you’ll need to install nodejs, npm install less (works just fine on Windows PC). Livereload is also working great for me on Windows PC using Chrome.

github.com/atomi/Less/blob/mast … lime-build

In addition to alt+shift+w and multiple select with the mouse (from the mentioned screencast) for wrapping text with an html tag, you can select multiple lines and use ctrl+shift+L, then alt+shift+w and Sublime will wrap each line with an html tag (useful for list and table elements).

0 Likes

#11

Thanks for all that - and the less package looks great.

I think I’ll check back in a few months and see if anything has happened to stop us saving over each others files.

Thanks again!

0 Likes