Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Defining key binding with arguments

Tags:

emacs

elisp

I want to map C-f C-b as moving forward and backward by a fixed amount of lines in a file.

I did this:

(global-set-key (kbd "C-f") 'next-line)
(global-set-key (kbd "C-b") 'previous-line)

but I don't know how to specify an argument before the next-line command. I guess I should use digit-argument but I am unable to write the command in a correct way.

like image 721
igon Avatar asked Feb 11 '13 02:02

igon


People also ask

How do you bind keystrokes?

To reassign a keyConnect the keyboard that you want to configure. Select the Start button, and then select Microsoft Mouse and Keyboard Center. From the displayed list of key names, select the key that you want to reassign. In the command list of the key that you want to reassign, select a command.

How do I change key bindings in Sublime Text?

Users can customize their key bindings by creating a file named Default. sublime-keymap in their Packages/User/ directory. For example, the following will create a key binding to show unsaved changes, if any exist, via Ctrl+Shift+`.

What does bind key mean?

A key binding is an association between a physical key on a keyboard and a parameter. A parameter can have any number of key bindings associated with it, and a particular key binding can control any number of parameters. Key bindings detects individual keys being pressed.

What is sublime text keymap?

Key bindings in Sublime Text helps a user to process and map the sequences of key presses to actions. They are defined in the JSON format and are stored in . sublime-keymap files. For better integration, it is important to keep separate key map files for Linux, OSX and Windows.


1 Answers

You've changed your question to be about how to bind directly to key sequences

This binds C-c l to C-u 5 C-n

(global-set-key (kbd "C-c l") (kbd "C-u 5 C-n"))
like image 85
event_jr Avatar answered Sep 28 '22 10:09

event_jr