()
| 319 | // Global Vim state. Call getVimGlobalState to get and initialize. |
| 320 | var vimGlobalState; |
| 321 | function getVimGlobalState() { |
| 322 | if (!vimGlobalState) { |
| 323 | vimGlobalState = { |
| 324 | // The current search query. |
| 325 | searchQuery: null, |
| 326 | // Whether we are searching backwards. |
| 327 | searchIsReversed: false, |
| 328 | registerController: new RegisterController({}) |
| 329 | }; |
| 330 | } |
| 331 | return vimGlobalState; |
| 332 | } |
| 333 | function getVimState(cm) { |
| 334 | if (!cm.vimState) { |
| 335 | // Store instance state in the CodeMirror object. |