Skip to content
This repository was archived by the owner on Aug 23, 2025. It is now read-only.
This repository was archived by the owner on Aug 23, 2025. It is now read-only.

Bind two commands with one key to toggle between them for the same company local keymap and simplify the local-keymaps binding. #959

@hongyi-zhao

Description

@hongyi-zhao

I've the following binding-within-local-keymaps configuration for company package:

(use-package company
 :bind
 (:map company-active-map
        ("<tab>" . company-search-candidates)
	("<f1>" . company-search-abort)
	("SPC" . company-complete-selection)
	("<return>" . company-abort)

	:map company-search-map
	("<tab>" . company-search-candidates)
	("<f1>" . company-search-abort)
	("SPC" . company-complete-selection)
	("<return>" . company-abort))
))

As far as the above configuration is concerned, I have the following questions:

  1. As you can see, they are simply repeat bindings for different local-keymaps. I wonder if I can merge them for simplicity.
  2. OTOH, with the above configuration, <tab> and <f1> will call the corresponding interactive Lisp closure correctly, but I have to use two different keys. So, I want to bind these two commands to one key, say, <tab>, to toggle between them. Any hints for achieving this aim?

See here and here for some relevant discussions.

Regards,
HZ

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions