Sublime Text: Switching files in different folders - sublimetext

I have opened a c++ project in Sublime Text and I am working on windows environment.
I need to switch among .cpp and .h files. There is a command Alt+O which can switch these files if they are in the same folder. but my files are placed as follow:
.h in myfolder/include/subfolder/
.cpp in myfolder/src/subfolder/
The file names are same, they just differ in extensions. Right now I use Ctrl+p, but I want single command to do that.
Thanks in Advance

It might not be exactly what you want but here is a workaround to accomplish what you ask for: if you download and install the CTags plugin for Sublime, you will be able to:
Build tags with Ctrl+t, Ctrl+r
Ctrl+t, Ctrl+t will make you jump to definition (from header to source) of what is under your cursor
Ctrl+t Ctrl+b to "jump back" (to header)
[EDIT]
It seems someone has implemented a plugin to accomplish what you want (didn't test it though, note that the README says that it will look for matches outside of the current folder but only in already opened files)
FWIW, the original feature is in Packages/Default/switch_file.py (also you might want to have a look to Vim equivalent code)

Switch File Deluxe does exactly what you want. It overrides Alt+O.

Related

Location of JetBrains IDEs default keyboard shortcuts

I wanted to write a tool for synchronizing keyboard shortcuts between JetBrains IDEs but I cannot find the default ones. When I customize them in the IDE, a new folder keymaps is created under .tool\config which contains only the customized assignment.
However, I need to first compare the original schemes to find differences and to merge them eventually. But I cannot find them anywhere.
I looked for various *.xml files with the content like shift or ctrl or keyboard-shortcut, no results.
Do you know where they are hidden?
Check IDE_INSTALL_FOLDER/lib/resources.jar file (it's an ordinary ZIP archive).
All bundled keymaps will be located in keymaps folder inside that archive.

Can I use Xcode as a simple text editor?

Okay ... This may be a ridiculous question. (I'm still getting used to Mac.) I really like the auto fill-in-ahead predictive typing feature of Xcode.
Can I use it to simply edit files laying around different locations on my hard drive? I do not really want to create a project or anything (unless by PROJECT I mean simply loads several files, that are not related to each other, but that I may want to jump back and forth in editing them - I do not want to create a project from files that need to be compiled or anything).
If so, what's the best way to get started? When you open XCode, it asked a lot of wizard questions to get things set up. How would I simply get started to edit 5 or so files at a time ... where I might want to switch back and forth between them - and they are not in the same directory?
All I want to do is simply make changes and save them, make more changes and save again, repeat. Kind of like holding a lot of shell scripts that communicate with each other.
Okay ... so I know this was a silly question - but Xcode is so intimidating for newbies. Sometimes, one needs a place to just get started and I haven't found that yet.
It is possible to open the Xcode text editor on a single file from the command line.
open -a Xcode.app filename.txt
If you're going to use this a lot, you might consider making an alias in your ~/.bashrc.
alias xc="open -a Xcode.app"
As of Xcode 6, you cannot open a directory this way, as it will give you an error message stating that directories must be opened as part of a project. If you provide more than one file on the command line, Xcode appears to create a temporary project containing the files you provided. You can add files and folders to the temporary project, but there doesn't seem to be a way to save the temp project for use later.
If you want to open a file in Xcode, you can also use xed.
As the man page says:
xed -- Xcode text editor invocation tool.
You can simply call xed [file] to launch Xcode editor.
Notepad++ is the way to go. Xcode was never meant to be used as a general text editor.
EDIT: Sorry, didn't know that there wasn't a Mac port for Notepad++. Use TextWrangler instead.

Having troubles renaming a file in the RubyMine "Jetbrains" IDE

It's a great environment, but when I right click on, say a model .rb file, it is not readily apparent how I might rename a file.
Now RubyMine JetBrains is a brilliant program which I love, so I'm not going to stop using it, I just need to get around this simple problem.
Use the Alt+Shift+R shortcut to rename the file when it's highlighted in the project view panel.
Generally, actions like rename is part of the Refactoring (because you also need to rename the usages of it) so you will also find it in the Refactor menu on top.
In RubyMine 2018.3 on Windows use:
Shift+F6
or
Right click on the file name and choose Refactor > Rename

How do I configure TortoiseHg to open a file in the right program based on its extension?

I'm using TortoiseHg v2.2.1 with Mercurial 1.9 in WindowsXP. How do I configure TortoiseHg to view a file based on the application Windows has associated with its extension?
For example, if I have a .docx file in the repository and I'm looking at its revision history, I'd like View at revision... to open the selected revision in MS Word. Likewise for other binary file types like ppt and xls, which I can't view using the default text editor or kdiff3.
Can I leverage that Windows already knows what program to use to open certain types of files or will I have to manually configure each file type of interest within the Tortoise config files?
I've found several SVN scripts in the TortoiseHg\diff-scripts folder that look like they solve a similar problem for diffing binaries rather than simply viewing them, but those don't seem to be activated and I'm not sure what if anything I need to mod in the MergePatterns.rc or Mercurial.ini files to make this all work.
To make "View at Revision" use whatever program is associated with the file's extension, try this trick: In the "Global Settings" in the "TortoiseHg" section, enter start "" as "Visual Editor". Note the empty "". This is necessary so that start will not use the file name, which gets passed in quotes by TortoiseHg, as the window title.

How do I control the "open quickly" search path in XCode3 (3.2.3)?

XCode2 had this beautiful feature: you put the cursor on a line with a #include <file> and execute the open-quickly command (command-shift-D) and it would open the file. I can't get it to work for me in XCode3.
I have something like this
#include <folder/subfolder/HeaderFile.hh>
and when I put the cursor on this line, and open the open-quickly dialog, it automatically fills the search window with
folder/subfolder/HeaderFile.hh
but doesn't find anything. If I then remove "folder/subfolder/" then the dialog will identify HeaderFile.hh and I can open it up. But this extra deleting is so much slower just the three-key command-shift-D opening I was used to with XCode2.
If I give it the full path to this file in the search window, then it finds it:
/Users/andrew/myproject/src/folder/subfolder/HeaderFile.hh
this path will find the file. Again, I don't want to spend all my time typing out the full path.
I created this project as an external build system, and I think that's related to the problem; the xcode project lives in
/Users/andrew/myproject/xcp_dir/
and I want it to search in the "../src/" directory so that the partial path I give it (which is already present in the #include) will match the file I want to open. In XCode3, I had to create the project in the xcp_dir directory; in XCode2, I could create the project directly into the existing myproject/ directory -- maybe that's why the search is failing?
I read on a previous thread (which never answered the question) that I should set the HEADER_SEARCH_PATHS option. I tried this (setting the option to /Users/andrew/myproject/src) but it did not work.
I don't have any sense of what other options (like the HEADER_SEARCH_PATHS option) are availalbe, so if you know which one I have to set, I'd love to hear it.
Since this is an old question I'll answer it for Xcode 4 instead of 3.
As far as I know Open Quickly doesn't use anything like a search path. It seems to have use the project's codesense index and will show results from that. Querying the database doesn't have an notion of file paths, so the workflow you describe just won't work anymore.
However that's okay, because there's a better solution: Just ⌘+click on the include line and the appropriate file will be found using the same rules as the compiler uses, and opened. If you want to open the file up in an assistant, another tab or window, you can use ⇧⌘+click instead, and you'll get a little UI for easily selecting where you want the file opened.
You can also use these shortcuts to go to definitions for any identifier.
If you don't want to use the mouse you can use the command "Jump to Definition" which has the shortcut ⌃⌘J, or ⌥⌃⌘J to open the definition in the assistant editor. This also works for both normal identifiers and #included files.

Resources