various fix and optim

* adding vim swap file to gitignore
* using __len__ for test