fix lua styling
This commit is contained in:
2 files changed
+23
-20
No files matched your search
@@ -0,0 +1,3 @@
|
|||||||
|
indent_type = "Spaces"
|
||||||
|
indent_width = 2
|
||||||
|
column_width = 100
|
||||||
+20
-20
@@ -1,43 +1,43 @@
|
|||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
local function nav(short_direction, direction)
|
local function nav(short_direction, direction)
|
||||||
-- get window ID, try switching windows, and get ID again to see if it worked
|
-- get window ID, try switching windows, and get ID again to see if it worked
|
||||||
local cur_winnr = vim.fn.winnr()
|
local cur_winnr = vim.fn.winnr()
|
||||||
vim.api.nvim_command("wincmd " .. short_direction)
|
vim.api.nvim_command("wincmd " .. short_direction)
|
||||||
local new_winnr = vim.fn.winnr()
|
local new_winnr = vim.fn.winnr()
|
||||||
|
|
||||||
-- if the window ID didn't change, then we didn't switch
|
-- if the window ID didn't change, then we didn't switch
|
||||||
if cur_winnr == new_winnr then
|
if cur_winnr == new_winnr then
|
||||||
vim.fn.system("zellij action move-focus " .. direction)
|
vim.fn.system("zellij action move-focus " .. direction)
|
||||||
if vim.v.shell_error ~= 0 then
|
if vim.v.shell_error ~= 0 then
|
||||||
error("zellij executable not found in path")
|
error("zellij executable not found in path")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.up()
|
function M.up()
|
||||||
nav("k", "up")
|
nav("k", "up")
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.down()
|
function M.down()
|
||||||
nav("j", "down")
|
nav("j", "down")
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.right()
|
function M.right()
|
||||||
nav("l", "right")
|
nav("l", "right")
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.left()
|
function M.left()
|
||||||
nav("h", "left")
|
nav("h", "left")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- create our exported setup() function
|
-- create our exported setup() function
|
||||||
function M.setup(opts)
|
function M.setup(opts)
|
||||||
-- create our commands
|
-- create our commands
|
||||||
vim.api.nvim_create_user_command("ZellijNavigateUp", M.up, {})
|
vim.api.nvim_create_user_command("ZellijNavigateUp", M.up, {})
|
||||||
vim.api.nvim_create_user_command("ZellijNavigateDown", M.down, {})
|
vim.api.nvim_create_user_command("ZellijNavigateDown", M.down, {})
|
||||||
vim.api.nvim_create_user_command("ZellijNavigateLeft", M.left, {})
|
vim.api.nvim_create_user_command("ZellijNavigateLeft", M.left, {})
|
||||||
vim.api.nvim_create_user_command("ZellijNavigateRight", M.right, {})
|
vim.api.nvim_create_user_command("ZellijNavigateRight", M.right, {})
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
Reference in new issue
Block a user