ex-mode/lib/ex-mode.coffee
jazzpi 91f3f82730 New command defining format, minor improvements
- If the second address is empty, it is assumed to be `.`
- Regex addresses and `:substitute` now integrate with search history and
  respect case sensitivity settings
- Patterns for `:substitute` can't be delimited by
- `:set` now supports inverting options using `:set inv{option}` and
  `:set {option}!`
- New commands: `:new`, `:vnew`, `:exit`, `:xall`, `:wall`, `:qall`, `:update`
2015-07-31 12:01:47 +02:00

40 lines
1,013 B
CoffeeScript

GlobalExState = require './global-ex-state'
ExState = require './ex-state'
ExCommands = require './ex-commands'
{Disposable, CompositeDisposable} = require 'event-kit'
module.exports = ExMode =
activate: (state) ->
@globalExState = new GlobalExState
@disposables = new CompositeDisposable
@exStates = new WeakMap
@disposables.add atom.workspace.observeTextEditors (editor) =>
return if editor.mini
element = atom.views.getView(editor)
if not @exStates.get(editor)
exState = new ExState(
element,
@globalExState
)
@exStates.set(editor, exState)
@disposables.add new Disposable ->
exState.destroy()
deactivate: ->
@disposables.dispose()
provideEx_0_20: ->
registerCommand: (name, callback) ->
ExCommands.registerCommand({name, callback, priority: 1})
provideEx_0_30: ->
registerCommand: ExCommands.registerCommand
consumeVim: (vim) ->
@vim = vim
@globalExState.setVim(vim)