Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

New answers tagged


You do have to be a bit careful with the terminology. Each buffer has a single "local keymap", and therefore it's sensible to avoid using that terminology to refer to other keymaps. current-local-map is a built-in function in `C source code'. (current-local-map) Return current buffer's local keymap, or nil if it has none. Normally the local keymap is set ...


I'm familiar with C-c and with C-h, but I can't figure out what the @ means. It's the literal character @ for which your keyboard should have a key (or key sequence). On my keyboard @ is Shift+2. So just type Ctrl+C and then type @ Conceptually it's no different to being told to type C-c a (for example).


@ doesn't mean anything, by itself, beside representing the @ key on your keyboard. The key sequence C-c @ C-h is bound to command hs-hide-block in hs-minor-mode, that is, in keymap hs-minor-mode-map. In that key sequence, C-c is a prefix key, which means it's bound to a keymap. In that keymap, @ is a prefix key, which means it's bound to a keymap. In that ...


you can achieve this with evil-swap-keys.el (which is not tied to evil): (global-evil-swap-keys-mode) (add-hook 'python-mode-hook #'evil-swap-keys-swap-underscore-dash)


What I actually implemented is a modification of @JeanPierre's solution: (defun my-remap-dash-and-underscore () (interactive) (define-key python-mode-map "-" #'(lambda () (interactive) (insert "_"))) (define-key python-mode-map "_" #'(lambda () (interactive) (insert "-")))) (defun my-undo-remap-dash-and-underscore () (interactive) (define-key ...


You can simply map the keys - and _ to do what you want in python mode: (defun insert-underscore () "Guess what!" (interactive) (insert "_")) (defun insert-hyphen () "You know it!" (interactive) (insert "-")) (defun python-remap-hyphen-and-underscore () (define-key python-mode-map "-" 'insert-underscore) (define-key python-mode-map "_" '...

Top 50 recent answers are included