Created
June 23, 2017 15:01
-
-
Save Alexander-Miller/1ca7ccc9a53754084c998662824c86ab to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; -*- lexical-binding: t -*- | |
(require 'dash) | |
(require 's) | |
(require 'company) | |
(defun rofi-filter (proc msg) | |
(backward-delete-char (length company-prefix)) | |
(insert (s-trim msg))) | |
(defun rofi-complete () | |
(interactive) | |
(company-complete) | |
(when company-candidates | |
(let ((rofi | |
(make-process | |
:command (list "rofi" "-dmenu") | |
:name "Rofi Complete" | |
:filter #'rofi-filter))) | |
(unwind-protect | |
(progn | |
(dolist (buffer (-partition-all 50 company-candidates)) | |
(--each buffer | |
(when (process-live-p rofi) | |
(process-send-string rofi (concat it "\n"))))) | |
(when (process-live-p rofi) (accept-process-output rofi nil nil t))) | |
(when (process-live-p rofi) (kill-process rofi)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment