-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fbb73ff
commit c12bae7
Showing
3 changed files
with
56 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
local tmux = require("tmux-switch.tmux") | ||
|
||
local M = {} | ||
|
||
-- Function that registers all the commands exposed to Neovim | ||
function M.register() | ||
vim.api.nvim_create_user_command("TmuxSwitch", function() | ||
tmux.switch() | ||
end, { | ||
desc = "Run Java test picker", | ||
}) | ||
|
||
vim.api.nvim_create_user_command("TmuxCreateSession", function() | ||
tmux.create_session() | ||
end, { | ||
desc = "Execute test at cursor position", | ||
}) | ||
|
||
vim.api.nvim_create_user_command("TmuxRenameSession", function() | ||
tmux.rename_session() | ||
end, { | ||
desc = "Run all tests in the current Java class", | ||
}) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,9 @@ | ||
local util = require("tmux-switch.ui") | ||
local commands = require("tmux-switch.commands") | ||
|
||
local M = {} | ||
|
||
--- Switch to an existing tmux session using a picker menu. | ||
function M.switch() | ||
local tmux_sessions = util.get_tmux_sessions() | ||
ui.show_tmux_session_picker(tmux_sessions) | ||
end | ||
|
||
--- Create a new tmux session and switch to it. | ||
function M.create_session() | ||
ui.create_input_prompt("[ TMUX switch ]", "", function(session_name) | ||
util.create_new_session(session_name) | ||
util.switch_to_session(session_name) | ||
end) | ||
end | ||
|
||
--- Rename the current tmux session. | ||
function M.rename_session() | ||
local current_session = util.get_current_tmux_session() | ||
ui.create_input_prompt("[ TMUX switch ]", current_session, function(new_session_name) | ||
util.rename_current_session(new_session_name) | ||
end) | ||
function M.setup() | ||
commands.register() | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
local util = require("tmux-switch.ui") | ||
|
||
local M = {} | ||
|
||
--- Switch to an existing tmux session using a picker menu. | ||
function M.switch() | ||
local tmux_sessions = util.get_tmux_sessions() | ||
ui.show_tmux_session_picker(tmux_sessions) | ||
end | ||
|
||
--- Create a new tmux session and switch to it. | ||
function M.create_session() | ||
ui.create_input_prompt("[ TMUX switch ]", "", function(session_name) | ||
util.create_new_session(session_name) | ||
util.switch_to_session(session_name) | ||
end) | ||
end | ||
|
||
--- Rename the current tmux session. | ||
function M.rename_session() | ||
local current_session = util.get_current_tmux_session() | ||
ui.create_input_prompt("[ TMUX switch ]", current_session, function(new_session_name) | ||
util.rename_current_session(new_session_name) | ||
end) | ||
end | ||
|
||
return M |