How do I show or trace what command a keyboard shortcut is mapped to in Sublime Text? - sublimetext

My keyboard shortcut for "Ctrl+D" is currently being overridden, but I don't know where or what command is overriding it. I'm guessing it is from a plugin.
How can I see what Ctrl+D is currently mapped to?

Open the console (Ctrl`) and enter sublime.log_commands(True). Then enter Ctrl+D (or any keyboard shortcut) in the editor to see the associated command printed to the console.

Related

ahk send alternative in bash script

I want to achieve in a bash script, that when I press any key (e.g. F5) and then type any word (e.g. "hello world"), regardless of whether I positioned in the terminal, or text-editor or browser...
While I was using Windows, then I used Autohotkey for that.
How could I achieve that with bash script in Linux?
While as #Socowi mentioned, you will likely not be able to do this with bash alone, you can use AutoHotkey Linux alternatives like AutoKey for this.
For your specific question, see this guide for setting up and configuring AutoKey on Linux.
More specifically, scroll down to the section labeled "Inserting repetitive text using a hotkey" for how to configure a text-typing hotkey:
Inserting repetitive text using a hotkey
Abbreviations is only one way of inserting text using AutoKey. If you
prefer, you can also insert text using a keyboard shortcut, which
doesn't require typing an abbreviation.
To insert some text that you need to type frequently using a keyboard
shortcut, click the Set button next to Hotkey, then click Press to Set
in the newly opened window, and press the key combination you want to
use for this phrase:
Make sure you use a hotkey that's not already in use or else it may
not work / it will interfere with the already set hotkey. To try this
out, set it to something like Ctrl + F1 (which shouldn't be set by the
system at least).
Remember to click the Save button in the AutoKey toolbar after setting
the phrase hotkey, or else the changes won't have any effect. Now try
it out: focus a text editor, some text field in a web form, etc., and
press the hotkey you've set in AutoKey - the Testing AutoKey text
expansion on Linux phrase should be automatically inserted as soon as
you press the keyboard shortcut.

Clearing the terminal in vs code without using ctrl C

I want to know how do I clear up my terminal in Vs code without using Ctrl C
and restarting my how program?
There is an unbound command:
workbench.action.terminal.clear
that will do what you want without terminating any running tasks/processes. You can set it to a keybinding of your choice if you search for it in the Keyboard Shortcuts. It appears to work when you have editor focus and not terminal focus.

Copy Paste in Bash on Ubuntu on Windows

How to execute a copy paste operation from Windows 10 to the Bash on Ubuntu on Windows environment?
I tried the following:
ctrl + shift + v
right click to paste
Any suggestions?
Update 2019/04/16: It seems copy/paste is now officially supported in Windows build >= 17643. Take a look at Rich Turner's answer. This can be enabled through the same settings menu described below by clicking the checkbox next to "Use Ctrl+Shift+C/V as Copy/Paste".
Another solution would be to enable "QuickEdit Mode" and then you can paste by right-clicking in the terminal.
To enable QuickEdit Mode, right-click on the toolbar (or simply click on the icon in the upper left corner), select Properties, and in the Options tab, click the checkbox next to QuickEdit Mode.
With this mode enabled, you can also copy text in the terminal by clicking and dragging. Once a selection is made, you can press Enter or right-click to copy.
To get right-click to paste to work:
Right-click on the title bar > Properties
Options tab > Edit options > enable QuickEdit Mode
At long last, we're excited to announce that we FINALLY implemented copy and paste support for Linux/WSL instances in Windows Console via CTRL + SHIFT + [C|V]!
You can enable/disable this feature in case you find a keyboard collision with a command-line app, but this should start working when you install and run any Win10 builds >= 17643. Select "Properties" from the menu to access the following dialog box.
Thanks for your patience while we re-engineered Console's internals to allow this feature to work :)
You can use AutoHotkey (third party application), the command below is good with plain alphanumeric text, however some other characters like =^"%#! are mistyped in console like bash or cmd. (In any non-console window this command works fine with all characters.)
^+v::SendRaw %clipboard%
Right-click the title bar, select context menu Edit -> Paste (until they fix the control key shortcuts)
As others have said, there is now an option for Ctrl+Shf+Vfor paste in Windows 10 Insider build #17643.
Unfortunately this isn't in my muscle memory and as a user of TTY terminals I'd like to use Shf+Ins as I do on all the Linux boxes I connect to.
This is possible on Windows 10 if you install ConEmu which wraps the terminal in a new GUI and allows Shf+Ins for paste. It also allows you to tweak the behaviour in the Properties.
The Console looks like this:
Copy options:
Paste options:
Shf+Ins works out of the box. I can't remember if you need to configure bash as one of the shells it uses but if you do, here is the task properties to add it:
Also allows tabbed Consoles (including different types, cmd.exe, powershell etc). I've been using this since early Windows 7 and in those days it made the command line on Windows usable!
Like it has been written before:
Right Click on Bash on Ubuntu on Windows Icon if you have it on a Task Bar Shortcut Icon
Click on Properties
Select Options Tab on the Properties Window
Check the QuickEditMode option
Click Apply
Now you are able to open a new Bash Terminal and just use Right-Click to paste
In order to be able to copy from Terminal, Just use CTRL+M and this will enable you to select and copy selected Text.
For pasting into Vim in the terminal (bash on ubuntu on windows):
export DISPLAY=localhost:0.0
Not sure how to copy from Vim though :-(
Alternate solution over here, my windows home version Windows Subsystem Linux terminal doesn't have the property to use Shift+Ctrl (C|V)
Use an actual linux terminal]1
Install an X-server in Windows (like X-Ming)
sudo apt install <your_favorite_terminal>
export DISPLAY=:0
fire your terminal app, I tested with xfce4-terminal and gnome-terminal
windows #ubuntu #development
For just copying (possibly long) texts to the Windows clipboard, I have found that just piping the output to clip.exe (including the .exe file extension) works fine for me. So:
$ echo "Hello World" | clip.exe
lets me paste Hello World using Ctrl-V anywhere else.
Now that I have posted this, I notice that related question Pipe from clipboard in linux subsytem for windows includes this and a command solution for pasting from the Windows clipboard as well.
you might have bash but it is still a windows window manager. Highlite some text in the bash terminal window. Right click on the title bar, select "Edit", select "Copy", Now Right Click again on the Title bar, select "Edit" , Select "Paste", Done. You should be able to Highlite text, hit "Enter" then Control V but this seems to be broken
For autohotkey users, a full answer is:
#IfWinActive ahk_class ConsoleWindowClass
^+v::SendInput %clipboard%
Which checks that you're in a console (windows or ubuntu) before pasting from the windows clipboard.
That turned out to be pretty simple. I've got it occasionally. To paste a text you simply need to right mouse button click anywhere in terminal window.

a basic keystroke map

I downloaded AutoHotKey today and read the tutorial. What I want to do is have an F2 key do a shift-ctrl-S in one application. I cannot figure out how to do that by reading the tutorial. How can I do it?
Firstly, install autohotkey on your system.
Once installed, create a text file and save it as .ahk (rather than .txt).
Within the file, at the end, type the following code:
F2::Send +^s
Save the file then double click it to run the program.
This will change F2 to your shift-control-s in ALL applications.
To make it application-specific, when running, right click on the icon in the taskbar and choose "Windows Spy". Click into the application you want to use the F2 shortcut in and make a note of the line just below >>>>>>>>>>( Window Title & Class )<<<<<<<<<<<
Now, change your script to this:
#IfWinActive INSERTWindowsSpyWindowTitleHERE
F2::Send +^s
#IfWinActive
Obviously making sure to change INSERTWindowsSpyWindowTitleHERE to what you got from windows spy.
Save and run your script. Autohotkey will now only make F2 do that shortcut when the window (found via Windows spy) is active. (The last #IfWinActive is used to "reset" checking for that window in code below where this is typed - useful if you're going to type more autohotkey code in the future)

iTerm Emacs key codes for Ctrl + <Arrow Keys>

In Emacs on Linux terms and Cygwin, Ctrl + Up/Down causes a long jump (depending on the mode) say one function block down, on iTerm however this does not work I am assuming I need to manually set key codes send?
I guess you are using iTerm 2. Go to Preferences window in iTerm, and check both "Keys" tabs. One is in the main tabs and the second is for each profile. By default, in the "Keys" tab in your profile ^↑ are ^↓ are defined there to send some backward-compatible special keys. Remove them for your profile and you're good to go!
UPDATE: This change doesn't seem to affect your current tab or window. You may need to start a new iTerm window.
Use M-{ and M-} instead.

Resources