]> git.r.bdr.sh - rbdr/dotfiles/blame_incremental - atom/packages/vim-mode/lib/status-bar-manager.coffee
Update prompt to show ruby & node envs
[rbdr/dotfiles] / atom / packages / vim-mode / lib / status-bar-manager.coffee
... / ...
CommitLineData
1ContentsByMode =
2 'insert': ["status-bar-vim-mode-insert", "Insert"]
3 'insert.replace': ["status-bar-vim-mode-insert", "Replace"]
4 'normal': ["status-bar-vim-mode-normal", "Normal"]
5 'visual': ["status-bar-vim-mode-visual", "Visual"]
6 'visual.characterwise': ["status-bar-vim-mode-visual", "Visual"]
7 'visual.linewise': ["status-bar-vim-mode-visual", "Visual Line"]
8 'visual.blockwise': ["status-bar-vim-mode-visual", "Visual Block"]
9
10module.exports =
11class StatusBarManager
12 constructor: ->
13 @element = document.createElement("div")
14 @element.id = "status-bar-vim-mode"
15
16 @container = document.createElement("div")
17 @container.className = "inline-block"
18 @container.appendChild(@element)
19
20 initialize: (@statusBar) ->
21
22 update: (currentMode, currentSubmode) ->
23 currentMode = currentMode + "." + currentSubmode if currentSubmode?
24 if newContents = ContentsByMode[currentMode]
25 [klass, text] = newContents
26 @element.className = klass
27 @element.textContent = text
28 else
29 @hide()
30
31 hide: ->
32 @element.className = 'hidden'
33
34 # Private
35
36 attach: ->
37 @tile = @statusBar.addRightTile(item: @container, priority: 20)
38
39 detach: ->
40 @tile.destroy()