-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This introduces the following commands: - `:GhActions` or `:GhActions toggle` toggles the `gh-actions` split - `:GhActions open` opens the `gh-actions` split - `:GhActions close` closes the `gh-actions` split BREAKING CHANGE: `:GhActions` now toggles the split instead of only opening it. Fixes #12
- Loading branch information
Showing
3 changed files
with
42 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
local M = {} | ||
|
||
function handle_gh_actions_command(a) | ||
local gha = require('gh-actions') | ||
|
||
local action = a.fargs[1] or 'toggle' | ||
|
||
if action == 'open' then | ||
return gha.open() | ||
elseif action == 'close' then | ||
return gha.close() | ||
elseif action == 'toggle' then | ||
local ui = require('gh-actions.ui') | ||
|
||
if ui.split.winid then | ||
return gha.close() | ||
else | ||
return gha.open() | ||
end | ||
end | ||
end | ||
|
||
function completion_customlist() | ||
return { | ||
'open', | ||
'close', | ||
'toggle', | ||
} | ||
end | ||
|
||
function M.setup() | ||
vim.api.nvim_create_user_command('GhActions', handle_gh_actions_command, { | ||
nargs = '?', | ||
complete = completion_customlist, | ||
}) | ||
end | ||
|
||
return M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters