{"id":25047977,"url":"https://github.com/dangduc/fzf-native","last_synced_at":"2025-04-14T04:33:36.073Z","repository":{"id":37042110,"uuid":"498617570","full_name":"dangduc/fzf-native","owner":"dangduc","description":"Emacs package for fuzzy match scoring","archived":false,"fork":false,"pushed_at":"2024-12-24T18:12:35.000Z","size":1268,"stargazers_count":18,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-27T18:22:10.534Z","etag":null,"topics":["building-block","c99","emacs","emacs-lisp","emacs-package","fuzzy","fuzzy-matching","native"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dangduc.png","metadata":{"files":{"readme":"README.org","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-06-01T06:30:01.000Z","updated_at":"2025-03-25T12:06:34.000Z","dependencies_parsed_at":"2024-12-24T19:33:39.282Z","dependency_job_id":null,"html_url":"https://github.com/dangduc/fzf-native","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dangduc%2Ffzf-native","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dangduc%2Ffzf-native/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dangduc%2Ffzf-native/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dangduc%2Ffzf-native/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dangduc","download_url":"https://codeload.github.com/dangduc/fzf-native/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248822664,"owners_count":21167094,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["building-block","c99","emacs","emacs-lisp","emacs-package","fuzzy","fuzzy-matching","native"],"created_at":"2025-02-06T07:29:38.184Z","updated_at":"2025-04-14T04:33:36.038Z","avatar_url":"https://github.com/dangduc.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"#+TITLE: fzf-native\n#+STARTUP: noindent\n\n[[https://github.com/dangduc/fzf-native/actions/workflows/test.yaml][https://github.com/dangduc/fzf-native/actions/workflows/test.yaml/badge.svg]]\n[[https://github.com/dangduc/fzf-native/actions/workflows/cmake.yaml][https://github.com/dangduc/fzf-native/actions/workflows/cmake.yaml/badge.svg]]\n[[https://github.com/dangduc/fzf-native/actions/workflows/format.yaml][https://github.com/dangduc/fzf-native/actions/workflows/format.yaml/badge.svg]]\n\nThis is a package that provides fuzzy match scoring based on the fzf\nalgorithm by [[https://github.com/junegunn][junegunn]]. The main\ncontribution is a wrapper over the C implementation of fzf from the\nproject\n[[https://github.com/nvim-telescope/telescope-fzf-native.nvim][telescope-fzf-native.nvim]].\nElisp functions for scoring are exported through an Emacs dynamic\nmodule.\n\nThis package /does one thing/ -- For a given STR and QUERY compute\nand return a score and matching indices. If you're looking for a fuzzy\nauto-completion engine, see the Use Cases section for how this package\ncan be used in a ~completion-style~.\n\n#+begin_src emacs-lisp\n;; Example of basic usage\n(fzf-native-score \"Hot-Topic\" \"hp\")\n;; (41 0 6)\n#+end_src\n\n#+begin_src emacs-lisp\n;; Example of no match\n(fzf-native-score \"Hot-Topic\" \"2\")\n;; (0)\n#+end_src\n\n#+begin_src emacs-lisp\n;; Example of slab re-use\n(let ((slab (fzf-native-make-default-slab)))\n  (fzf-native-score \"Hello World\" \"er\" slab)\n  (fzf-native-score \"Example of slab re-use\" \"xu\" slab))\n;; (24 1 19)\n#+end_src\n\nSee [[fzf-native-test.el][test cases]] for more examples.\n\n** Supported Platforms\n\nLinux, macOS (incl. Apple silicon), and Windows are supported.\nPre-built shared libraries are in the [[bin][bin/]] directory.\n\n** Installation\n\n*** MELPA\n\nNot yet on MELPA.\n\n*** Manually\n\nClone / download this repository and modify your ~load-path~:\n\n#+begin_src emacs-lisp\n(add-to-list 'load-path (expand-file-name \"/path/to/fzf-native/\" user-emacs-directory))\n#+end_src\n\n*** Straight Examples\n\n#+begin_src emacs-lisp\n; Configuration that builds dynamic module locally.\n(use-package fzf-native\n  :straight\n  (:repo \"dangduc/fzf-native\"\n   :host github\n   :files (:defaults \"*.c\" \"*.h\" \"*.txt\"))\n  :init\n  (setq fzf-native-always-compile-module t)\n  :config\n  (fzf-native-load-own-build-dyn))\n#+end_src\n\n#+begin_src emacs-lisp\n; Configuration that uses pre-built dynamic module.\n(use-package fzf-native\n  :straight\n  (:repo \"dangduc/fzf-native\"\n   :host github\n   :files (:defaults \"bin\"))\n  :config\n  (fzf-native-load-dyn))\n#+end_src\n\n*** Multibyte character support\n\nWork around the lib's lack of support for multibyte chars. Add this\nadvice if you want accurate indices for multibyte chars.  Don't add\nthis advice if you want better run time performance or you don't need\naccurate indices for multibyte chars.\n\n#+begin_src emacs-lisp\n(advice-add 'fzf-native-score :around #'fzf-native--fix-score-indices)\n#+end_src\n\n** Use Cases\n\n[[https://github.com/jojojames/fussy][Fussy]]: ~fzf-native~ is used as\none of several choose-your-own scoring backends in ~fussy~, a package\nthat provides a ~completing-style~ for intelligent matching and\nsorting.\n\n** Building the Native Libraries\n\n#+begin_src bash\nmkdir build \u0026\u0026 cmake -B build -DCMAKE_C_FLAGS='-O3 -march=native' \u0026\u0026 cmake --build build\n#+end_src\n\n** Debugging fzf-native with emacs/lldb (EXAMPLE)\n*** Building Emacs\n#+begin_src shell :tangle yes\ncd Code/emacs\nbrew install autoconf automake pkg-config ncurses gnutls libjpeg libgif libtiff libxpm libx11 libxt libxml2\nautoreconf -isvf\n./autogen.sh\n./configure CFLAGS=\"-g -O0\" LDFLAGS=\"-g\" --with-ns\nmake bootstrap\n#+end_src :tangle yes\n*** Building fzf-native\n#+begin_src shell :tangle yes\n$ pwd\n~/.emacs.d/packages/emacs_31/elpaca/repos/fzf-native\n$ rm -Rf build; mkdir build \u0026\u0026 cmake -B build -DCMAKE_C_FLAGS='-O0 -g -march=native' \u0026\u0026 cmake --build build\n#+end_src\n*** From LLDB\n#+begin_src shell :tangle yes\n$ pwd\n~/Code/emacs/src\n$ lldb --local-lldbinit ./emacs\n#+end_src\n*** From Emacs\nRefer to https://github.com/svaante/dape?tab=readme-ov-file#c-c-and-rust---lldb-dap\non how to install LLDB-dap.\n\n#+begin_src sh :tangle yes\n$ brew install llvm\n($(brew --prefix --installed llvm)/bin)  # PREPEND (OSX already has a binary on $PATH) to $PATH.\n#+end_src\n\n#+begin_src emacs-lisp :tangle yes\n(use-package dape\n  :init\n  ;; Enable repeat mode for more ergonomic `dape' use\n  (use-package repeat\n    :ensure nil\n    :config\n    (repeat-mode))\n  :config\n  (push\n   '(lldb-dap\n     modes (c-mode c-ts-mode c++-mode c++-ts-mode)\n     command \"lldb-dap\"\n     command-args [\"--local-lldbinit\"]\n     ensure dape-ensure-command\n     :type \"lldb-dap\"\n     :cwd \"/Users/james/Code/emacs/src\"\n     :program \"/Users/james/Code/emacs/src/emacs\")\n   dape-configs)\n  ;; Turn on global bindings for setting breakpoints with mouse\n  (dape-breakpoint-global-mode)\n  ;; Info buffers to the right\n  (setq dape-buffer-window-arrangement 'right)\n  ;; Info buffers like gud (gdb-mi)\n  (setq dape-buffer-window-arrangement 'gud)\n  (setq dape-info-hide-mode-line nil)\n  ;; Pulse source line (performance hit)\n  (add-hook 'dape-display-source-hook 'pulse-momentary-highlight-one-line)\n  ;; Showing inlay hints\n  (setq dape-inlay-hints t)\n  ;; Save buffers on startup, useful for interpreted languages\n  (add-hook 'dape-start-hook (lambda () (save-some-buffers t t)))\n  ;; Kill compile buffer on build success\n  (add-hook 'dape-compile-hook 'kill-buffer)\n  ;; Projectile users\n  (setq dape-cwd-fn 'projectile-project-root))\n\n;; M-x dape in fzf-native-module.c\n;; Set breakpoints with mouse.\n#+end_src\n\n** Credit\nAll credit for fzf.c goes to the\n[[https://github.com/nvim-telescope/telescope-fzf-native.nvim][telescope-fzf-native.nvim]]\nproject. Much credit for Emacs module binding code goes to the\n[[https://github.com/axelf4/hotfuzz][hotfuzz]] project.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdangduc%2Ffzf-native","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdangduc%2Ffzf-native","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdangduc%2Ffzf-native/lists"}