How to unbind a key binding in Sublime Text 2? - keyboard-shortcuts

I have a habit of hitting CTRL+T to open a new tab in ST2. However this invokes the transpose function. I could map the new_file command to CTRL+T, but is it possible to disable the command completely via user keymap file. My search suggested adding this to user keymap.
[ { "keys": ["ctrl+t"], "command": "unbound" } ]
Is the "unbound" an officially endorsed way of disabling a shortcut?

{ "keys": ["ctrl+-"], "command": "noop" }
Binding a key to a no-operation or anything which wouldn't carry a command behavior, such as "hello", should work.
This would also keep the body of the binding if you change your mind in the future.

I have never see or read any official documentation about the unbound command, but it works. Another option would be removing the command attribute.
{ "keys": ["ctrl+t"] }
This will also unbound a key binding.

Also, if you're looking to undo a shortcut that was overridden by a plugin (I'm looking at you, "Terminal"):
find your previous shortcut in Preferences -> Key Bindings (Default)
Copy the line (e.g. { "keys": ["super+shift+t"], "command": "reopen_last_file" })
Open Preferences -> Key Bindings (User)
Add the the line in there (if the file is empty, it add [ and ] before the line, since it's an array of commands)

Actually this post did help me with my issue when using ST3 on mac. Using the Package Resource Viewer you can edit the default keyboard shortcuts (Default (OSX).sublime-keymap) and delete the lines that you don't want. After doing that ST3 will no longer capture your system-wide hotkeys.

The Path Tools package includes key bindings that override default Sublime key bindings which I use often, specifically: command+shift+V
On a Mac, I was able to override all of the default bindings of the Path Tools package by placing a blank file here:
~/Library/Application Support/Sublime Text 3/Packages/Path Tools/Default (OSX).sublime-keymap
I wish Sublime package installation warned users when a package includes key-bindings which will override current or default key bindings.

It is possible to overwrite the default bindings of installed packages by creating a custom default bindings file.
For example I want ctrl-T to transpose, so I have modified default bindings for CTags:
Copy c:\Users\USER\appdata\Roaming\Sublime Text 3\Installed Packages\CTags.CTags.sublime-package to tmp.zip
From the zip file extract Default.sublime-keymap to c:\Users\USER\appdata\Roaming\Sublime Text 3\Packages\CTags\
Modify or remove the binding from this file.
If the package is updated the custom default binding file is kept, so your bindings are kept and any new bindings will have to be updated manually.

Related

Xcode - how to change file's target membership via command line?

Is there a way to change file's target membership in Xcode project via command line?
Here's what I'm trying to do via Xcode's UI:
I also had to do this for CI. After lots of digging, I do not believe this is common enough for anyone to have written a tool to help with doing.
The only conclusion I came to was to edit the project.pbxproj file directly, which is never a great thing to do. None of the tools which claim to do this were of any help until I found this stackoverflow answer on editing the project.pbxproj file. Essentially, you can convert the project.pbxproj file into a JSON format using plutil -convert json project.pbxproj and use a JSON manipulation tool to make those files as headers then point them to be headers of whichever target you would like.
When converting the project.pbxproj into JSON format, be aware that Xcode will no longer be able to show you the project navigator for that project. It will still build and run, however, so this is really only useful if you're planning to do this right before building (such as for CI).
(EDIT: As of July 2022, Xcode will now properly read a JSON version of its .pbxproj to allow you to view your files in the project navigator. I'm not sure which version introduced this, but it is at least now possible with later versions of Xcode.)
The format project.pbxproj as JSON has nearly all the important data under the "objects" key. The file you want to be a header already has an entry with the key being the UUID for the file and a path value you can use to relate the UUID to your file. Here's an example of that format:
// UUID for your file
"65TYSSDXHSLP4UUOAD9D40C322AAGHM9": {
"path": "MyHeader.h", // Your file's name
"isa": "PBXFileReference",
"includeInIndex": "1",
"lastKnownFileType": "sourcecode.c.h",
"sourceTree": "<group>"
}
There's another entry to declare this file as a header, which has its own UUID and a reference to the UUID of your file:
// UUID for your file as a header
"YU3BSD39O9PT5RESDFV741D1": {
"isa": "PBXBuildFile",
"fileRef": "65TYSSDXHSLP4UUOAD9D40C322AAGHM9", // UUID for your file MyHeader.h
"settings": {
"ATTRIBUTES": [
"Public" // could also be Project or Private
]
}
}
Then finally, your target has a list of header files where you will want the UUID for the header reference to go.
"A82GAE9A5HUIO063IOPQAAQIUFGSNXZ": {
"isa": "PBXHeadersBuildPhase",
"buildActionMask": "2147483647",
"files": [
"YU3BSD39O9PT5RESDFV741D1" // UUID for your file as a header
],
"runOnlyForDeploymentPostprocessing": "0"
}
Again, changing the project.pbxproj file directly is never a great idea, but until there's a better tool for making these changes without using Xcode, it's the best I could find. If anyone else is aware of something I'm not, please let me know.

WebStorm Vue-i18n, anyway to get editor autocompletion support?

I'm localizing a webapp using vue-i18n. Is there anyway to get WebStorm to recognize strings in a function prefixed with $t as a dot notation path reference?
$t('messages.some.key')
in my en.js file which looks like:
exports defaults {
messages: {
some: {
key: "Foo"
}
}
}
It would be nice if it provided me with autocomplete and also syntax highlighting if the key doesn't exist.
Old question but still unanswered... For those who have been looking for it and ended up here (like me), meanwhile there is a plugin: https://plugins.jetbrains.com/plugin/12981-i18n-support (https://github.com/nyavro/i18nPlugin)
See https://kazupon.github.io/vue-i18n/guide/tooling.html#i18nplugin-intellij-platform for more information how to configure the plugin.

How to change Textmate's context menu key binding?

In Textmate there is a great shortcut to get to the context menu without using the mouse (I wish it worked systemwide!!!). It is Opt+F2.
When working on my Macbook, however, F2 is mapped to screen brightness, so I have to press fn+opt+F2, for which I have to use both hands - and that's quite uncomfortable.
Is the a way how I could map it to the right opt key, for example?
For TextMate 2 you can create ~/Library/Application Support/TextMate/KeyBindings.dict and let it contain something like:
{ "#d" = "showContextMenu:"; }
Here #d corresponds to ⌘D. See this blog post on how to construct the key equivalent strings.
Source: TextMate mailing list
Key binding files are read in the following order. A new binding for a bound key overrides the previous one:
/System/Library/Frameworks/AppKit.framework/Resources/StandardKeyBinding.dict
/Library/KeyBindings/DefaultKeyBinding.dict
~/Library/KeyBindings/DefaultKeyBinding.dict
/path/to/TextMate.app/Contents/Resources/KeyBindings.dict
~/Library/Application Support/TextMate/KeyBindings.dict
A relaunch of TextMate (⌃⌘Q) is required before changes take effect.

IntelliJ IDEA override $user

It's a quite simple question, but I can't find an answer to it using SO-Search and Google.
Is it possible to override the default $user VTL-variable used in file-templates globally, instead of setting it in each template with #set($user = "...") ?
Like some sort of setup-script for IntelliJ itself, where I can alter the value?
Thanks in advance.
By the way, I'm using IntelliJ Ultimate 12.1.6.
You want to modify the IntelliJ's .vmoptions file(s) in a text editor.
In Windows, edit IntelliJ-Install-Location/bin/idea.exe.vmoptions and/or IntelliJ-Install-Location/bin/idea64.exe.vmoptions.
In Mac OS X, edit IntelliJ-Install-App.app/Contents/bin/idea.vmoptions.
Within these files simply add or modify the following line:
-Duser.name=Your name
If you recognize this syntax, that's because Intellij IDEA uses the Java System Property user.name to fill $user and ${USER}.

How do I write a Photoshop Extension (8BX) plugin?

The Adobe Photoshop CS3/4 SDK has a lot of examples for Filter, Import, Export, etc plugins but I haven't found anything that illustrates how to write a 8BX plugin.
The reason is, I need to write one is to add a new drop-down menu to the Photoshop root toolbar (where it displays File, Edit, Image ... Window. Help drop-down menus). I have seen a product like OneSoftware install an 8BX plugin into Adobe Photoshop CS3\Plug-Ins\Extensions directory that causes PS to add adrop down menu for OneSoft. That suggests this is a solvable problem :-)
I tried by changing an existing plugin in the SDK samples but no go. Specifically I modified the resource file:
resource 'PiPL' (ResourceID, plugInName " PiPL", purgeable)
{
{
Kind { **Extension** },
Name { plugInName "..." },
...
Despite using the Extension Kind, PS never loads the plugin. It doesn't generate any compile-time or load error either.
Does anyone have any ideas on how to go about doing this?