marijnh/CodeMirror — pull request #1035 by mightyguava (2012-12-02 18:19:49+00:00)
Title: [vim keymap] Implement search behavior

The original keymap had support for `/`, `?`, `n`, and `N` that I regressed on. I assumed they were broken but it was because `demo/vim.html` didn't pull in `search.js` and `searchcursor.js`. I have restored the behavior with several extensions.

This implementation behaves more like vim than the old impl, and features:
- `*` and `#`
- search as motions: `d/query, dn, dN, d*` etc, will work as expected (though I'm not sure how useful that is).
- supports repeat on search
- works as a visual mode motion.
- uses only Javascript regexp search, so you don't have to type `'//query/'` to search a regexp. The original impl only matched regex if the query is surrounded by `'/'`.

This implementation depends on `searchcursor.js`. Search will just be unavailable if `cm.getSearchCursor` doesn't exist. It does not depend on `search.js`. A lot of the search code is ripped directly out of `search.js` but there several vim specific changes that were incompatible with `search.js`'s API for search, so I decided it was better to have `vim.js`'s own version.