Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Mode:exit #30

Merged
merged 10 commits into from
Mar 11, 2024
Merged

feat: Mode:exit #30

merged 10 commits into from
Mar 11, 2024

Conversation

Iron-E
Copy link
Owner

@Iron-E Iron-E commented Mar 8, 2024

Closes #28.

Allows closing modes with self:exit

local M = {}

M.mode1 = {
  m = function()
    vim.notify('Mode 1')
  end,
  n = function(self)
    require('libmodal').mode.enter('My mode 2', M.mode2)
    self:exit()
  end
}

M.mode2 = {
  m = function()
    vim.notify('Mode 2')
  end,
  n = function(self)
    require('libmodal').mode.enter('Mode 1', M.mode1)
    self:exit()
  end
}

vim.keymap.set('n', 'M', function()
  require('libmodal').mode.enter('Mode 1', M.mode1)
end)

@Iron-E Iron-E self-assigned this Mar 8, 2024
@Iron-E Iron-E merged commit 1ecc4ad into master Mar 11, 2024
@Iron-E Iron-E deleted the feat/28 branch March 11, 2024 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Shallowly switching between libmodal modes
1 participant