forked from amibiz/ergo-keys
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- bind H -> start of line or paragraph - bind ; -> end of line or paragraph - bind 1 -> select word - bind 2 -> select line - bind G -> delete current code block - bind B -> toggle case - bind [ -> hippie completion - bind P -> activate insert mode with space before
- Loading branch information
Showing
7 changed files
with
129 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ plugins { | |
} | ||
|
||
group 'com.github.amibiz' | ||
version '1.2' | ||
version '1.3' | ||
|
||
sourceCompatibility = 1.8 | ||
|
||
|
31 changes: 31 additions & 0 deletions
31
src/main/java/com/github/amibiz/ergokeys/ActivateInsertModeSpaceBeforeAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.github.amibiz.ergokeys; | ||
|
||
import com.intellij.openapi.actionSystem.*; | ||
import com.intellij.openapi.command.WriteCommandAction; | ||
import com.intellij.openapi.editor.Caret; | ||
import com.intellij.openapi.editor.CaretModel; | ||
import com.intellij.openapi.editor.Document; | ||
import com.intellij.openapi.editor.Editor; | ||
import com.intellij.openapi.project.Project; | ||
|
||
public class ActivateInsertModeSpaceBeforeAction extends AnAction { | ||
final private ActionManager actionManager = ActionManager.getInstance(); | ||
|
||
@Override | ||
public void actionPerformed(AnActionEvent e) { | ||
final Editor editor = e.getRequiredData(CommonDataKeys.EDITOR); | ||
final Project project = e.getProject(); | ||
final Document document = editor.getDocument(); | ||
final CaretModel caretModel = editor.getCaretModel(); | ||
final Caret caret = caretModel.getCurrentCaret(); | ||
|
||
WriteCommandAction.runWriteCommandAction(project, new Runnable() { | ||
@Override | ||
public void run() { | ||
document.insertString(caret.getOffset(), " "); | ||
} | ||
}); | ||
actionManager.getAction(IdeActions.ACTION_EDITOR_MOVE_CARET_RIGHT).actionPerformed(e); | ||
actionManager.getAction("ErgoKeysInsertMode").actionPerformed(e); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/com/github/amibiz/ergokeys/DeleteCurrentCodeBlockAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.github.amibiz.ergokeys; | ||
|
||
import com.intellij.openapi.actionSystem.ActionManager; | ||
import com.intellij.openapi.actionSystem.AnAction; | ||
import com.intellij.openapi.actionSystem.AnActionEvent; | ||
import com.intellij.openapi.actionSystem.IdeActions; | ||
|
||
public class DeleteCurrentCodeBlockAction extends AnAction { | ||
final private ActionManager actionManager = ActionManager.getInstance(); | ||
|
||
@Override | ||
public void actionPerformed(AnActionEvent e) { | ||
actionManager.getAction("EditorCodeBlockStart").actionPerformed(e); | ||
actionManager.getAction("EditorCodeBlockEndWithSelection").actionPerformed(e); | ||
actionManager.getAction(IdeActions.ACTION_DELETE).actionPerformed(e); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/com/github/amibiz/ergokeys/EndOfLineOrParagraphAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.github.amibiz.ergokeys; | ||
|
||
import com.intellij.openapi.actionSystem.*; | ||
import com.intellij.openapi.editor.Caret; | ||
import com.intellij.openapi.editor.CaretModel; | ||
import com.intellij.openapi.editor.Document; | ||
import com.intellij.openapi.editor.Editor; | ||
import com.intellij.util.DocumentUtil; | ||
|
||
public class EndOfLineOrParagraphAction extends AnAction { | ||
final private ActionManager actionManager = ActionManager.getInstance(); | ||
|
||
@Override | ||
public void actionPerformed(AnActionEvent e) { | ||
final Editor editor = e.getRequiredData(CommonDataKeys.EDITOR); | ||
final Document document = editor.getDocument(); | ||
final CaretModel caretModel = editor.getCaretModel(); | ||
final Caret caret = caretModel.getCurrentCaret(); | ||
|
||
if (DocumentUtil.isAtLineEnd(caret.getOffset(), document)) { | ||
actionManager.getAction(IdeActions.ACTION_EDITOR_FORWARD_PARAGRAPH).actionPerformed(e); | ||
} else { | ||
actionManager.getAction(IdeActions.ACTION_EDITOR_MOVE_LINE_END).actionPerformed(e); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/main/java/com/github/amibiz/ergokeys/StartOfLineOrParagraphAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.github.amibiz.ergokeys; | ||
|
||
import com.intellij.openapi.actionSystem.*; | ||
import com.intellij.openapi.editor.Caret; | ||
import com.intellij.openapi.editor.CaretModel; | ||
import com.intellij.openapi.editor.Document; | ||
import com.intellij.openapi.editor.Editor; | ||
import com.intellij.util.DocumentUtil; | ||
|
||
public class StartOfLineOrParagraphAction extends AnAction { | ||
final private ActionManager actionManager = ActionManager.getInstance(); | ||
|
||
@Override | ||
public void actionPerformed(AnActionEvent e) { | ||
final Editor editor = e.getRequiredData(CommonDataKeys.EDITOR); | ||
final Document document = editor.getDocument(); | ||
final CaretModel caretModel = editor.getCaretModel(); | ||
final Caret caret = caretModel.getCurrentCaret(); | ||
|
||
if (DocumentUtil.isAtLineStart(caret.getOffset(), document)) { | ||
actionManager.getAction(IdeActions.ACTION_EDITOR_BACKWARD_PARAGRAPH).actionPerformed(e); | ||
} else { | ||
actionManager.getAction(IdeActions.ACTION_EDITOR_MOVE_LINE_START).actionPerformed(e); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters