about summary refs log tree commit diff stats
path: root/home-manager/soispha/config/neovim/nixvim/plugins/telescope
diff options
context:
space:
mode:
authorSoispha <soispha@vhack.eu>2023-08-26 22:52:12 +0200
committerSoispha <soispha@vhack.eu>2023-08-26 22:56:09 +0200
commit4c743a2afb87994be4ff7c2dc76d21c70d31e4de (patch)
tree70922dd5db390641da012085bc674333b53d2ef1 /home-manager/soispha/config/neovim/nixvim/plugins/telescope
parentFix(hm/conf/neovim/plugins/colorscheme): Mk todo,fix,&c comments visible (diff)
downloadnixos-config-4c743a2afb87994be4ff7c2dc76d21c70d31e4de.zip
Style(treewide): Format all lua-files makes lua ➛ nix easier
The files were formatted according to the `.editorconfig` file and with
the formatter from [this](1) repo, as it's the only one that fully
understands all keys in the `.editorconfig` file.

The formatting was chosen in this special (and honestly unconventional)
way because moving code from lua to nix is now easier, as the syntax is
nearly identical in some places.
Diffstat (limited to '')
-rw-r--r--home-manager/soispha/config/neovim/nixvim/plugins/telescope/extensions/rooter/lua/rooter.lua106
1 files changed, 53 insertions, 53 deletions
diff --git a/home-manager/soispha/config/neovim/nixvim/plugins/telescope/extensions/rooter/lua/rooter.lua b/home-manager/soispha/config/neovim/nixvim/plugins/telescope/extensions/rooter/lua/rooter.lua
index 1d66931b..eaf68ecf 100644
--- a/home-manager/soispha/config/neovim/nixvim/plugins/telescope/extensions/rooter/lua/rooter.lua
+++ b/home-manager/soispha/config/neovim/nixvim/plugins/telescope/extensions/rooter/lua/rooter.lua
@@ -1,84 +1,84 @@
 -- Taken from: https://github.com/desdic/telescope-rooter.nvim/blob/69423216c75a5f1f1477bbf8faf6b0dc8af04099/lua/telescope/_extensions/rooter.lua
-
 local has_telescope, telescope = pcall(require, "telescope")
 if not has_telescope then
-    error("This extension requires telescope.nvim")
-    return
+  error("This extension requires telescope.nvim")
+  return
 end
 
 local has_plenary, plenary = pcall(require, "plenary")
 if not has_plenary then
-    error("This extension requires plenary")
-    return
+  error("This extension requires plenary")
+  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(_)
-    vim.g["Telescope#rooter#enabled"] = not vim.g["Telescope#rooter#enabled"]
-    print("Telescope#rooter#enabled=" ..
-        vim.inspect(vim.g["Telescope#rooter#enabled"]))
+  vim.g["Telescope#rooter#enabled"] = not vim.g["Telescope#rooter#enabled"]
+  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" }, {
-    callback = function()
-        if vim.g["Telescope#rooter#enabled"] ~= true then return end
+vim.api.nvim_create_autocmd({ "DirChangedPre"; }, {
+  callback = function()
+    if vim.g["Telescope#rooter#enabled"] ~= true then
+      return
+    end
 
-        if vim.g["Telescope#rooter#oldpwd"] == nil then
-            vim.g["Telescope#rooter#oldpwd"] = vim.loop.cwd()
-            log.debug("before " .. vim.inspect(vim.loop.cwd()))
-        end
-    end,
-    group = group
+    if vim.g["Telescope#rooter#oldpwd"] == nil then
+      vim.g["Telescope#rooter#oldpwd"] = vim.loop.cwd()
+      log.debug("before " .. vim.inspect(vim.loop.cwd()))
+    end
+  end;
+  group = group;
 })
 
-vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
-    callback = function()
-        if vim.g["Telescope#rooter#enabled"] ~= true then return end
+vim.api.nvim_create_autocmd({ "BufEnter"; "BufWinEnter"; }, {
+  callback = function()
+    if vim.g["Telescope#rooter#enabled"] ~= true then
+      return
+    end
 
-        vim.schedule(function()
-            if vim.bo.filetype == "TelescopePrompt" then
-                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
+    vim.schedule(function()
+      if vim.bo.filetype == "TelescopePrompt" then
+        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;
 })
 
-vim.api.nvim_create_autocmd({ "BufWinLeave" }, {
-    callback = function()
-        if vim.g["Telescope#rooter#enabled"] ~= true then return end
+vim.api.nvim_create_autocmd({ "BufWinLeave"; }, {
+  callback = function()
+    if vim.g["Telescope#rooter#enabled"] ~= true then
+      return
+    end
 
-        vim.schedule(function()
-            if vim.bo.filetype ~= "TelescopePrompt" then
-                if vim.g["Telescope#rooter#oldpwd"] ~= nil then
-                    log.debug("restoring " ..
-                        vim.g["Telescope#rooter#oldpwd"])
-                    vim.api.nvim_set_current_dir(
-                        vim.g["Telescope#rooter#oldpwd"])
-                    vim.g["Telescope#rooter#oldpwd"] = nil
-                end
-            end
-        end)
-    end,
-    group = group
+    vim.schedule(function()
+      if vim.bo.filetype ~= "TelescopePrompt" then
+        if vim.g["Telescope#rooter#oldpwd"] ~= nil then
+          log.debug("restoring " .. vim.g["Telescope#rooter#oldpwd"])
+          vim.api.nvim_set_current_dir(vim.g["Telescope#rooter#oldpwd"])
+          vim.g["Telescope#rooter#oldpwd"] = nil
+        end
+      end
+    end)
+  end;
+  group = group;
 })