Sublime Text 2 - Open folders - editor

Is it possible to open multiple folders in the same window using Sublime Text 2?
Selecting File->Open Folder always opens the folder in a new window.
Sublime Text is an excellent editor, but this issue is a bit annoying.

You can use the Add folder to Project... item on the Project menu to open a folder in the current Sublime Text 2 window.
With Sublime Text 2, a project is always open, even if it is anonymous and unsaved.

In Sublime text 3, you can just drag and drop folders, it will open multiple folders. However i have not tried it in Sublime text 2.
Update:
Drag and drop works in Sublime text 2 as well.

From what I can tell, this behavior is built in. In Packages/Default/Main.sublime-menu, the listing for Open Folder… is
{ "command": "prompt_open_folder", "caption": "Open Folder…", "platform": "!OSX" }
Unfortunately, after searching all through the installation, there's no macro or .py file with the prompt_open_folder command, so it must be a hard-coded part of the binary, which makes sense, because it's a system call to the operating system/window manager to open a file picker dialog.
It should be relatively straightforward to write a plugin to select a folder for inclusion in the current window, but unfortunately I'm not quite able to at the moment.

For macOS users, use the command 'open' like so:
usr#mac ~ $ open -a "Sublime-text" "./Desktop/GitHub/uoe"
This will open all the folders in the 'uoe' directory in sublime provided you are at the root directory. For windows/Linux try finding something similar to 'open' :)

Related

How do I change the Color Scheme used by the ExportHtml package in Sublime Text 3?

I want to use the Notepad++ Color Scheme (https://packagecontrol.io/packages/Notepad%2B%2B%20Color%20Scheme) for printing in Sublime Text 3.
I've installed 2 printing (HTML export) packages to attempt this:
Print to HTML
ExportHtml
Print to HTML puts a nice menu option in Sublime's "File" menu, but I don't see any options for changing the print/export color scheme. Therefore, I'm trying to use ExportHtml, which does have color scheme options.
However, I can't figure out how to use them.
I used Ctrl+Shift+P then search for Package Control: Install Package to install ExportHtml.
To see the export menu for ExportHtml go to Ctrl+Shift+P then Export to HTML: Show Export Menu. This shows all of the export options for printing. Choose one and it will open your code up, syntax-highlighted and all, in a browser, for instance, for nice printing.
To make my changes, I want to add a menu entry to the settings to give me a "Browser Print - Color (Notepad++ colors)" option.
To access the settings, I went to Preferences --> Package Settings --> ExportHtml --> Settings. Documentation on the color_scheme can be found here: http://facelessuser.github.io/ExportHtml/usage/.
I then added the following to my user settings in an attempt to add a menu entry to the "html_panel" in the main settings:
{
// Define configurations for the drop down export menu
"html_panel": [
// Browser print color (selections and multi-selections allowed)
{
"Browser Print - Color (Notepad++ colors)": {
"numbers": true,
"wrap": 900,
"browser_print": true,
"multi_select": true,
"color_scheme": "Packages/ExportHtml/ColorSchemes/Print-Color.tmTheme",
"style_gutter": false,
"diable_nbsp": true
}
}
],
}
FIRST PROBLEM: This causes my one menu entry to replace the others when I want it to be added to them. When I go to Ctrl+Shift+P then Export to HTML: Show Export Menu I don't see my menu option added to the others, I see it replacing them. Is there a way to fix this without having to copy all menu entries, or do I just need to copy them?
SECOND PROBLEM: I installed the Notepad++ Color Scheme via the Ctrl+Shift+P Package Control: Install Package tool too, and it works fine, but I don't know how to link it to the "color_scheme" parameter in the configuration settings just above. I've searched all around the folders in my Linux home directory and don't know where this package is installed or what to put in the code above to make it use this color scheme.
How do I fix the above 2 problems?
For this particular package, the only way for you to (safely) add an item to the html_panel setting is to copy the whole of that setting from the default file into your own version, and then make the change there. There's no shortcut around that, unfortunately.
Sublime handles many of its resource files (including sublime-settings files) by allowing multiple packages to have files with the same name which contribute to the settings, and then merging them together in a specific order, where the User package (where your Sublime customizations are stored) is always last.
That means that if your User version of the file is empty, the settings all come from the package version, and settings that you add to your User settings override the ones in the packaged version.
Thus if you add the setting html_panel to your custom file, you're overriding the default version, so without copying the entire setting to your user file, the command will only show you the one you added.
For the second part of your question, the line that you want to modify in the entry to add that color scheme is this:
"color_scheme": "Packages/Notepad++ Color Scheme/Default Stylers.tmTheme",
Recent versions of Sublime have an item in the Preferences menu named Color Scheme... that shows you a list of color schemes and lets you select one.
If you're not familiar with the general process of figuring out the full name of a color scheme, the easiest way to find out would be:
Use Preferences > Color Scheme... and select the color scheme that you want to use
Use Preferences > Settings to open your user settings; the value of the color_scheme setting in your user settings tells you how to set the color scheme up
Use Preferences > Color Scheme... to reset back to the color scheme you want to use in general
As far as package locations, there are three places where packages can be installed.
First, if you select Preferences > Browse Packages... you will be taken to your Packages folder. This folder contains all of the packages that are installed as "loose" files (that will become clear in a moment). Most packages that Package Control installs aren't installed this way, so you will probably see many packages missing.
On Linux, the location of this folder is ~/.config/sublime-text-3/Packages.
Secondly, from the folder above if you navigate one folder level up in your file browser, you will see a folder named Installed Packages. If you look inside there, you will see a set of files of type sublime-package, which is really just a zip file with a different name. Each file is named for the package that it represents and contains the contents of the package.
On Linux, the location of this folder is ~/.config/sublime-text-3/Installed\ Packages.
Thirdly, if you look inside of the folder that Sublime is installed in, you will see a folder named Packages, and inside of that folder is another set of sublime-package files. These are the packages that ship with Sublime to provide default functionality. They're shared by everyone on the same computer, so you shouldn't mess with this folder at all unless you're fully aware of all of the ramifications (and really not even then).
The location of this folder depends on where you installed Sublime. If you're not sure where that is, you can open the Sublime console with View > Show Console and then enter the following text and press enter:
sublime.executable_path()

Sublime Text Go To Folder Shortcut

I am familiar with sublime text's Ctrl+P to navigate between files, but is there any command or plugin to navigate between folders (Highlight them in the sidebar) and perform actions on them there?
The shortcut for moving to the sidebar nav is Ctrl+0.
Ctrl+1 will bring you back to the file you're editing.
You can use Project ⇢ Add Folder To Project... from the menu or you can bind the command to a key to use it more easily.
The command for this action is prompt_add_folder.
When you add the folder you want to your project you can do actions on folders like New Folder , New File, Remove Folder from Project and other commands depending on other plugins you may have installed.

Visual Studio Code closes my file when I search for new ones

I'm using Visual Studio Code for working and I use ctrl-P command to search for files in my directory.
The problem appears when I want to search for another file, it opens it in the place of the first searched file, closing it.
Is any setting for avoiding this pain?
By default, VSCode opens files in preview mode. This is indicated by their name being italic in the menu bar. As John noted, you can double click on the file to fully open it.
To disable this behavior, try setting:
"workbench.editor.enablePreview": false
When you select a file from search result -> you will see the file open with file name italicized. This means that the file is open in preview mode. Now any other file you choose to select will replace its content in this tab.
To make this tab stick among the open tabs you can:
double click to select the file
or
double click on already selected file in search pane -> you will see the name of file is not italicized anymore(meaning the file is now pinned as a tab)
Alternatively,
You can use the below setting to have all selected files open as a separate tab:
"workbench.editor.enablePreview": false
This setting is found here : Files -> Preferences-> Settings
But the downside of using this is that all files you click on will remain opened and you would then need to clean tabs after your search.
Ctrl+P -- For targetting a file
Alt+Enter -- For Opening that file into next tab
Double click on the files instead of a single click. That worked for me.

Find missing files in Xcode

I am re-arranging files in my file system for my Xcode projects. Therefore, when I open the Xcode project, all of the files are red.
I can add each file manually, but is there a way for Xcode to quickly find these files for me? All of the files are located in one directory.
If you have a bunch of missing (red) files that now live in the same directory, you can improve on the "fix each path individually in the inspector" method by selecting (Cmd-click) all the files at once. You'll see "multiple values" in the inspector, like so:
Clicking the button under the Location dropdown will bring up a directory selector -- note that the prompt says "Choose folder containing..." rather than "Choose file and location".
As far as I know, Xcode doesn't have a way to automatically locate moved files. You can reconnect a reference to its file using the Inspector (panel on the right) but it is somewhat tedious to do so. In your case, it would probably be faster to simply delete the references and then add the files back to your project.
I agree with the answers already given. In a real pinch, or as a last resort, you can open the project file in a text editor and fix the path references by hand.
Close the project in Xcode
Backup the project file someplace safe
In the Finder, right-click on the project file and select "Show Package Contents"
Drag project.pbxproj to BBEdit (or TextEdit or whatever)
Edit whatever "path = xxx" references you want
In this case i do this steps:
1) Add a new group with name Res
2) Click "Add Files to ..."
3) Find a folder with resources, and click CMD + A
4) Set check box on "Create folder references for any added folders".
And in source code i use e.g. "fonts/font1.xml".
5) Then for refresh, i just Removing a Res group references
6) And do steps from 1 to 4
Hope this will be a useful

Kdevelop doesn't show the editor window

I'm trying to open a project file in the main editor of kdevelop, but it is not able to show it. I have tried also with a new file, but still the same. It seems that there is a window separator in the middle of the grey window.
I have remove the project, purge and reinstall the application but it doesn't work. The Editor menu in the tools bar doesn't have nothing inside.
I'm using kubunu 11.10, KDE 4.7.3 and KDevelop 4.2.3
Does anybody had this problem?
I think your projects tool view is not enabled. If yes, Go to Window, select Add Tool View. Then select Projects. Then try opening up your project file (something.kde4). It should show up as a folder in the Projects Pane. Expand it and double click your required source file to get it in the editor.
I had the same problem with KDE 4.7.4 and kDevelop 4.2.3.
I think, its a bug of kdevelop. after closing all projects and importing the working project again I tried to open a file. But kDevelop was crashed. After restarting kdevelop, everything is working fine and the file is shown in the editor!

Resources