From 8c11a360c6d4eb252fa93281840d6451e8a9001f Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Thu, 16 Jun 2022 23:38:10 +0800 Subject: [PATCH] feat(lua): add lua layer modular --- lua/spacevim/layer.lua | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lua/spacevim/layer.lua b/lua/spacevim/layer.lua index 677926024..5e3e58401 100644 --- a/lua/spacevim/layer.lua +++ b/lua/spacevim/layer.lua @@ -28,5 +28,24 @@ function M.isLoaded(layer) return sp.call('SpaceVim#layers#isLoaded', layer) == 1 end +local function list_layers() + vim.cmd('tabnew SpaceVimLayers') + vim.cmd('nnoremap q :q') + vim.cmd('setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline nospell') + vim.cmd('setf SpaceVimLayerManager') + vim.cmd('nnoremap q :bd') + local info = {'SpaceVim layers:', ''} + -- call setline(1,info + s:find_layers()) + vim.cmd('setl nomodifiable') +end + + +function M.load(layer, ...) + if layer == '-l' then + list_layers() + return + end +end + return M