Skip to content

Instantly share code, notes, and snippets.

@plateaukao
Created June 6, 2013 10:10

Revisions

  1. plateaukao created this gist Jun 6, 2013.
    26 changes: 26 additions & 0 deletions my_ideavim.groovy
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    import com.maddyhome.idea.vim.key.KeyParser
    import com.maddyhome.idea.vim.key.Shortcut
    import com.maddyhome.idea.vim.command.Command
    import javax.swing.KeyStroke
    import java.awt.event.KeyEvent


    // gc, gf, gs, ga でそれぞれのGotoコマンド実行
    parser.registerAction(KeyParser.MAPPING_NORMAL, "GotoClass", Command.Type.OTHER_READONLY, new Shortcut("gc"))
    parser.registerAction(KeyParser.MAPPING_NORMAL, "GotoFile", Command.Type.OTHER_READONLY, new Shortcut("gf"))
    parser.registerAction(KeyParser.MAPPING_NORMAL, "GotoSymbol", Command.Type.OTHER_READONLY, new Shortcut("gs"))
    parser.registerAction(KeyParser.MAPPING_NORMAL, "GotoAction", Command.Type.OTHER_READONLY, new Shortcut("ga"))
    parser.registerAction(KeyParser.MAPPING_NORMAL, "ShowUsages", Command.Type.OTHER_READONLY, new Shortcut("su"))
    parser.registerAction(KeyParser.MAPPING_NORMAL, "EditorTabPopupMenu", Command.Type.OTHER_READONLY, new Shortcut("gt"))

    parser.registerAction(KeyParser.MAPPING_NORMAL, "Run", Command.Type.OTHER_READONLY, new Shortcut("gr"))
    parser.registerAction(KeyParser.MAPPING_NORMAL, "Debug", Command.Type.OTHER_READONLY, new Shortcut("gd"))

    parser.registerAction(KeyParser.MAPPING_NORMAL, "NextTab", Command.Type.OTHER_READONLY, new Shortcut("bn"))
    parser.registerAction(KeyParser.MAPPING_NORMAL, "PreviousTab", Command.Type.OTHER_READONLY, new Shortcut("bp"))

    // Ctrl+] で定義に移動。Ctrl+T で戻る
    parser.registerAction(KeyParser.MAPPING_NORMAL, "GotoDeclaration", Command.Type.OTHER_READONLY, Command.FLAG_MOT_EXCLUSIVE,
    new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_CLOSE_BRACKET, KeyEvent.CTRL_MASK)))
    parser.registerAction(KeyParser.MAPPING_NORMAL, "Back", Command.Type.OTHER_READONLY, Command.FLAG_MOT_EXCLUSIVE,
    new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_T, KeyEvent.CTRL_MASK)))