回答編集履歴
3
どうでもいい修正
test
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
```
|
16
16
|
|
17
|
-
Atom を再起動させて、Packages → Command Palette → Toggle から確認してみると、キーバインディングが追加されていることがわかります。設定した
|
17
|
+
Atom を再起動させて、Packages → Command Palette → Toggle から確認してみると、キーバインディングが追加されていることがわかります。設定した通り実行できれば OK です。
|
18
18
|
|
19
19
|
|
20
20
|
|
@@ -28,7 +28,7 @@
|
|
28
28
|
|
29
29
|
例えば Macの場合だと、`~/.atom/init.coffee`(メニューからだと、Atom → Init Script...)に以下のように記述します。
|
30
30
|
|
31
|
-
追加するコマンドは、"Delete To End Of Buffer Line" とします。
|
31
|
+
追加するコマンドは、"Delete To End Of Buffer Line" としてあります。
|
32
32
|
|
33
33
|
```CoffeeScript
|
34
34
|
|
2
回答の追記
test
CHANGED
@@ -19,3 +19,51 @@
|
|
19
19
|
|
20
20
|
|
21
21
|
![after-add-keybind](65fa8e0595752c38378054ce0839a3cc.png)
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
#### 追記
|
26
|
+
|
27
|
+
どうしても行末までをカットではなく、行末までを削除するコマンドが必要ということでしたら、init.coffee に新しいコマンドとして書いてしまうという方法もあります。
|
28
|
+
|
29
|
+
例えば Macの場合だと、`~/.atom/init.coffee`(メニューからだと、Atom → Init Script...)に以下のように記述します。
|
30
|
+
|
31
|
+
追加するコマンドは、"Delete To End Of Buffer Line" とします。
|
32
|
+
|
33
|
+
```CoffeeScript
|
34
|
+
|
35
|
+
atom.commands.add 'atom-text-editor', 'editor:delete-to-end-of-buffer-line', ->
|
36
|
+
|
37
|
+
textEditor = atom.workspace.getActiveTextEditor()
|
38
|
+
|
39
|
+
cursorPosition = textEditor.getCursorBufferPosition()
|
40
|
+
|
41
|
+
endColumn = textEditor.lineTextForBufferRow(cursorPosition.row).length
|
42
|
+
|
43
|
+
endPosition = cursorPosition.translate([0, endColumn - cursorPosition.column])
|
44
|
+
|
45
|
+
selectionToDelete = textEditor.selectToBufferPosition(endPosition)
|
46
|
+
|
47
|
+
textEditor.delete(selectionToDelete)
|
48
|
+
|
49
|
+
```
|
50
|
+
|
51
|
+
このコマンドに割り当てるキーバインドを設定します。
|
52
|
+
|
53
|
+
```CSON
|
54
|
+
|
55
|
+
'atom-text-editor':
|
56
|
+
|
57
|
+
'alt-shift-k': 'editor:delete-to-end-of-buffer-line'
|
58
|
+
|
59
|
+
```
|
60
|
+
|
61
|
+
Command Palette から存在を確認して、実行されるか確認します。
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
![new_command](c70df74f068cb581a0290c301d1bf325.png)
|
66
|
+
|
67
|
+
参考:
|
68
|
+
|
69
|
+
[Move to beginning of line - support - Atom Discussion](https://discuss.atom.io/t/move-to-beginning-of-line/19409)
|
1
csonのハイライトが変なので解除
test
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
"Cut To End Of Buffer Line" (正確には論理行末までをカット)というコマンドがこれに当たると思いますが、Packages → Command Palette → Toggle から見てみると、デフォルトではキーバインディングが設定されていないようです。
|
2
|
+
|
3
|
+
|
2
4
|
|
3
5
|
![default](c91c1b9b9d57e45982f93edc332d3ca4.png)
|
4
6
|
|
5
7
|
なのでユーザーのキーバインド設定ファイル keymap.cson に使用したいキーバインド設定を書いてやります。例えば `Alt-Command-k`で実行させたい場合はこのようになります。
|
6
8
|
|
7
|
-
```
|
9
|
+
```
|
8
10
|
|
9
11
|
'atom-text-editor':
|
10
12
|
|
@@ -14,4 +16,6 @@
|
|
14
16
|
|
15
17
|
Atom を再起動させて、Packages → Command Palette → Toggle から確認してみると、キーバインディングが追加されていることがわかります。設定したキーバインドで実行できれば OK です。
|
16
18
|
|
19
|
+
|
20
|
+
|
17
21
|
![after-add-keybind](65fa8e0595752c38378054ce0839a3cc.png)
|