Sublime Text 2 - Link with Editor / Show file in sidebar - sublimetext

I'm looking for a feature like Eclipse's Link with Editor. Basically, I want whatever file I'm editing to be shown in its place in the file tree.

Just right-click anywhere in the file's view and press "Reveal in Sidebar."
To make a key-binding, go to Preferences > Key Bindings-User and add:
{ "keys": ["ctrl+shift+r"], "command": "reveal_in_side_bar" }
From here.

https://github.com/sobstel/SyncedSideBar
You can install this via the Package Control utility (although it doesn't mention it on the github page).

There is a simpler option to automate this: Create a new Plugin:
Menu Tools->New pluguin and save this:
import sublime, sublime_plugin
class SideBarListener(sublime_plugin.EventListener):
def on_activated(self, view):
view.window().run_command('reveal_in_side_bar')
The folder where to save this is selected by default, and extension (.py) also is added by default.
On windows, the folder is C:\Users\username\AppData\Roaming\Sublime Text 2\Packages\User
That's quite usefull to modify a saved pluggin

I know I'm quite late for the party here, but having the very same need and trying to avoid mouse commands I've wrote a new plugin to that, take a look and give it a try, anything please feel free to ping me =)
https://github.com/miguelgraz/FocusFileOnSidebar

I tested the solution proposed by Albert CatalĂ , but it causes an error when a popup window appears, with the 'Quick Switch Projects' command for example.
So here is my modified version to avoid errors :
import sublime
import sublime_plugin
class LinkWithEditor(sublime_plugin.EventListener):
def on_activated(self, view):
if view.window() is not None:
view.window().run_command('reveal_in_side_bar')
Hope this help!

Related

Where is the windows terminal settings location?

I edited the settings file and there must have been a typo and now the app crashes on startup.
Online the documentation says the settings lives in $env:LocalAppData\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json
I can't figure out what that path means since it doesn't exist on the computer.
I re-installed the app to fix the problem then made sure to see what the actual path is.
It's located in : C:\Users\{USERNAME}\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState
In the current version (1.7.1033.0), the application can open the JSON settings file for you via a button. Open the Settings tab, and the bottom left corner will have a button named "Open JSON file". Clicking that button will open a prompt asking with what application to open the file. That text editor can then tell you where the file is located.
If you open the terminal settings, it will open a text editor with the settings.json file. If your default editor is VS Code it will show you the path below the tabs on the top of the screen.
I'm unsure what other editors show you the path, but if it is crucial you can change your default text editor to Code.
There is still the option to open the JSON file through settings. In version 1.15.2875.0 you can still find the "Open JSON file" at the bottom left corner
Screenshot with highlights
This hint was given by a comment by user1340531:
Mine is at C:\Users\{username}\AppData\Local\Microsoft\Windows Terminal\settings.json
(or more generically: %userprofile%\AppData\Local\Microsoft\Windows Terminal\settings.json)
If it's not there, you should consider OP's answer or vyps comment which lets you find out one of these generic paths (they are equivalent):
%userprofile%\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState
%LocalAppData%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState
$env:LocalAppData\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState
If you don't know what these paths mean, I'd recommend playing around with "Windows Run" (Win+R) and the explorer address bar.

Xcode 8: custom description in suggestion

I'm trying to have custom description for my functions shown in the suggestions box which shows up as I type said function names, the same way it works for swift functions: e.g the UIActivityIndicatorView.startAnimating() description is shown both in the
QuickHelp menu AND in the completion box
in Xcode 7 I would just add a comment line with the /** */ tags prior to the function declaration and the ide would recognize it accordingly e.g.
but for some reason doing so with Xcode 8 only shows the custom description within the QuickHelp tab of the Utilities menu, and not in the suggestion box.
Is there any suggestion about how I may obtain the same behavior with this new version of Xcode? I would appreciate it a lot!
Hear i found some solution. You need to change User Header Search Path No to Yes under Build settings. And then restart your xcode.
This is working fine for me.
It is because of Indexing.... just go to your project name at the top of navigation and Clean (cmd+shift+k) then come again to the file where you wanna work type any word you will see suggestion popUp. that it..
Other way is that just quit your xcode and open it again and wait for a moment let xcode indexing the files then type any word you will see suggestion popUp. that it..

How do I activate the Zen coding key bindings in Sublime Text 2?

I just downloaded the Zen coding package for Sublime Text 2, but I can't figure out how to activate it.
I already have it in Netbeans, and here you just have to press CTR+ALT+N, but this doesn't work in the Sublime editor.
Google didn't yield any results, so I'm asking here.
Can someone tell me how to activate the Zen coding function?
press Ctrl+Alt+Enter and you'll get a text input box at the bottom of the screen, titled: Enter Koan:. as you type the zen expression into the box it will simultaneously unfold on the screen.
Alternatively, you can type the zen expression in the editor and press tab to expand it. Be sure not to leave any spaces inside the expression or after it.
I have been using Sublime Text 2 beta, build 2139 on Windows (but I'm also pretty sure this should work on Mac OS and Linux too) and here's how I got it to work:
After installing Sublime Text 2 itself, install Package Control
for Sublime Text 2. This is an add-on that allows you to easily
manage another add-ons.
I couldn't get the first installation option to work so I went for
the manual method. On my installation there was no folder called
"Installed packages", instead I've used "Pristine Packages" folder
which seemed to contain other, already installed extensions.
Restart Sublime Text 2
With Package Control installed open Sublime Text 2 editor and choose Preferences -> Package Control -> Package Control : Install Package from the menu. Hit "Enter" and there should be a list of packages available for installation displayed on the screen. Start typing "Zen" and Zen-Coding will be presented. When selected hit "Enter" again, status bar on the bottom of the screen will be showing installation progress.
When it's done - restart Sublime Text 2 one last time. Now, you can expand Zen-Coding abbreviations with 'ctrl+space' or 'tab'.
Remember it will only work in the saved file, with extension "html". (in particular - it won't work on the new document you've just created).
I hope this helps
To expand your zencoding, just press TAB. However, for a full list of all the keybindings, look in your Zencoding folder for a file called "Default (NAME_OF_YOUR_OPERATING_SYSTEM).sublime-keymaps". To get to the package, go to "Preferences > Browse Packages > zencoding".
Ctrl + Opt (Alt on a PC) + Enter. Check out the video.
See this post : Zen coding downloading trouble
and my comments for detailed instructions.
Also, after an upgrade, just replace the folder with the original one from
http://dl.dropbox.com/u/1292831/ZenCoding.zip
Good Luck ..
Download this one; https://github.com/sergeche/zencoding-sublime
It works on SublimeText2 2.0.1 build 2217 windows.
After install Emmet package, remember to restart sublime editor and save a file first to try it!. I thought it wasn't working after install, but it just needs a saved file to work on it.

applescript choose file title

I have got a choose file in my applescript. How do I change the title of the Choose a File window that comes up. I am aware of with prompt, but it doesn't change the title.
Edit: ulvund answered I'm afraid with prompt is the best you can do, but are there any other ways to get a choose file without applescript? Also, are there any hacks?
Edit 2: Red_Menace answered (look below) but are there any good tutorials on how to do this in Cocoa-Applescript?
P.S. Look at my comments.
Edit 3: I have put this into another question.
The dialog in plain AppleScript doesn't have that option, but you can access various Cocoa methods in Snow Leopard and Lion using AppleScriptObjC. In Lion, you can create a Cocoa-AppleScript Applet from the template in the AppleScript Editor, then create your own dialog, for example using NSOpenPanel.
I'm afraid with prompt is the best you can do:
http://docs.info.apple.com/article.html?path=AppleScript/2.1/en/as309.html
An answer to the edited question: You can use Automator.
Ask for Finder Items action in Files & Folders library will show the choose file dialog. You can change the title of the dialog of this action.

Is it possible to launch an external image editor from Textmate?

Is it possible to launch an external image editor from the TextMate project drawer? I suppose the same concept would apply to launching any external editor from TextMate. Right now, if I right-click on the image file, I only have an option to open in Preview or Finder.
Thanks!
Yes. There is an (official) TM Bundle that does what you want--it's called "ImageBrowser." I installed recently and i have used it only once. It seems to work fine for the purpose you mentioned in your Question; in particular, it finds images in your current project and displays them in an image browser that runs inside TextMate.
You can get it from the Macromates SVN Repository.
TextMate respects the Finder's (well, LauchService's) "Open with" choice for each file. Whichever program would open when you double-click the file in Finder will appear in TextMate's contextual menu. Simply change this through the Finder's Get Info window for the file in question to the editor of your choice, and TextMate will respect it. It's dynamically populated, so you don't need to restart TextMate.
As far as I know, there's no method to specify a secondary program beyond the default.
I think no is the answer, but like Matt said, explore the usage of the Services menu.

Resources