work in jjk-jacky's pull request into my own fork

the pull request is:
https://github.com/jeffkreeftmeijer/vim-numbertoggle/pull/22

jeffkreeftmeijer had made some code refactoring since this pull request
was made, so I adapted the core idea of the pull request