key-bindings

How to turn off alternative Enter with Ctrl+M in Linux

99封情书 提交于 2019-12-02 23:12:24
Why is Ctrl+M bound to Enter in Ubuntu Jaunty? How to turn it off? I'm using Emacs and would like to bind Ctrl+M to some other command. Eric Warmenhoven I think your question is backwards. It is not C-m that is bound to Enter , it is Enter that is bound to C-m . And C-m is the same as RET . If you run C-h k C-m , you will see something like " RET runs the command ... ". C-m sends RET because it is a control code, see http://en.wikipedia.org/wiki/Control_character . The Enter key is bound to C-m ; if you run C-h k Enter , you will see something like " RET (translated from <return>) runs the

In vim, why is 'j' used for down and 'k' for up?

萝らか妹 提交于 2019-12-02 21:34:10
I've been using vim for many years and have never really thought about it. A friend of mine asked why that is, noting that in our culture, left would usually map to up while right would map to down, making the vim keys backwards. I understand that they are on the home row, meaning that you do not have to move your fingers anywhere to hit them, but that's a different point altogether. Basically, my question is: does anyone know why these keys were given their present purposes? It would be great if you could point me to some documentation on the decision as well. The answer is in the wikipedia

Set custom keybinding for specific Emacs mode

做~自己de王妃 提交于 2019-12-02 16:35:46
Though I know how to set a global key-binding in Emacs, I find it hard to even Google out the code for a local (minor-mode specific) key-binding. For instance, I have this code in my .emacs : ;; PDFLaTeX from AucTeX (global-set-key (kbd "C-c M-p") (lambda () (interactive) (shell-command (concat "pdflatex " buffer-file-name)))) I don't want to set it globally. Is there a function like local-set-key ? Rémi To bind a key in a mode, you need to wait for the mode to be loaded before defining the key. One could require the mode, or use eval-after-load (eval-after-load 'latex '(define-key LaTeX-mode

Binding a function to a key is not working

梦想与她 提交于 2019-12-02 11:46:28
My code: import tkinter master = tkinter.Tk() master.title("test1") master.geometry("300x300") masterFrame = tkinter.Frame(master) masterFrame.pack(fill=tkinter.X) checkboxArea = tkinter.Frame(masterFrame, height=26) checkboxArea.pack(fill=tkinter.X) inputStuff = tkinter.Frame(masterFrame) checkboxList = [] def drawCheckbox(): checkboxList.append(entry.get()) entry.delete(0,tkinter.END) checkboxRow = tkinter.Frame(checkboxArea) checkboxRow.pack(fill=tkinter.X) checkbox1 = tkinter.Checkbutton(checkboxRow, text = checkboxList[-1]) checkbox1.pack(side=tkinter.LEFT) deleteItem = tkinter.Button

Change ENTER Key function

佐手、 提交于 2019-12-02 10:56:08
问题 I wanted to change the default action of the ENTER key on JTable , so I used this code: table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) .put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "Enter"); table.getActionMap().put("Enter", new AbstractAction() { private static final long serialVersionUID = 1L; public void actionPerformed(ActionEvent ae) { //my action } } Tt works normally. What I want now is to change the row just after my action. In other words, execute the default

Java: Moving an object at an angle and changing angle with KeyPress

三世轮回 提交于 2019-12-02 10:02:24
问题 Ok, so what i want is the rectangle to always be moving, but when you press the left and right arrow is changes the direction by either increasing or decreasing the angle. With this code the sqaure moves as it should in the correct direction, but when i press the keys the direction does not change. import java.awt.*; import java.awt.Color; import javax.swing.Timer; import javax.swing.*; import java.awt.Graphics; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import

Make SHIFT+3 produce `#` not `£` on OSX by code

不想你离开。 提交于 2019-12-02 08:54:45
On my UK MacBook Air, # can be typed using OPT+3. SHIFT+3 currently produces £ . How can I rewire so that SHIFT+3 produces # ? This question is motivated by https://apple.stackexchange.com/questions/156154/use-option-as-meta-key-with-ability-to-type-the-symbol I think it's a failing that the default setting on OSX's Terminal app doesn't register OPT (which is needed e.g. for keyboard shortcuts in the nano editor), and that if you switch the setting to enable it, you are now unable to type # , which is generally done by OPT+3. I frequently need # while editing configuration files on my remote

How to record a pressed key combination in the PyQT5 dialog window

妖精的绣舞 提交于 2019-12-02 07:15:36
I open the dialog from the main window, where by clamping the keys, I fill the line with their names. The problem is that I can not understand where you need to do a cycle of checking all the keys on their state. Maybe there is another way to get the keys pressed? Or where you need to listen to the clamping so that the dialog box does not hang and the string is updated. MainWindow: def showBindings(self, param): from dialogs import KeyBindingsDialog self.dialog = KeyBindingsDialog() self.dialog.show() Dialog: class KeyBindingsDialog(QtWidgets.QDialog): def __init__(self, parent=None): super

How do I prevent arrow key press in JTextField from scrolling JScrollPane?

余生颓废 提交于 2019-12-02 06:28:57
问题 I'd like to add a custom arrow key listener for my JTextField . But looks like the arrow keys are bound to the JScrollPane on which I put my text field. How do I unbind them? 回答1: You could try replacing the key bindings on the scroll pane, but it might make sense to keep them to allow the user to scroll the pane when they are not focused in your text field. Instead, you can add key bindings to the text field that do nothing, which will consume the event and prevent them from begin sent to

Change ENTER Key function

拥有回忆 提交于 2019-12-02 06:22:12
I wanted to change the default action of the ENTER key on JTable , so I used this code: table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) .put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "Enter"); table.getActionMap().put("Enter", new AbstractAction() { private static final long serialVersionUID = 1L; public void actionPerformed(ActionEvent ae) { //my action } } Tt works normally. What I want now is to change the row just after my action. In other words, execute the default action of the enter key. trashgod The default Action for the ENTER key is "selectNextRowCell" . As shown