]> git.r.bdr.sh - rbdr/dotfiles/blobdiff - atom/packages/vim-mode-visual-block/lib/main.coffee
Remove vim-surround
[rbdr/dotfiles] / atom / packages / vim-mode-visual-block / lib / main.coffee
index 61cfe761b0ab66792541855a60fd284990903873..dc5a5c21218401e89003f5144ab11415e5427f78 100644 (file)
@@ -14,15 +14,14 @@ module.exports =
   activate: (state) ->
     @disposables = new CompositeDisposable
     blockwiseCommands = {}
   activate: (state) ->
     @disposables = new CompositeDisposable
     blockwiseCommands = {}
-    # [TODO] remove 'h', 'l'  after some period.
-    commands = 'jkhloDCIA'.split('')
+    commands = 'jkoDCIA'.split('')
     commands.push 'escape', 'ctrl-v'
     for command in commands
       do (command) =>
         name = "#{@prefix}:#{command}"
         blockwiseCommands[name] = (event) => @blockOperation(event, command)
 
     commands.push 'escape', 'ctrl-v'
     for command in commands
       do (command) =>
         name = "#{@prefix}:#{command}"
         blockwiseCommands[name] = (event) => @blockOperation(event, command)
 
-    blockwiseCommands["#{@prefix}:toggle-debug"] = => @toggleDebug()
+    blockwiseCommands["#{@prefix}:toggle-debug"] = => @toggleDebug()
     @disposables.add atom.commands.add('atom-text-editor', blockwiseCommands)
     @reset()
 
     @disposables.add atom.commands.add('atom-text-editor', blockwiseCommands)
     @reset()
 
@@ -63,21 +62,20 @@ module.exports =
 
     currentRow  = editor.getLastCursor()?.getBufferRow()
     @startRow  ?= currentRow
 
     currentRow  = editor.getLastCursor()?.getBufferRow()
     @startRow  ?= currentRow
-    # @debug "@startRow = #{@startRow}"
 
     switch command
       when 'o'
         @startRow = currentRow
       when 'D', 'C'
 
     switch command
       when 'o'
         @startRow = currentRow
       when 'D', 'C'
-        vimState.activateCommandMode()
+        vimState.activateNormalMode()
         event.abortKeyBinding()
       when 'escape', 'ctrl-v'
         event.abortKeyBinding()
       when 'escape', 'ctrl-v'
-        vimState.activateCommandMode()
+        vimState.activateNormalMode()
         editor.clearSelections()
       when 'j', 'k'
         editor.clearSelections()
       when 'j', 'k'
-        cursorPositions = editor.getCursorsOrderedByBufferPosition()
-        cursorTop       = _.first cursorPositions
-        cursorBottom    = _.last cursorPositions
+        cursors      = editor.getCursorsOrderedByBufferPosition()
+        cursorTop    = _.first cursors
+        cursorBottom = _.last cursors
 
         if (command is 'j' and cursorTop.getBufferRow() >= @startRow) or
             (command is 'k' and cursorBottom.getBufferRow() <= @startRow)
 
         if (command is 'j' and cursorTop.getBufferRow() >= @startRow) or
             (command is 'k' and cursorBottom.getBufferRow() <= @startRow)
@@ -125,22 +123,12 @@ module.exports =
           cursor.setBufferPosition(pointTarget)
 
         adjustCursor(selection) for selection in editor.getSelections()
           cursor.setBufferPosition(pointTarget)
 
         adjustCursor(selection) for selection in editor.getSelections()
-        vimState.activateCommandMode()
+        vimState.activateNormalMode()
         vimState.activateInsertMode()
 
         if command is 'A' and  cursorsAdjusted.length
           cursor.moveRight() for cursor in cursorsAdjusted
 
         vimState.activateInsertMode()
 
         if command is 'A' and  cursorsAdjusted.length
           cursor.moveRight() for cursor in cursorsAdjusted
 
-      else
-        event.abortKeyBinding()
-        content = """
-          *#{@prefix}*
-          * From version 0.2.5, `#{@prefix}` provide default keymap.
-          * And `h`, `l` command become obsolete.
-          * Remove all explicit keymap from `keymap.cson`.
-          """
-        atom.notifications.addWarning content, dismissable: true
-
     unless @isVisualBlockMode vimState
       @reset()
 
     unless @isVisualBlockMode vimState
       @reset()