dotfiles

Personal dotfiles
git clone https://git.bracken.jp/dotfiles.git
Log | Files | Refs | LICENSE

utils.lua (633B)


      1 local M = {}
      2 
      3 function M.change_google3_subdir(subdir)
      4   return function()
      5     local cwd = vim.fn.getcwd()
      6     local google3_pattern = "/google3"
      7     local google3_start, google3_end = string.find(cwd, google3_pattern, 1, true)
      8 
      9     if google3_start then
     10       local root = string.sub(cwd, 1, google3_end)
     11       local new_dir = root .. "/" .. subdir
     12       if vim.fn.isdirectory(new_dir) == 1 then
     13         vim.cmd("cd " .. new_dir)
     14         vim.notify("Changed directory to: " .. new_dir, vim.log.levels.INFO)
     15       else
     16         vim.notify("Directory not found: " .. new_dir, vim.log.levels.WARN)
     17       end
     18     end
     19   end
     20 end
     21 
     22 return M