3 ms·
Nice tips. I disagree on the unit test one though. I've been hacking on a vim+python based plugin (and learning python on the way) for past few days. When I sta
by codito 15y ago
Nice tips. I disagree on the unit test one though. I've been hacking on a vim+python based plugin (and learning python on the way) for past few days. When I started, I would fire vim up, test something and hit a non-actionable error (since I won't have the entire stack trace, nor could I use pdb.set_trace/attach debugger :().
Now I isolate vim as much as possible from core piece of code, and use a mock vim[1][2]. For every entrypoint into my python code from vim, I write a small unittest; run/debug it w/ nose and then just hook it to a vim key mapping. It reduced trial/error cycles significantly.
--
[1] http://tadhg.com/wp/2010/02/16/some-vim-script-implementation-testing-and-hackery/ http://tadhg.com/wp/2010/02/16/some-vim-script-implementatio...
[2] http://symlink.me/repositories/entry/blogit/testing/mock_vim.py http://symlink.me/repositories/entry/blogit/testing/mock_vim...
- oinksoft 15y agoIf I recall, tlib contains testing utilities. I haven't used them myself. http://www.vim.org/scripts/script.php?script_id=1863 http://www.vim.org/scripts/script.php?script_id=1863 https://github.com/tomtom/tlib_vim https://github.com/tomtom/tlib_vim