]> git.r.bdr.sh - rbdr/dotfiles/blob - atom/packages/ex-mode/lib/ex-mode.coffee
Fixes submodule names for paths
[rbdr/dotfiles] / atom / packages / ex-mode / lib / ex-mode.coffee
1 GlobalExState = require './global-ex-state'
2 ExState = require './ex-state'
3 Ex = require './ex'
4 {Disposable, CompositeDisposable} = require 'event-kit'
5
6 module.exports = ExMode =
7 activate: (state) ->
8 @globalExState = new GlobalExState
9 @disposables = new CompositeDisposable
10 @exStates = new WeakMap
11
12 @disposables.add atom.workspace.observeTextEditors (editor) =>
13 return if editor.mini
14
15 element = atom.views.getView(editor)
16
17 if not @exStates.get(editor)
18 exState = new ExState(
19 element,
20 @globalExState
21 )
22
23 @exStates.set(editor, exState)
24
25 @disposables.add new Disposable =>
26 exState.destroy()
27
28 deactivate: ->
29 @disposables.dispose()
30
31 provideEx: ->
32 registerCommand: Ex.registerCommand.bind(Ex)
33
34 consumeVim: (vim) ->
35 @vim = vim
36 @globalExState.setVim(vim)