Emacs 有没有 package 实现像Apple Note一样在左边显示summary,在右边显示文件的搜索?就是这种:
就是有两个窗口,左边的显示所有包含关键字的文件的概括,右边显示文件内容。如图,我在搜索alba。
Emacs 有没有 package 实现像Apple Note一样在左边显示summary,在右边显示文件的搜索?就是这种:
就是有两个窗口,左边的显示所有包含关键字的文件的概括,右边显示文件内容。如图,我在搜索alba。
没明白你想表达什么?
修改了一下答案问题。
这不是类似于swiper的效果吗…
看起来 UI 好像 ranger 啊,不知道 ranger 有没有提供搜索功能。
swiper还是挺不一样的吧
maple-explorer可以快速实现一个类似的效果
(require 'maple-explorer-core)
(defgroup maple-explorer-search nil
"Display search results list in window side."
:group 'maple-explorer)
(defface maple-explorer-search-face
'((t (:inherit maple-explorer-face)))
"Default face for search.")
(defface maple-explorer-search-item-face
'((t (:inherit maple-explorer-item-face)))
"Default item face for search.")
(defvar maple-explorer-search-keyword nil)
(defun maple-explorer-search-group(item)
"Group ITEM."
(car (split-string item ":")))
(defun maple-explorer-search-info(item)
"Set ITEM list info."
(let* ((strs (split-string item ":"))
(file (car strs))
(line (cadr strs)))
(unless (string= file "")
(list :name (string-join (cdr strs) ":")
:face 'maple-explorer-search-item-face
:click 'maple-explorer-search-click
:value (cons file (string-to-number line))))))
(defun maple-explorer-search-list(&optional isroot)
"Get ISROOT."
(maple-explorer-list
(split-string (shell-command-to-string (format "ag %s" maple-explorer-search-keyword)) "\n")
'maple-explorer-search-face
'maple-explorer-search-info maple-explorer-search-filter-function maple-explorer-search-group-function))
(defun maple-explorer-search-click(&optional point)
"Open buffer on POINT."
(interactive)
(let* ((info (button-get (button-at (or point (point))) 'maple-explorer))
(value (plist-get info :value)))
(select-window (get-mru-window))
(find-file (car value))
(goto-line (cdr value))))
(defun maple-explorer-search--finish()
"Run when close."
(setq maple-explorer-search-keyword nil))
(maple-explorer-define search
(setq maple-explorer-search-group-function 'maple-explorer-search-group)
(add-hook 'maple-explorer-search-finish-hook 'maple-explorer-search--finish))
(setq maple-explorer-search-display-alist '((side . left) (slot . -1)))
(defun my-search(keyword)
(interactive (list (read-from-minibuffer "Search: ")))
(if (< (length keyword) 3)
(message "keyword's legnth must > 2")
(setq maple-explorer-search-keyword keyword)
(maple-explorer-search)))
(provide 'maple-explorer-search)