View the planets (#12)

* add planets viewer builtin

* Remove print statement

* Don't use fzf & echo

* Add all planets as files and refactor accordingly

* Remove planets.lua

* add the moon

* example ofe how to do this without ls everywhere

* fix rebase and update to new style

Co-authored-by: TJ DeVries <devries.timothyj@gmail.com>
This commit is contained in:
smolck
2020-09-06 22:07:51 -05:00
committed by GitHub
parent 675e240383
commit 2592586533
13 changed files with 414 additions and 0 deletions

View File

@@ -12,6 +12,7 @@ Previewer.__index = Previewer
local bat_options = " --style=grid --paging=always "
local previewer_ns = vim.api.nvim_create_namespace('telescope.previewers')
-- --terminal-width=%s
-- TODO: We shoudl make sure that all our terminals close all the way.
@@ -317,6 +318,21 @@ previewers.help = defaulter(function(_)
}
end, {})
previewers.planet_previewer = previewers.new {
preview_fn = function(self, entry, status)
local bufnr = vim.api.nvim_create_buf(false, true)
vim.api.nvim_win_set_buf(status.preview_win, bufnr)
local termopen_command = "bat " .. entry.value
-- HACK! Requires `termopen` to accept buffer argument.
vim.cmd(string.format("noautocmd call win_gotoid(%s)", status.preview_win))
vim.fn.termopen(termopen_command)
vim.cmd(string.format("noautocmd call win_gotoid(%s)", status.prompt_win))
end
}
previewers.Previewer = Previewer
return previewers