vim macros - vim to generate code template dynamically -


i have write test cases contains repetive code.

  1. the name of method should classname delimitted _ ex: class_name_test
  2. the object name should classnameobj , mock method should take classname.class
  3. the genericobj.call statement common methods sayhello should bound classnameobj , remaining result common
  4. the commonmethods common objects

instead of copy pasting , changing classname , classnameobj, interested in automating using vim. is possible if pass class name, rest should generated?

the method template mentioned below.

@test public void stop_video_request_valid_data() throws throwable {     classname classnameobj = mock(classname.class);     when(genericobj.call()).thenreturn(new object[]{classnameobj});     when(classnameobj.sayhello()).thenreturn("hello");     commonmethods(); } 

snippets built-in :abbreviate on steroids, parameter insertions, mirroring, , multiple stops inside them. 1 of first, famous (and still used) vim plugins snipmate (inspired textmate editor); unfortunately, it's not maintained more; though there a fork. modern alternative (that requires python though) ultisnips. there more, see this list on vim tips wiki.

there 3 things evaluate: first, features of snippet engine itself, second, quality , breadth of snippets provided author or others; third, how easy add new snippets.


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -