diff options
Diffstat (limited to 'hm/soispha/conf/nvim/plgs/telescope')
-rw-r--r-- | hm/soispha/conf/nvim/plgs/telescope/extensions/rooter/lua/rooter.lua | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/hm/soispha/conf/nvim/plgs/telescope/extensions/rooter/lua/rooter.lua b/hm/soispha/conf/nvim/plgs/telescope/extensions/rooter/lua/rooter.lua index eaf68ecf..7235c5a3 100644 --- a/hm/soispha/conf/nvim/plgs/telescope/extensions/rooter/lua/rooter.lua +++ b/hm/soispha/conf/nvim/plgs/telescope/extensions/rooter/lua/rooter.lua @@ -11,7 +11,7 @@ if not has_plenary then return end -local log = plenary.log.new({ plugin = "telescope_rooter"; level = "info"; }) +local log = plenary.log.new({ plugin = "telescope_rooter", level = "info" }) -- TODO: expose this function local toggle = function(_) @@ -19,19 +19,19 @@ local toggle = function(_) print("Telescope#rooter#enabled=" .. vim.inspect(vim.g["Telescope#rooter#enabled"])) end -local config = { patterns = { ".git"; }; enable = true; debug = false; } +local config = { patterns = { ".git" }, enable = true, debug = false } -- default enabled vim.g["Telescope#rooter#enabled"] = vim.F.if_nil(config.enable, true) -- redefine log if debug enabled if vim.F.if_nil(config.debug, false) then - log = plenary.log.new({ plugin = "telescope_rooter"; level = "debug"; }) + log = plenary.log.new({ plugin = "telescope_rooter", level = "debug" }) end -local group = vim.api.nvim_create_augroup("TelescopeRooter", { clear = true; }) +local group = vim.api.nvim_create_augroup("TelescopeRooter", { clear = true }) -vim.api.nvim_create_autocmd({ "DirChangedPre"; }, { +vim.api.nvim_create_autocmd({ "DirChangedPre" }, { callback = function() if vim.g["Telescope#rooter#enabled"] ~= true then return @@ -41,11 +41,11 @@ vim.api.nvim_create_autocmd({ "DirChangedPre"; }, { vim.g["Telescope#rooter#oldpwd"] = vim.loop.cwd() log.debug("before " .. vim.inspect(vim.loop.cwd())) end - end; - group = group; + end, + group = group, }) -vim.api.nvim_create_autocmd({ "BufEnter"; "BufWinEnter"; }, { +vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, { callback = function() if vim.g["Telescope#rooter#enabled"] ~= true then return @@ -53,18 +53,18 @@ vim.api.nvim_create_autocmd({ "BufEnter"; "BufWinEnter"; }, { vim.schedule(function() if vim.bo.filetype == "TelescopePrompt" then - local rootdir = vim.fs.dirname(vim.fs.find(config.patterns, { upward = true; })[1]) + local rootdir = vim.fs.dirname(vim.fs.find(config.patterns, { upward = true })[1]) if rootdir ~= nil then vim.api.nvim_set_current_dir(rootdir) log.debug("changing dir to " .. rootdir) end end end) - end; - group = group; + end, + group = group, }) -vim.api.nvim_create_autocmd({ "BufWinLeave"; }, { +vim.api.nvim_create_autocmd({ "BufWinLeave" }, { callback = function() if vim.g["Telescope#rooter#enabled"] ~= true then return @@ -79,6 +79,6 @@ vim.api.nvim_create_autocmd({ "BufWinLeave"; }, { end end end) - end; - group = group; + end, + group = group, }) |