Created
June 20, 2021 14:52
-
-
Save zetashift/7f093fc9baf71f6e215c8f6d42e62760 to your computer and use it in GitHub Desktop.
Snap & fennel
This file contains 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
(module magic.plugin.snap | |
{autoload {snap snap}}) | |
(let [fzf (snap.get :consumer.fzf) | |
limit (snap.get :consumer.limit) | |
producer-file (snap.get :producer.ripgrep.file) | |
producer-jumplist (snap.get :producer.vim.jumplist) | |
producer-git (snap.get :producer.git.file) | |
producer-luv-file (snap.get :producer.luv.file) | |
producer-vimgrep (snap.get :producer.ripgrep.vimgrep) | |
producer-buffer (snap.get :producer.vim.buffer) | |
producer-currentbuffer (snap.get :producer.vim.currentbuffer) | |
producer-oldfile (snap.get :producer.vim.oldfile) | |
select-file (snap.get :select.file) | |
select-jumplist (snap.get :select.jumplist) | |
select-vimgrep (snap.get :select.vimgrep) | |
select-currentbuffer (snap.get :select.currentbuffer) | |
preview-file (snap.get :preview.file) | |
preview-vimgrep (snap.get :preview.vimgrep) | |
preview-jumplist (snap.get :preview.jumplist)] | |
;; Find file | |
(snap.register.map [:n] | |
[:<Leader><Leader>] | |
(fn []) | |
(snap.run {:prompt :Files | |
:producer (fzf producer-file) | |
:select select-file.select | |
:multiselect select-file.multiselect | |
:views [preview-file]})) | |
;; Find through git files | |
(snap.register.map [:n] | |
[:<Leader>fg] | |
(fn [] | |
(snap.run {:prompt :Git | |
:producer (fzf producer-git) | |
:select select-file.select | |
:multiselect select-file.multiselect | |
:views [preview-file]}))) | |
;; Grep through files | |
(snap.register.map [:n] | |
[:<Leader>ff] | |
(fn [] | |
(snap.run {:prompt "Find Files" | |
:producer (limit 50000 producer-vimgrep) | |
:select select-vimgrep.select | |
:multiselect select-vimgrep.multiselect | |
:views [preview-vimgrep]}))) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment