Skip to content

Commit

Permalink
added more binding options
Browse files Browse the repository at this point in the history
fixes #313
  • Loading branch information
adamjimenez committed Sep 4, 2018
1 parent cbcbd70 commit 0ba926b
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 6 deletions.
35 changes: 34 additions & 1 deletion app/editors.js
Expand Up @@ -1095,7 +1095,8 @@ function applyPrefs(tab) {
name: "appendLineSelection",
exec: function (editor, args, request) {
var string = args[0];


editor.selection.selectLineEnd();
var text = editor.getSelectedText();
editor.insert(text.replace(new RegExp("\n", 'g'), string + "\n") + string, true);
}
Expand Down Expand Up @@ -1426,6 +1427,38 @@ function applyPrefs(tab) {
multiSelectAction: "forEach",
scrollIntoView: "center",
readOnly: true
}, {
name: "addSemicolon",
bindKey: {
win: preferences.getKeyBinding('addSemicolon'),
mac: preferences.getKeyBinding('addSemicolon', 'mac'),
sender: "editor"
},
exec: function(editor) { editor.commands.exec('appendLineSelection', editor, [';']); },
multiSelectAction: "forEach",
scrollIntoView: "center"
}, {
name: "jumpToMatching",
bindKey: {
win: preferences.getKeyBinding('jumpToMatching'),
mac: preferences.getKeyBinding('jumpToMatching', 'mac'),
sender: "editor"
},
exec: function(editor) { editor.jumpToMatching(); },
multiSelectAction: "forEach",
scrollIntoView: "animate",
readOnly: true
}, {
name: "selectToMatching",
bindKey: {
win: preferences.getKeyBinding('selectToMatching'),
mac: preferences.getKeyBinding('selectToMatching', 'mac'),
sender: "editor"
},
exec: function(editor) { editor.jumpToMatching(true); },
multiSelectAction: "forEach",
scrollIntoView: "animate",
readOnly: true
}, {
name: "tag-start",
bindKey: {
Expand Down
19 changes: 19 additions & 0 deletions app/keybindings.js
Expand Up @@ -82,7 +82,26 @@ var actions = {
label: lang.expandSelection,
defaultKeyBinding: 'Alt-Shift-L'
},
'addSemicolon': {
label: lang.addSemicolon,
defaultKeyBinding: ''
},
'jumpToMatching': {
label: lang.jumpToMatching,
defaultKeyBinding: 'Ctrl-P'
},
'selectToMatching': {
label: lang.selectToMatching,
defaultKeyBinding: 'Ctrl-Shift-P'
},
/*
'preferences': {
label: lang.preferencesText,
defaultKeyBinding: 'Ctrl-U',
exec: function() {
preferences.open();
}
},
'newTab': {
label: 'New Tab',
defaultKeyBinding: 'Alt-N'
Expand Down
10 changes: 5 additions & 5 deletions app/menubar.js
Expand Up @@ -144,7 +144,7 @@ function init () {
target: 'site'
}, {
id: 'print',
text: makeMenuText(lang.print+'...', 'Ctrl-P'),
text: makeMenuText(lang.print + '...', 'Ctrl-P'),
disabled: true,
target: 'file',
handler: function() {
Expand Down Expand Up @@ -252,7 +252,7 @@ function init () {
target: 'file'
}, {
id: 'jumpToMatching',
text: makeMenuText(lang.jumpToMatching, 'Ctrl-P'),
text: makeMenuText(lang.jumpToMatching, preferences.getKeyBinding('jumpToMatching'), 'jumpToMatching'),
handler: function () {
var tab = activeTab;
var editor = tabs.getEditor(tab);
Expand All @@ -263,7 +263,7 @@ function init () {
target: 'file'
}, {
id: 'selectToMatching',
text: makeMenuText(lang.selectToMatching, 'Ctrl-Shift-P'),
text: makeMenuText(lang.selectToMatching, preferences.getKeyBinding('selectToMatching'), 'selectToMatching'),
handler: function () {
var tab = activeTab;
var editor = tabs.getEditor(tab);
Expand Down Expand Up @@ -324,7 +324,7 @@ function init () {
target: 'file'
}, '-', {
id: 'addSemicolon',
text: makeMenuText(lang.addSemicolon, 'Ctrl-;'),
text: makeMenuText(lang.addSemicolon, preferences.getKeyBinding('addSemicolon'), 'addSemicolon'),
handler: function () {
var tab = activeTab;
var editor = tabs.getEditor(tab);
Expand All @@ -334,7 +334,7 @@ function init () {
target: 'file'
}, {
id: 'applySourceFormatting',
text: makeMenuText(lang.beautify, 'Alt-Shift-F'),
text: makeMenuText(lang.beautify, preferences.getKeyBinding('applySourceFormatting'), 'applySourceFormatting'),
handler: function () {
var tab = activeTab;
var editor = tabs.getEditor(tab);
Expand Down

0 comments on commit 0ba926b

Please sign in to comment.