Fuzzy completion-at-point

I have just set up completion in v2 following the instructions here on the forums and by reading the v2 docs.

However, completion is still a little finicky. Here’s two things I can’t get working:

  1. When I type [[, I expected to see a list of all files but completion doesn’t do anything unless I type at least two or three characters.
  2. I have many files starting with an emoji or special symbols, such as 🛖 PhD.org and @author0000.org for hub notes and literature review notes respectively. I don’t want to need to input either symbol or emoji before I can get a match. Is there a way to enable fuzzy matching with company-mode?

Related to (2), sometimes I don’t remember the word in the beginning of a note but something in the middle, which means fuzzy matching would help in those cases as well.

Here’s my current setup function:

;; org-roam V2 testing, load manually
(defun my/org-roam-load ()
  (add-to-list 'load-path "/Users/rberaldo/.emacs.d/org-roam-v2/")
  (load-library "org-roam")
  (setq org-roam-directory (file-truename "/Users/rberaldo/org-roam/"))
  (setq org-roam-file-extensions '("org"))
  (define-key global-map (kbd "C-c r /") #'org-roam-node-find)
  (define-key global-map (kbd "C-c r c") #'org-roam-capture)
  (define-key global-map (kbd "C-c r i") #'org-roam-node-insert)
  (define-key global-map (kbd "C-c r r") #'org-roam-buffer-toggle)
  (define-key global-map (kbd "C-c r j") #'org-roam-dailies-capture-today)
  (smartparens-global-mode t)
  (add-hook 'after-init-hook 'global-company-mode)
  (setq company-minimum-prefix-length 2)
  (setq company-idle-delay 0.25)
  (add-to-list 'company-backends 'company-capf)
  (setq org-roam-completion-ignore-case t))

Thanks in advance!

For issue 1, have a look at this in your config.

For issue 2, it’s probably a matter of completion-style. I suggest to consider a package called Orderless — not in front of PC but it’s available on MELPA and good documentation in its GitHub repo.

1 Like

That’s what you get for copying config without thinking about it. :man_facepalming: Thanks, @nobiot!

I’ll have a look at that package, sounds like what I need.

I just wanted to follow up on this answer. Your suggestion was perfect. I feel now I can fully migrate from Obsidian – the only thing missing is the graph visualization, but hopefully that’s coming soon. Thank you!

1 Like