snailed
/
taolf
Archived
2
0
Fork 0

update(plugin): .vim -> .lua

This commit is contained in:
Lucas Burns 2022-04-13 20:07:45 -05:00
parent dd04d5f0e9
commit 3fb8dee0f3
No known key found for this signature in database
GPG Key ID: C011CBEF6628B679
2 changed files with 73 additions and 13 deletions

63
plugin/lf.lua Normal file
View File

@ -0,0 +1,63 @@
local M = {}
local api = vim.api
local uv = vim.loop
local debounce = require("lf.debounce")
api.nvim_create_user_command(
"Lf",
function(fargs)
require("lf").start(fargs)
end,
{nargs = "*", complete = "file"}
)
if g.lf_replace_netrw then
local Path = require("plenary.path")
local group = api.nvim_create_augroup("ReplaceNetrwWithLf", {clear = true})
api.nvim_create_autocmd(
"VimEnter",
{
pattern = "*",
group = group,
command = [[sil! au! FileExplorer]]
}
)
-- api.nvim_create_autocmd(
-- "BufEnter",
-- {
-- pattern = "*",
-- group = group,
-- callback = function()
-- local path = Path:new(fn.expand("%"))
-- if path:is_dir() then
-- vim.cmd("bdelete!")
--
-- -- local timer = uv.new_timer()
-- -- timer:start(
-- -- 100,
-- -- 0,
-- -- vim.schedule_wrap(
-- -- function()
-- -- -- p(path:absolute())
-- -- require("lf").start(path:absolute())
-- -- end
-- -- )
-- -- )
--
-- vim.defer_fn(
-- function()
-- p(path:absolute())
-- -- require("lf").start(path:absolute())
-- end,
-- 100
-- )
-- end
-- end
-- }
-- )
end
return M

View File

@ -1,15 +1,12 @@
command! -nargs=* -complete=file Lfnvim lua require('lf').start(<f-args>)
" TODO: Finish this command
" command! -nargs=* -complete=file Lfnvim lua require('lf').start(<f-args>)
" command! -nargs=* -complete=file LfToggle lua require('lf').setup():toggle(<f-args>)
if exists('g:lf_replace_netrw') && g:lf_replace_netrw
augroup ReplaceNetrwWithLf
autocmd VimEnter * silent! autocmd! FileExplorer
autocmd BufEnter * let s:buf_path = expand("%")
\ | if isdirectory(s:buf_path)
\ | bdelete!
\ | call timer_start(100, {->v:lua.require'lf'.start(s:buf_path)})
\ | endif
augroup END
endif
" if exists('g:lf_replace_netrw') && g:lf_replace_netrw
" augroup ReplaceNetrwWithLf
" autocmd BufEnter * let s:buf_path = expand("%")
" \ | if isdirectory(s:buf_path)
" \ | bdelete!
" \ | call timer_start(100, {->lua require'lf'.start(s:buf_path)})
" \ | endif
" augroup END
" endif