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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
Notes
- 1.
- 2.
- 3.
- 4.
- 5.
Available via the :help command of Vim or via dedicated websites on the Internet.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
See [12] for a more detailed explanation.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
References
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
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
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
Non deterministic behavior when querying current mode · Issue #8323 · vim/vim — github.com. https://github.com/vim/vim/issues/8323. Accessed 05 Jan 2024
Nvim lifecycle · neovim/neovim — github.com. https://github.com/neovim/neovim/tree/master/src/nvim#nvim-lifecycle. Accessed 05 Jan 2024
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
Possible inconsistent behavior · Issue #8346 · vim/vim — github.com. https://github.com/vim/vim/issues/8346. Accessed 05 Jan 2024
Possibly inconsistent behavior · Issue #13649 · vim/vim — github.com. https://github.com/vim/vim/issues/13649. Accessed 05 Jan 2024
Possibly incorrect transitions between modes · Issue #12115 · vim/vim — github.com. https://github.com/vim/vim/issues/12115. Accessed 05 Jan 2024
Possibly undocumented behavior with replace after visual · Issue #13091 · vim/vim — github.com. https://github.com/vim/vim/issues/13091. Accessed 05 Jan 2024
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
Unexpected behavior? · Issue #10693 · vim/vim — github.com. https://github.com/vim/vim/issues/10693. Accessed 05 Jan 2024
Automata Wiki — automata.cs.ru.nl. https://automata.cs.ru.nl/ (2017). Accessed 05 Jan 2024
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
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
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)
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
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
Parker, D.: Vim Modes Transition Diagram in SVG. https://gist.github.com/darcyparker/1886716 (2012). Accessed 05 Jan 2024
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
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
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)
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
Vaandrager, F.: Model Learning. Commun. ACM 60(2), 86–95 (2017). https://doi.org/10.1145/2967606
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
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2025 The Author(s), under exclusive license to Springer Nature Switzerland AG
About this paper
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)