2

C-c n f is bound to org-roam-node-find in my setup.

I can search existing nodes or create a new one if it does not exist yet. Assume that there still is a node with the title Foobar in summer and I want to create a new node with title summer.

This is not possible because when I type summer (after C-c n f) the existing node Foobar in summer is pre selected. When I hit ENTER the existing node opens in a new buffer instead of a new created node (capture buffer?) with title summer.

How can I create a new node preventing preselection of existing nodes?

Here is a minimal init.el and a screen recording:

;; -*- lexical-binding: t; -*-

;; === Package setup ===
(require 'package)

(setq package-archives '(("melpa" . "https://melpa.org/packages/")
             ("org" . "https://orgmode.org/elpa/")
             ("elpa" . "https://elpa.gnu.org/packages/")))
;; Initializes the package infrastructure
(package-initialize)

;; === use-package ==
;; use-package to simplify the config file
(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))

(require 'use-package)
(setq use-package-always-ensure 't)

;; === Improved search field
; M-o opens "context menu" of a search item
(use-package ivy
  :diminish
  :bind (("C-s" . swiper))
  :config
  (ivy-mode 1))

;; === Add docstring column to function search results
(use-package ivy-rich
    :init
    (ivy-rich-mode 1))

(use-package org-roam
  :init  ; is called before the package is loaded
  (setq org-roam-v2-ack t)  ; do not show migration warning after startup
  :custom
  (org-roam-directory "~/tab-cloud/my.org-roam")
  :bind (("C-c n l" . org-roam-buffer-toggle)
     ("C-c n f" . org-roam-node-find)
     ("C-c n i" . org-roam-node-insert)
     )
  :config
  (org-roam-db-autosync-mode)
  )

enter image description here

1
  • 1
    I can't reproduce that: I can enter summer even if it shows Foobar in summer in the completions list. OTOH, I cannot enter a space in the title (although I can modify it after the fact).
    – NickD
    Commented Feb 8, 2022 at 2:24

2 Answers 2

6
+100

For common completion frameworks (e.g. ivy, vertico), <enter> is used to select candidates.

For vertico, your case requires M-<return> (vertico-exit-input).

For ivy, it is C-M-j (ivy-immediate-done).

The corresponding function of other completion frameworks can be found in the keymap or README.

2
  • For vertico, it seems that vertico-exit-input changed to M-return. Commented Oct 20, 2022 at 4:33
  • Thank @ElDiegoEfe for pointing this out, I will update my answer. Commented Oct 20, 2022 at 7:10
0

Alternatively, the prompt line can be made selectable with (setq ivy-use-selectable-prompt t).

Solution based on: https://org-roam.discourse.group/t/create-new-org-roam-node-ignoring-pre-selected-existing-nodes/2448?u=2meufy0iakxhveq31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.