Showing posts with label sublime text. Show all posts
Showing posts with label sublime text. Show all posts

Sublime Text: Automatically pretty format JSON and/or XML

I love the ability to quickly extend functionality in Sublime Text. For a while now I've been wanting a quick formatter for chunks of JSON/XML, so here's how I got it up and running on my Sublime Text 2.

Downloads

You'll need to download these files from my github repo:

Installation

To install these files, you'll have to move them to the right place first.

  • Open up Sublime Text (I'm using v2.0.2 at time of writing)
  • Click on "Preferences" in the menu
  • Click on "Browse Packages..."
  • Open the "User" folder
  • Move prettify_json.py and tidy_xml.py there
  • Check if "Main.sublime-menu" also exists in that folder
  • Open it in Sublime Text and paste in the following. If there is already some text in there, please merge them carefully. It shouldn't be too hard.

Now you should have to add it into the menu for easy access.

image

Update 19/05/15

Updated links to github raw source files. Fixes the issue where people were using "save files as" from this page and getting "greyed out menus".

Sources

Sublime Text: Binding "close all files" to keyboard shortcut

Had some trouble finding this in the documented list of commands.

So putting this up here in case anyone runs into it.

{ "keys": ["ctrl+shift+w"], "command": "close_all" }

Source

Sublime Text 2 / Eclipse: View the same file in two different places simultaneously

One of the more interesting features of Sublime Text 2 was the ability to view a file in two places at once. I saw this in a video tutorial on Lynda and wondered if it was possible to do in Eclipse also.

This becomes VERY useful when editing HTML files where CSS/JS declarations are in the header and the content is in the body.

Sublime Text 2

Since I saw this feature here first, I'll write about it Sublime before Eclipse.

Open up the file you wish to edit. Then click on File > "New view into file".

Eclipse

My old trusty Eclipse. Slow and hefty, but it's the Swiss army knife of development for me.

As before, open up the file you wish to edit. This time, click on Window > "New Editor".

Sources

Sublime Text 2: Subfolders and files not appearing in project folders list

Been toying around with Sublime Text 2 for the past week, a pretty damn good editor so far. Ran into a strange problem which made it impossible to use.

It took a bit of guess work but it was due to the nature of my workflow. The project files are located on a remote folder, mapped to a network drive via ExpanDrive. There are other reports of people with this issue using Samba, so I'm guessing it's mostly related to working remotely.

If you've got issues opening 2nd level directories, remedy this by going to:

  • Preferences
  • Settings - User
  • Add in this line

"ignore_inodes": true

Save and restart ST2. The subfolders SHOULD show up. If not, remove the folder from your project and add them again.

Note: This hidden setting was added to build 2197 (11th of May, 2012) for Windows only.

ibs8zT68d2LKTK
Don't worry Sublime Text, you've only stumbled gracefully

Source

 
Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog