How to catch user pressing escape key in Atom Package - atom-editor

I am developing an Atom package, and I have certain commands that get executed when I press Ctrl-Shift-Up.
The first time I press Ctrl-Shift-Up, Atom enters a "mode" where things happen differently. Now, I think I know how to do that part. But I don't know how to tell atom to hijack the Escape key.

You can assign a command to Esc through your package keymap.
Example:
'atom-text-editor:not([mini])':
'escape': 'my-package:do-stuff'
If your CtrlShift↑ shortcut creates a custom view, you would want to limit your shortcut to its CSS selector.
Example:
'.my-custom-view':
'escape': 'my-package:do-stuff'
Further reading:
Atom Flight Manual: Keymaps In-Depth
Atom API: KeymapManager

Related

Return Key in Edit Command Mode Shortcuts - Jupyter Notebook

While willing to write ↩a as a new shortcut for the run all cells above command I could not find how to specify the return symbol in Jupyter Notebook.
Writing return-a or ↩-ain the Edit Command Mode does not work and the modifier is not specified in the help dialog.
Any idea?
Return is not a modifier so shortcut like ↩-a make little sens (pressing enter and A at the same time. ↩,a meaning Return key followed by A key make more sens, but Enter is so pervasive for many actions that it is not usable in user shortcuts. I would suggest you to open an issue on jupyter/notebook on GitHub to ask for return to be added as a convenient way to map to ↩ , though even if we do that we can't guaranty that it will work. If you are willing to try to code that yourself, have a look at keyboard.js, the mapping from enter to displaying ↩ is already done in quickhelp.js, for mac at least.

Click element, hold Shift key and click another element in robotframework

I need to be able to click an element on a webpage and hold the Shift key on keyboard and press another element.
Can I implement this behaviour using "Press Key" in Selenium2Library?
You can try to achieve your scenario using AutoItLibrary
First you need to install win32com.client, use below command
pip install pypiwin32
Then use AutoItLibrary command like as per your requirement
Send | {SHIFTDOWN}
For more info visit here
Use using Pyautogui library. This library simulates the User Actions on GUI such as Mouse Control, Keyboards inputs,etc. You can find details at
https://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwjN1ZbrocrSAhWIFJQKHXbiBGcQFggbMAA&url=https%3A%2F%2Fpyautogui.readthedocs.io%2F&usg=AFQjCNEe5LY5eMdaquVD421_u-mpoFUOYQ&sig2=Lj-e4YldvbLNEvPe4NFHrA
Also U can install this library using pip by following keywords in following docs
http://pyautogui.readthedocs.io/en/latest/install.html

Returning from the '+' to '>' prompt in command line of R Studio

I know the prompt changes from < to + when the command line in R expects you to complete the current command. Is there a way (say, shortcut key) to immediately terminate the command being written and revert from the '+' mode to the regular console '>'?
Press 'Esc' key will bring you back to the prompt (<). You don't need to type word 'Esc'.
I suspect you are using a usb keyboard that has chromatic color controls via software. It sometimes mess up the keys therefore simply do a factory reset of your keyboard via install software. Then pressing "Esc" will revert to the
"greater than sign"

How to set user command in Qt Fakevim?

(1) For example, I want to set map gd g* in Qt's Fakevim like below but failed.
(2) And also I'd like to set F3 as the save command, how to do it?
(3) In Fakevim, it provides an option "Read .vimrc", but where to find the file .vimrc?
Thank you!
It doesn't look like there is a lot of documentation for FakeVim, so official sources might not exist. Most of this was obtained by experimentation.
If you want to dig deeper, I guess there's no source as official as the actual source: http://qt.gitorious.org/qt-creator/qt-creator/blobs/0809986e501415fe2c8508800b94b5b3169dc048/src/plugins/fakevim/fakevimplugin.cpp
User commands
First off, realize that in Tools>Options>FakeVim>User Command Mapping, you're only setting what your user actions will perform, not how you perform them.
By default, user command #1 is triggered by pressing Alt-V, then 1.
Alt-V, then 2, triggers user action #2, and so on.
You can change the keyboard shortcuts through the general QtCreator configuration interface, under Tools>Options>Environment>Keyboard. There is a "FakeVim" section with all the user actions listed. Select your user action of choice, press the little "erase" icon in the input field under "Shortcut", then press your desired shortcut key, which should appear in the input field.
Second, to finish a command where you would normally press enter, you should literally type in <CR> after the commands. You also need to enter in ':' to enter command mode.
So if you wanted to map the vim save command, ":w", to F3 via FakeVim, you would:
Go to Tools>Options>FakeVim>User Command Mapping.
Enter ":w<CR>" as one of the user commands (say #7).
Go to Tools>Options>Environment>Keyboard.
Find the FakeVim action "UserAction7".
Set F3 as a shortcut for it.
Now, every time you're in the editor, you should be able to click F3 and have the FakeVim :w command execute, which will save your file.
Note that there is also an option to set a shortcut for "Save" directly in the QtCreator keyboard settings, so for this particular shortcut you don't actually need to go through FakeVim.
Setting shortcuts for other vim commands should be similar. Note that you're restricted to the subset of vim commands that FakeVim implements. Refer to the source, linked above, for checking any particular command you're wondering about.
Vimrc file
On Linux this would be ~/.vimrc, a file in the user's home directory. I presume you're asking about Windows.
The best source I can find is this bug report about it being hard to use Fakevim's vimrc on Windows: https://bugreports.qt.io/browse/QTCREATORBUG-8748
Following that, the file Fakevim looks for is ".vimrc" in %USERPROFILE% (you can enter a name like that in Explorer to go to the folder). However, it's tricky to access a file with a name like that on Windows. (Thus why the real vim uses '_vimrc' on Windows -- but FakeVim apparently doesn't, at least at the moment.)
Here is a superuser page with workarounds for how to create such files on Windows: https://superuser.com/questions/64471/create-rename-a-file-folder-that-begins-with-a-dot-in-windows

vsx shortcut doesn't work

I'm now trying to add shortcut for my package. And I find this article which may be useful. As the article described, I add KeyBinding attribute in vsct file, like this:
<KeyBindings>
<KeyBinding guid="guidPackageTestCmdSet" id="commandId01" editor="guidVSStd97"
key1="M" mod1="Control" >
</KeyBinding>
when I run this package, you can see the shortcut info "Ctrl+M" at right of the command name, but it doesn't fires after I press control + M.
I am assuming you are creating for VS2010. Take a look at this page. Seems like Ctrl+M is a multiple binding. Once you press Ctrl+M check for the status bar in VS and you should be able to see it waiting for another command.

Resources