fzf matcher?
Closed this issue · 4 comments
jojojames commented
@jcs090218 This would be interesting to port to a native module, considering it's in C.
https://github.com/nvim-telescope/telescope-fzf-native.nvim/tree/main/src
jcs090218 commented
I think we could just compile it to native module since it's in C? I haven't tried that yet but I think it should be simple, we might need to find compiler(s) that could do the job for us.
jojojames commented
Yeah, I have never done a dynamic module before so I thought you'd be the expert on how to do this properly
jcs090218 commented
No worries. I can look into that in my spare time. ;)
dangduc commented
https://github.com/dangduc/fzf-native
Got the native module working with fussy:
(use-package fzf-native
:straight
(:repo "dangduc/fzf-native"
:host github
:files (:defaults "bin"))
:config
(fzf-native-load-dyn)
(setq fussy-score-fn 'fussy-fzf-native-score))
modified fussy.el
@@ -219,6 +219,7 @@ (defcustom fussy-fuz-use-skim-p t
:type 'boolean)
(defcustom fussy-score-fns-without-indices '(fussy-hotfuzz-score
+ fussy-fzf-native-score
fussy-sublime-fuzzy-score
fussy-liquidmetal-score)
"List of scoring functions that only returns the score.
@@ -775,6 +776,16 @@ (defun fussy-sublime-fuzzy-score (str query &rest _args)
(fussy--string-without-unencodeable-chars query)))
(list (sublime-fuzzy-score query str)))))
+(defun fussy-fzf-native-score (str query &rest _args)
+ "Score STR for QUERY using `fzf-native'."
+ (require 'fzf-native)
+ (when (fboundp 'fzf-native-score)
+ (let ((str
+ (fussy--string-without-unencodeable-chars str))
+ (query
+ (fussy--string-without-unencodeable-chars query)))
+ (list (fzf-native-score str query)))))
+
;; `hotfuzz' integration
(declare-function "hotfuzz--cost" "hotfuzz")