diff --git a/internal/model/model.go b/internal/model/model.go index 145cfc06..c6e3f435 100644 --- a/internal/model/model.go +++ b/internal/model/model.go @@ -7,6 +7,7 @@ import ( "fmt" "io" "os" + "os/exec" "strings" "time" @@ -177,6 +178,12 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { return m, nil case "ctrl+c", "q": return m, tea.Quit + case "ctrl+o": + // Opens the current slide in vim + err := m.openNewWindow() + if err != nil { + return m, nil + } default: newState := navigation.Navigate(navigation.State{ Buffer: m.buffer, @@ -314,3 +321,9 @@ func (m *Model) SetPage(page int) { func (m *Model) Pages() []string { return m.Slides } + +// Opens the current slide as a split window in tmux. +func (m *Model) openNewWindow() error { + cmd := exec.Command("tmux", "split-window", "-h", "vim", m.FileName) + return cmd.Start() +}