Learning the State Machine Behind a Modal Text Editor: The (Neo)Vim Case Study | SpringerLink
Skip to main content

Learning the State Machine Behind a Modal Text Editor: The (Neo)Vim Case Study

  • Conference paper
  • First Online:
Model Checking Software (SPIN 2024)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 14624))

Included in the following conference series:

  • 86 Accesses

Abstract

We use active automata-based learning to extract the state machine underlying the modal text editor Vim. We expose the various challenges to interface an active learning library with the text editor. Furthermore, we report on how we uncovered several issues and how they were dealt with by the (Neo)Vim developers. Finally, we reflect on the possible uses of automatically extracted finite-state machines beyond bug reports.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Subscribe and save

Springer+ Basic
¥17,985 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
JPY 3498
Price includes VAT (Japan)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
JPY 5719
Price includes VAT (Japan)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
JPY 7149
Price includes VAT (Japan)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

Notes

  1. 1.

    https://www.vim.org/.

  2. 2.

    https://en.wikipedia.org/wiki/Vim_(text_editor)#Modes.

  3. 3.

    https://iccf-holland.org/vim_books.html.

  4. 4.

    https://survey.stackoverflow.co/2022/#section-most-popular-technologies-integrated-development-environment.

  5. 5.

    Available via the :help command of Vim or via dedicated websites on the Internet.

  6. 6.

    https://neovim.io/.

  7. 7.

    https://github.com/neovim/pynvim.

  8. 8.

    https://github.com/DES-Lab/AALpy.

  9. 9.

    https://github.com/neovim/pynvim.

  10. 10.

    https://neovim.io/doc/user/api.html#nvim_get_mode().

  11. 11.

    See [12] for a more detailed explanation.

  12. 12.

    https://github.com/jrfonseca/xdot.py.

  13. 13.

    https://github.com/gephi/gephi.

  14. 14.

    https://github.com/DES-Lab/AALpy/discussions/13.

  15. 15.

    https://github.com/vim/vim/issues/13649#issuecomment-1847848471.

  16. 16.

    https://github.com/vim/vim/pull/13001#issuecomment-1703925253.

  17. 17.

    https://github.com/vim/vim/issues/12115#issuecomment-1483815493.

  18. 18.

    https://github.com/neovim/neovim/tree/master/src/nvim#nvim-lifecycle.

References

  1. Consecutive call of nvim_get_mode() does not return the same mode · Issue #15288 · neovim/neovim — github.com. https://github.com/neovim/neovim/issues/15288. Accessed 05-01-2024

  2. Different behavior between C-v and C-q · Issue #12684 · vim/vim — github.com. https://github.com/vim/vim/issues/12684. Accessed 05 Jan 2024

  3. GitHub - pierreganty/active-learning-neovim: Active automata-based learning of the Moore machine underlying Neovim — github.com. https://github.com/pierreganty/active-learning-neovim. Accessed 10 Jan 2024

  4. Non deterministic behavior when querying current mode · Issue #8323 · vim/vim — github.com. https://github.com/vim/vim/issues/8323. Accessed 05 Jan 2024

  5. Nvim lifecycle · neovim/neovim — github.com. https://github.com/neovim/neovim/tree/master/src/nvim#nvim-lifecycle. Accessed 05 Jan 2024

  6. nvim_get_mode waits 3\(\sim \)4 secs with ‘showmode’ enabled or when there are error messages · Issue #19352 · neovim/neovim — github.com. https://github.com/neovim/neovim/issues/19352. Accessed 05 Jan 2024

  7. Possible inconsistent behavior · Issue #8346 · vim/vim — github.com. https://github.com/vim/vim/issues/8346. Accessed 05 Jan 2024

  8. Possibly inconsistent behavior · Issue #13649 · vim/vim — github.com. https://github.com/vim/vim/issues/13649. Accessed 05 Jan 2024

  9. Possibly incorrect transitions between modes · Issue #12115 · vim/vim — github.com. https://github.com/vim/vim/issues/12115. Accessed 05 Jan 2024

  10. Possibly undocumented behavior with replace after visual · Issue #13091 · vim/vim — github.com. https://github.com/vim/vim/issues/13091. Accessed 05 Jan 2024

  11. Undocumented (possibly incorrect) behavior for Virtual Replace mode · Issue #12045 · vim/vim — github.com. https://github.com/vim/vim/issues/12045. Accessed 05 Jan 2024

  12. Unexpected behavior? · Issue #10693 · vim/vim — github.com. https://github.com/vim/vim/issues/10693. Accessed 05 Jan 2024

  13. Automata Wiki — automata.cs.ru.nl. https://automata.cs.ru.nl/ (2017). Accessed 05 Jan 2024

  14. Angluin, D.: Learning regular sets from queries and counterexamples. Inf. Comput. 75(2), 87–106 (1987). https://doi.org/10.1016/0890-5401(87)90052-6

    Article  MathSciNet  Google Scholar 

  15. Bastian, M., Heymann, S., Jacomy, M.: Gephi: an open source software for exploring and manipulating networks. In: Proceedings of the International AAAI Conference on Web and Social Media 3(1), pp. 361–362 (2009). https://doi.org/10.1609/icwsm.v3i1.13937

  16. Gansner, E.R., North, S.C.: An open graph visualization system and its applications to software engineering. Softw. Pract. Exper. 30(11), 1203–1233 (2000)

    Article  Google Scholar 

  17. Muškardin, E., Aichernig, B.K., Pill, I., Pferscher, A., Tappler, M.: AALpy: an active automata learning library. Innovations Syst. Softw. Eng. 18(3), 417–426 (2022). https://doi.org/10.1007/s11334-022-00449-3

    Article  Google Scholar 

  18. Muškardin, E., Aichernig, B.K., Pill, I., Tappler, M.: Learning finite state models from recurrent neural networks. In: Integrated Formal Methods, pp. 229–248. LNCS, Springer, Cham (2022). https://doi.org/10.1007/978-3-031-07727-2_13

  19. Parker, D.: Vim Modes Transition Diagram in SVG. https://gist.github.com/darcyparker/1886716 (2012). Accessed 05 Jan 2024

  20. Pezzi, G.: Understanding the Origins and the Evolution of Vi & Vim. https://pikuma.com/blog/origins-of-vim-text-editor (2023). Accessed 05 Jan 2024

  21. Pferscher, A., Aichernig, B.K.: Fingerprinting bluetooth low energy devices via active automata learning. In: FM 2021: Formal Methods, pp. 524–542. LNCS. Springer, Cham (2021). https://doi.org/10.1007/978-3-030-90870-6_28

  22. Pferscher, A., Wunderling, B., Aichernig, B.K., Muškardin, E.: Mining digital twins of a VPN server. In: FMDT 2023: Proceedings of the Workshop on Applications of Formal Methods and Digital Twins. CEUR Workshop Proceedings, vol. 3507 (2023)

    Google Scholar 

  23. Tappler, M., Aichernig, B.K., Bloem, R.: Model-based testing iot communication via active automata learning. In: ICST 2017: IEEE International Conference on Software Testing, Verification and Validation. IEEE (2017). https://doi.org/10.1109/icst.2017.32

  24. Vaandrager, F.: Model Learning. Commun. ACM 60(2), 86–95 (2017). https://doi.org/10.1145/2967606

    Article  Google Scholar 

Download references

Acknowledgments

We thank Xiao Peng Ye, Madeleine Mathieu and for their tremendous help with the interface and uncovering bugs. We also thank the Vim and Neovim developers for their time including Bram Moolenaar, the creator of Vim, who died during the summer 2023. Furthermore, we thank Edi Muskardin for his tremendous help with AALpy. Finally, we thank the SPIN reviewers for their effort and suggestions. This publication is part of the grant PID2022-138072OB-I00, funded by MCIN, FEDER, UE. This work has been partially supported by the PRODIGY Project (TED2021-132464B-I00) funded by MCIN and the European Union NextGeneration.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Pierre Ganty .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2025 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Ganty, P. (2025). Learning the State Machine Behind a Modal Text Editor: The (Neo)Vim Case Study. In: Neele, T., Wijs, A. (eds) Model Checking Software. SPIN 2024. Lecture Notes in Computer Science, vol 14624. Springer, Cham. https://doi.org/10.1007/978-3-031-66149-5_9

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-66149-5_9

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-66148-8

  • Online ISBN: 978-3-031-66149-5

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics