(cm)
| 9927 | }; |
| 9928 | |
| 9929 | function maybeInitVimState(cm) { |
| 9930 | if (!cm.state.vim) { |
| 9931 | // Store instance state in the CodeMirror object. |
| 9932 | cm.state.vim = { |
| 9933 | inputState: new InputState(), |
| 9934 | // Vim's input state that triggered the last edit, used to repeat |
| 9935 | // motions and operators with '.'. |
| 9936 | lastEditInputState: undefined, |
| 9937 | // Vim's action command before the last edit, used to repeat actions |
| 9938 | // with '.' and insert mode repeat. |
| 9939 | lastEditActionCommand: undefined, |
| 9940 | // When using jk for navigation, if you move from a longer line to a |
| 9941 | // shorter line, the cursor may clip to the end of the shorter line. |
| 9942 | // If j is pressed again and cursor goes to the next line, the |
| 9943 | // cursor should go back to its horizontal position on the longer |
| 9944 | // line if it can. This is to keep track of the horizontal position. |
| 9945 | lastHPos: -1, |
| 9946 | // Doing the same with screen-position for gj/gk |
| 9947 | lastHSPos: -1, |
| 9948 | // The last motion command run. Cleared if a non-motion command gets |
| 9949 | // executed in between. |
| 9950 | lastMotion: null, |
| 9951 | marks: {}, |
| 9952 | // Mark for rendering fake cursor for visual mode. |
| 9953 | fakeCursor: null, |
| 9954 | insertMode: false, |
| 9955 | // Repeat count for changes made in insert mode, triggered by key |
| 9956 | // sequences like 3,i. Only exists when insertMode is true. |
| 9957 | insertModeRepeat: undefined, |
| 9958 | visualMode: false, |
| 9959 | // If we are in visual line mode. No effect if visualMode is false. |
| 9960 | visualLine: false, |
| 9961 | visualBlock: false, |
| 9962 | lastSelection: null, |
| 9963 | lastPastedText: null, |
| 9964 | sel: {}, |
| 9965 | // Buffer-local/window-local values of vim options. |
| 9966 | options: {} |
| 9967 | }; |
| 9968 | } |
| 9969 | return cm.state.vim; |
| 9970 | } |
| 9971 | var vimGlobalState; |
| 9972 | function resetVimGlobalState() { |
| 9973 | vimGlobalState = { |
no outgoing calls
no test coverage detected