fix lua styling

This commit is contained in:
swaits committed 2023-10-25 21:35:32 -06:00
1 parent 0bf61de37d
commit 0e3ea41ef4
2 files changed
+23 -20

No files matched your search

+3
View File
@@ -0,0 +1,3 @@
indent_type = "Spaces"
indent_width = 2
column_width = 100
+20 -20
View File
@@ -1,43 +1,43 @@
local M = {}
local function nav(short_direction, direction)
-- get window ID, try switching windows, and get ID again to see if it worked
local cur_winnr = vim.fn.winnr()
vim.api.nvim_command("wincmd " .. short_direction)
local new_winnr = vim.fn.winnr()
-- get window ID, try switching windows, and get ID again to see if it worked
local cur_winnr = vim.fn.winnr()
vim.api.nvim_command("wincmd " .. short_direction)
local new_winnr = vim.fn.winnr()
-- if the window ID didn't change, then we didn't switch
if cur_winnr == new_winnr then
vim.fn.system("zellij action move-focus " .. direction)
if vim.v.shell_error ~= 0 then
error("zellij executable not found in path")
end
end
-- if the window ID didn't change, then we didn't switch
if cur_winnr == new_winnr then
vim.fn.system("zellij action move-focus " .. direction)
if vim.v.shell_error ~= 0 then
error("zellij executable not found in path")
end
end
end
function M.up()
nav("k", "up")
nav("k", "up")
end
function M.down()
nav("j", "down")
nav("j", "down")
end
function M.right()
nav("l", "right")
nav("l", "right")
end
function M.left()
nav("h", "left")
nav("h", "left")
end
-- create our exported setup() function
function M.setup(opts)
-- create our commands
vim.api.nvim_create_user_command("ZellijNavigateUp", M.up, {})
vim.api.nvim_create_user_command("ZellijNavigateDown", M.down, {})
vim.api.nvim_create_user_command("ZellijNavigateLeft", M.left, {})
vim.api.nvim_create_user_command("ZellijNavigateRight", M.right, {})
-- create our commands
vim.api.nvim_create_user_command("ZellijNavigateUp", M.up, {})
vim.api.nvim_create_user_command("ZellijNavigateDown", M.down, {})
vim.api.nvim_create_user_command("ZellijNavigateLeft", M.left, {})
vim.api.nvim_create_user_command("ZellijNavigateRight", M.right, {})
end
return M