diff --git a/README.md b/README.md index 726624c..6777802 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,39 @@ the **core.quotepath** option using following command: $ git config --global core.quotepath false ``` +# Key Configuration + +We have two key sets _vi_ and _mc_ preconfigured. The default one is _vi_. + +##### Using the mc key set + +You will need to place a file at `~/.config/git-commander/config.json` with the following content: + +``` +{ + "keySet": "mc" +} +``` + +##### Redefining keys one by one + +You also can redefine keys one by one if you would like. You'll need to extend your `~/.config/git-commander/config.json` file with a key called `keys` and put all your key definitions there. For example if you would like to use the _mc_ key set and make key _x_ quit the application, you'll need to add the following: + +``` +{ + "keySet": "mc", + "keys": { + "common": { + "quit": [ + "x" + ] + } + } +} +``` + +You can find [default settings here](https://github.com/golbin/git-commander/tree/master/config/key). + # License MIT diff --git a/config/index.js b/config/index.js new file mode 100644 index 0000000..a7559da --- /dev/null +++ b/config/index.js @@ -0,0 +1,26 @@ +var _ = require('lodash'); + +var defaultConfig = { + keySet: 'vi' +}; + +var config = (function() { + var fs = require('fs'); + + var retval = defaultConfig; + var userHome = process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME']; + var configFileName = userHome + '/.config/git-commander/config.json'; + + if (configFileName && fs.existsSync(configFileName)) { + retval = _.extend({}, defaultConfig, JSON.parse(fs.readFileSync(configFileName))); + } + + return retval; +}()); + + +var keyConfig = require('./key/' + config.keySet + '.json'); + +module.exports = { + keys: config.keys ? _.merge({}, keyConfig, config.keys) : keyConfig +}; diff --git a/config/key/mc.json b/config/key/mc.json new file mode 100644 index 0000000..a05a85e --- /dev/null +++ b/config/key/mc.json @@ -0,0 +1,65 @@ +{ + "common": { + "quit": [ + "escape", + "q" + ], + "pageUp": [ + "pageup" + ], + "pageDown": [ + "pagedown" + ] + }, + "main": { + "select": [ + "space" + ], + "selectAll": [ + "enter" + ], + "add": [ + "a" + ], + "reset": [ + "r" + ], + "commit": [ + "c" + ], + "log": [ + "l" + ], + "diff": [ + "d" + ], + "showBranch": [ + "b" + ], + "togglePanes": [ + "tab" + ], + "leftPane": [ + "left" + ], + "rightPane": [ + "right" + ] + }, + "editor": { + "save": [ + "C-s" + ] + }, + "branch": { + "checkOut": [ + "enter" + ], + "delete": [ + "d" + ], + "add": [ + "a" + ] + } +} diff --git a/config/key/vi.json b/config/key/vi.json new file mode 100644 index 0000000..38eda18 --- /dev/null +++ b/config/key/vi.json @@ -0,0 +1,65 @@ +{ + "common": { + "quit": [ + "escape", + "q" + ], + "pageUp": [ + "C-b" + ], + "pageDown": [ + "C-f" + ] + }, + "main": { + "select": [ + "space" + ], + "selectAll": [ + "enter" + ], + "add": [ + "C-a" + ], + "reset": [ + "C-r" + ], + "commit": [ + "C-c" + ], + "log": [ + "C-l" + ], + "diff": [ + "C-d" + ], + "showBranch": [ + "C-b" + ], + "togglePanes": [ + "tab" + ], + "leftPane": [ + "left" + ], + "rightPane": [ + "right" + ] + }, + "editor": { + "save": [ + "C-s" + ] + }, + "branch": { + "checkOut": [ + "enter" + ], + "delete": [ + "C-d" + ], + "add": [ + "C-a" + ] + } +} diff --git a/controller/branch.js b/controller/branch.js index 56e9158..1a68846 100644 --- a/controller/branch.js +++ b/controller/branch.js @@ -1,6 +1,7 @@ var _ = require('lodash'); var BranchView = require('../view/branch'); +var config = require('../config'); var parent = null, view = null; @@ -36,7 +37,7 @@ var branch = { view = BranchView(parent.screen); - view.list.key(['enter'], function () { + view.list.key(config.keys.branch.checkOut, function () { try { parent.git.checkout(this.selected); branch.hide(true); @@ -46,7 +47,7 @@ var branch = { } }); - view.list.key(['C-d'], function () { + view.list.key(config.keys.branch.delete, function () { try { parent.git.delBranch(this.selected); branch.show(); @@ -56,7 +57,7 @@ var branch = { } }); - view.list.key(['C-a'], function () { + view.list.key(config.keys.branch.add, function () { view.prompt.input('Input the new branch name', '', function (err, value) { try { parent.git.addBranch(value); @@ -68,7 +69,7 @@ var branch = { }); }); - view.list.key(['escape'], function () { + view.list.key(config.keys.common.quit, function () { branch.hide(); }); } diff --git a/controller/diff.js b/controller/diff.js index 93a33a9..cbde447 100644 --- a/controller/diff.js +++ b/controller/diff.js @@ -1,4 +1,5 @@ var DiffView = require('../view/diff'); +var config = require('../config'); var parent = null, view = null; @@ -6,9 +7,9 @@ var parent = null, var diff = { colorFormat: function (diffText) { return diffText - .replace(/(^\-\s[\S\s]+?$)/gm, "{red-fg}$1{/red-fg}") - .replace(/(^\+\s[\S\s]+?$)/gm, "{green-fg}$1{/green-fg}") - .replace(/(^@@\s[\S\s]+?@@)/gm, "{cyan-fg}$1{/cyan-fg}"); + .replace(/(^\-.*$)/gm, "{red-fg}$1{/red-fg}") + .replace(/(^\+.*$)/gm, "{green-fg}$1{/green-fg}") + .replace(/(^@@.*$)/gm, "{cyan-fg}$1{/cyan-fg}"); }, show: function () { var diffText = parent.git.diff( @@ -34,8 +35,18 @@ var diff = { view = DiffView(parent.screen); - view.textarea.key(['escape', 'q'], function () { - diff.hide(); + view.textarea.key(config.keys.common.quit, function () { + diff.hide(); + }); + + view.textarea.key(config.keys.common.pageUp, function () { + view.textarea.scroll(-view.textarea.height || -1); + redraw(); + }); + + view.textarea.key(config.keys.common.pageDown, function () { + view.textarea.scroll(view.textarea.height || 1); + redraw(); }); } }; diff --git a/controller/editor.js b/controller/editor.js index 988cf42..ec83382 100644 --- a/controller/editor.js +++ b/controller/editor.js @@ -1,4 +1,5 @@ var EditorView = require('../view/editor'); +var config = require('../config'); var parent = null, view = null; @@ -22,7 +23,7 @@ var editor = { view = EditorView(parent.screen); - view.textarea.key(['C-s'], function () { + view.textarea.key(config.keys.editor.save, function () { var message = view.textarea.getValue(); parent.git.commit(message); @@ -30,7 +31,7 @@ var editor = { editor.hide(true); }); - view.textarea.key(['escape'], function () { + view.textarea.key(config.keys.common.quit, function () { editor.hide(); }); } diff --git a/controller/log.js b/controller/log.js index 2cfe995..1588310 100644 --- a/controller/log.js +++ b/controller/log.js @@ -1,4 +1,5 @@ var LogView = require('../view/log'); +var config = require('../config'); var parent = null, view = null; @@ -88,7 +89,7 @@ var log = { view = LogView(parent.screen); - view.list.key(['C-r'], function () { + view.list.key(config.keys.main.reset, function () { var item = logItems[view.list.selected]; view.confirm.ask("Are you sure to reset? (Y/N)\n", function (err, value) { @@ -102,13 +103,24 @@ var log = { }); }); - view.list.key(['escape', 'q'], function () { + view.list.key(config.keys.common.quit, function () { log.hide(); }); - view.confirm.key(['escape'], function () { + view.list.key(config.keys.common.pageUp, function () { + view.list.scroll(-view.list.height || -1); + redraw(); + }); + + view.list.key(config.keys.common.pageDown, function () { + view.list.scroll(view.list.height || 1); + redraw(); + }); + + view.confirm.key(config.keys.common.quit, function () { view.confirm.hide(); }); + } }; diff --git a/controller/main.js b/controller/main.js index 72eb53b..e0e95ae 100644 --- a/controller/main.js +++ b/controller/main.js @@ -8,6 +8,8 @@ var editor = require('./editor'), log = require('./log'), diff = require('./diff'); +var config = require('../config'); + // model control var git = new Git(__dirname); @@ -178,21 +180,31 @@ branch.init(main); // bind keys // TODO: Need to refactor _.each(view.list, function (elem) { - elem.key(['space'], function () { + elem.key(config.keys.main.select, function () { main.toggle.call(this); main.next.call(this); }); - elem.key(['enter'], function () { + elem.key(config.keys.main.selectAll, function () { main.selectAll(); }); - elem.key(['escape', 'q'], function () { + elem.key(config.keys.common.quit, function () { return process.exit(0); }); + elem.key(config.keys.common.pageUp, function () { + elem.move(-(elem.height - elem.iheight)); + redraw(); + }); + + elem.key(config.keys.common.pageDown, function () { + elem.move(elem.height - elem.iheight); + redraw(); + }); + // git commands - elem.key(['C-a'], function () { + elem.key(config.keys.main.add, function () { if (!view.list.unstaged.focused) { main.showPopup("It cannot work on Staged list"); return; @@ -207,25 +219,25 @@ _.each(view.list, function (elem) { main.reload(); }); - elem.key(['C-r'], function () { + elem.key(config.keys.main.reset, function () { git.reset(); main.reload(); }); - elem.key(['C-c'], function () { + elem.key(config.keys.main.commit, function () { if (git.getStagedFiles().length < 1) { - // TODO: alert + main.showPopup("You need to stage files first"); return; } main.show(editor); }); - elem.key(['C-l'], function () { + elem.key(config.keys.main.log, function () { main.show(log); }); - elem.key(['C-d'], function () { + elem.key(config.keys.main.diff, function () { if (this.getItem(this.selected) === undefined) { main.showPopup("There is no diff file you selected"); return; @@ -234,11 +246,11 @@ _.each(view.list, function (elem) { main.show(diff); }); - elem.key(['C-b'], function () { + elem.key(config.keys.main.showBranch, function () { main.show(branch); }); - elem.key(['tab'], function () { + elem.key(config.keys.main.togglePanes, function () { if (view.list.staged.interactive) { main.moveToUnstaged(); } else { @@ -246,11 +258,11 @@ _.each(view.list, function (elem) { } }); - elem.key(['left'], function () { + elem.key(config.keys.main.leftPane, function () { main.moveToStaged(); }); - elem.key(['right'], function () { + elem.key(config.keys.main.leftPane, function () { main.moveToUnstaged(); }); }); diff --git a/view/branch.js b/view/branch.js index 13cfe0f..c78a584 100644 --- a/view/branch.js +++ b/view/branch.js @@ -1,5 +1,6 @@ var blessed = require('blessed'), - styles = require('./style/branch.json'); + config = require('../config'), + styles = require('./style/branch')(config); var layout = null, list = null, diff --git a/view/diff.js b/view/diff.js index a4b1dc5..2573158 100644 --- a/view/diff.js +++ b/view/diff.js @@ -1,5 +1,6 @@ var blessed = require('blessed'), - styles = require('./style/diff.json'); + config = require('../config'), + styles = require('./style/diff')(config); var layout = null, textarea = null, diff --git a/view/editor.js b/view/editor.js index ba7e55e..b6de5c7 100644 --- a/view/editor.js +++ b/view/editor.js @@ -1,5 +1,6 @@ var blessed = require('blessed'), - styles = require('./style/editor.json'); + config = require('../config'), + styles = require('./style/editor')(config); var layout = null, textarea = null, diff --git a/view/log.js b/view/log.js index a394b1a..c9399f7 100644 --- a/view/log.js +++ b/view/log.js @@ -1,5 +1,6 @@ var blessed = require('blessed'), - styles = require('./style/log.json'); + config = require('../config'), + styles = require('./style/log')(config); var layout = null, list = null, diff --git a/view/main.js b/view/main.js index bc4ac47..a25ec0a 100644 --- a/view/main.js +++ b/view/main.js @@ -1,6 +1,7 @@ var _ = require('lodash'), blessed = require('blessed'), - styles = require('./style/main.json'); + config = require('../config'), + styles = require('./style/main')(config); // build layout var screen = blessed.screen(styles.screen); diff --git a/view/style/branch.js b/view/style/branch.js new file mode 100644 index 0000000..10cbb14 --- /dev/null +++ b/view/style/branch.js @@ -0,0 +1,74 @@ +'use strict'; + +module.exports = function (config) { + return { + "layout": { + "hidden": true, + "top": "center", + "left": "center", + "width": "50%", + "height": "50%" + }, + "list": { + "top": "top", + "left": "left", + "width": "100%", + "height": "100%-4", + "data": null, + "border": "line", + "align": "left", + "vi": true, + "keys": true, + "style": { + "border": { + "fg": "white" + }, + "selected": { + "bg": "blue" + } + } + }, + "menubar": { + "align": "center", + "bottom": 0, + "width": "100%", + "height": 3, + "border": "line", + "mouse": true, + "vi": true, + "keys": true, + "style": { + "prefix": { + "fg": "white" + }, + "item": { + "fg": "cyan" + }, + "selected": { + "fg": "cyan" + } + }, + "commands": { + "CHECKOUT": { + "keys": config.keys.branch.checkOut + }, + "ADD": { + "keys": config.keys.branch.add + }, + "DEL": { + "keys": config.keys.branch.delete + } + } + }, + "prompt": { + "top": "center", + "left": "center", + "width": "80%", + "height": "shrink", + "border": "line", + "align": "left", + "vi": true, + "keys": true + } + }; +}; diff --git a/view/style/branch.json b/view/style/branch.json deleted file mode 100644 index 9d34e3f..0000000 --- a/view/style/branch.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "layout": { - "hidden": true, - "top": "center", - "left": "center", - "width": "50%", - "height": "50%" - }, - "list": { - "top": "top", - "left": "left", - "width": "100%", - "height": "100%-4", - "data": null, - "border": "line", - "align": "left", - "vi": true, - "keys": true, - "style": { - "border": { - "fg": "white" - }, - "selected": { - "bg": "blue" - } - } - }, - "menubar": { - "align": "center", - "bottom": 0, - "width": "100%", - "height": 3, - "border": "line", - "mouse": true, - "vi": true, - "keys": true, - "style": { - "prefix": { - "fg": "white" - }, - "item": { - "fg": "cyan" - }, - "selected": { - "fg": "cyan" - } - }, - "commands": { - "CHECKOUT": { - "keys": [ - "ENTER" - ] - }, - "ADD": { - "keys": [ - "C-a" - ] - }, - "DEL": { - "keys": [ - "C-d" - ] - } - } - }, - "prompt": { - "top": "center", - "left": "center", - "width": "80%", - "height": "shrink", - "border": "line", - "align": "left", - "vi": true, - "keys": true - } -} diff --git a/view/style/diff.js b/view/style/diff.js new file mode 100644 index 0000000..907ed10 --- /dev/null +++ b/view/style/diff.js @@ -0,0 +1,67 @@ +'use strict'; + +module.exports = function (config) { + return { + "layout": { + "hidden": true, + "top": "center", + "left": "center", + "width": "100%", + "height": "100%" + }, + "textarea": { + "top": "top", + "left": "left", + "width": "100%", + "height": "100%-3", + "border": "line", + "tags": true, + "scrollable": true, + "mouse": true, + "keys": true, + "padding": { + "left": 1, + "right": 1 + }, + "scrollbar": { + "ch": " " + }, + "style": { + "scrollbar": { + "inverse": true + } + } + }, + "menubar": { + "align": "center", + "bottom": 0, + "width": "100%", + "height": 3, + "mouse": true, + "border": "line", + "keys": true, + "style": { + "prefix": { + "fg": "white" + }, + "item": { + "fg": "cyan" + }, + "selected": { + "fg": "cyan" + } + }, + "commands": { + "EXIT": { + "keys": config.keys.common.quit + }, + "PAGE DOWN": { + "keys": config.keys.common.pageDown + }, + "PAGE UP": { + "keys": config.keys.common.pageUp + } + } + } + }; +}; diff --git a/view/style/diff.json b/view/style/diff.json deleted file mode 100644 index b42b0a5..0000000 --- a/view/style/diff.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "layout": { - "hidden": true, - "top": "center", - "left": "center", - "width": "100%", - "height": "100%" - }, - "textarea": { - "top": "top", - "left": "left", - "width": "100%", - "height": "100%-3", - "border": "line", - "tags": true, - "scrollable": true, - "mouse": true, - "vi": true, - "keys": true, - "padding": { - "left": 1, - "right": 1 - }, - "scrollbar": { - "ch": " " - }, - "style": { - "scrollbar": { - "inverse": true - } - } - }, - "menubar": { - "align": "center", - "bottom": 0, - "width": "100%", - "height": 3, - "mouse": true, - "border": "line", - "vi": true, - "keys": true, - "style": { - "prefix": { - "fg": "white" - }, - "item": { - "fg": "cyan" - }, - "selected": { - "fg": "cyan" - } - }, - "commands": { - "EXIT": { - "keys": [ - "ESC" - ] - }, - "PAGE DOWN": { - "keys": [ - "C-f" - ] - }, - "PAGE UP": { - "keys": [ - "C-b" - ] - } - } - } -} diff --git a/view/style/editor.js b/view/style/editor.js new file mode 100644 index 0000000..7a53e9a --- /dev/null +++ b/view/style/editor.js @@ -0,0 +1,59 @@ +'use strict'; + +module.exports = function (config) { + return { + "layout": { + "hidden": true, + "top": "center", + "left": "center", + "width": "80%", + "height": "70%" + }, + "textarea": { + "top": "top", + "left": "left", + "width": "100%", + "height": "100%-3", + "border": "line", + "mouse": true, + "vi": true, + "keys": true, + "padding": { + "left": 1, + "right": 1 + }, + "style": { + "bg": "blue" + } + }, + "menubar": { + "align": "center", + "bottom": 0, + "width": "100%", + "height": 3, + "mouse": true, + "border": "line", + "vi": true, + "keys": true, + "style": { + "prefix": { + "fg": "white" + }, + "item": { + "fg": "cyan" + }, + "selected": { + "fg": "cyan" + } + }, + "commands": { + "SAVE & COMMIT": { + "keys": config.keys.editor.save + }, + "CANCEL": { + "keys": config.keys.common.quit + } + } + } + }; +}; diff --git a/view/style/editor.json b/view/style/editor.json deleted file mode 100644 index c8d4fca..0000000 --- a/view/style/editor.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "layout": { - "hidden": true, - "top": "center", - "left": "center", - "width": "80%", - "height": "70%" - }, - "textarea": { - "top": "top", - "left": "left", - "width": "100%", - "height": "100%-3", - "border": "line", - "mouse": true, - "vi": true, - "keys": true, - "padding": { - "left": 1, - "right": 1 - }, - "style": { - "bg": "blue" - } - }, - "menubar": { - "align": "center", - "bottom": 0, - "width": "100%", - "height": 3, - "mouse": true, - "border": "line", - "vi": true, - "keys": true, - "style": { - "prefix": { - "fg": "white" - }, - "item": { - "fg": "cyan" - }, - "selected": { - "fg": "cyan" - } - }, - "commands": { - "SAVE & COMMIT": { - "keys": [ - "C-s" - ] - }, - "CANCEL": { - "keys": [ - "ESC" - ] - } - } - } -} diff --git a/view/style/log.js b/view/style/log.js new file mode 100644 index 0000000..87ee865 --- /dev/null +++ b/view/style/log.js @@ -0,0 +1,78 @@ +'use strict'; + +module.exports = function (config) { + return { + "layout": { + "hidden": true, + "top": "center", + "left": "center", + "width": "100%", + "height": "100%" + }, + "list": { + "top": "top", + "left": "left", + "data": null, + "border": "line", + "align": "left", + "tags": true, + "width": "100%", + "height": "100%-3", + "mouse": true, + "vi": true, + "keys": true, + "style": { + "border": { + "fg": "white" + }, + "selected": { + "bg": "blue" + } + } + }, + "confirm": { + "border": "line", + "height": "shrink", + "width": "half", + "top": "center", + "left": "center", + "keys": true, + "vi": true + }, + "menubar": { + "align": "center", + "bottom": 0, + "width": "100%", + "height": 3, + "mouse": true, + "border": "line", + "vi": true, + "keys": true, + "style": { + "prefix": { + "fg": "white" + }, + "item": { + "fg": "cyan" + }, + "selected": { + "fg": "cyan" + } + }, + "commands": { + "RESET COMMIT": { + "keys": config.keys.main.reset + }, + "CANCEL": { + "keys": config.keys.common.quit + }, + "PAGE DOWN": { + "keys": config.keys.common.pageDown + }, + "PAGE UP": { + "keys": config.keys.common.pageUp + } + } + } + }; +}; diff --git a/view/style/log.json b/view/style/log.json deleted file mode 100644 index 90d6ec6..0000000 --- a/view/style/log.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "layout": { - "hidden": true, - "top": "center", - "left": "center", - "width": "100%", - "height": "100%" - }, - "list": { - "top": "top", - "left": "left", - "data": null, - "border": "line", - "align": "left", - "tags": true, - "width": "100%", - "height": "100%-3", - "mouse": true, - "vi": true, - "keys": true, - "style": { - "border": { - "fg": "white" - }, - "selected": { - "bg": "blue" - } - } - }, - "confirm": { - "border": "line", - "height": "shrink", - "width": "half", - "top": "center", - "left": "center", - "keys": true, - "vi": true - }, - "menubar": { - "align": "center", - "bottom": 0, - "width": "100%", - "height": 3, - "mouse": true, - "border": "line", - "vi": true, - "keys": true, - "style": { - "prefix": { - "fg": "white" - }, - "item": { - "fg": "cyan" - }, - "selected": { - "fg": "cyan" - } - }, - "commands": { - "RESET COMMIT": { - "keys": [ - "C-r" - ] - }, - "CANCEL": { - "keys": [ - "ESC" - ] - }, - "PAGE DOWN": { - "keys": [ - "C-f" - ] - }, - "PAGE UP": { - "keys": [ - "C-b" - ] - } - } - } -} diff --git a/view/style/main.js b/view/style/main.js new file mode 100644 index 0000000..6d505e9 --- /dev/null +++ b/view/style/main.js @@ -0,0 +1,193 @@ +'use strict'; + +module.exports = function (config) { + return { + "screen": { + "autoPadding": false, + "fullUnicode": true + }, + "title": { + "staged": { + "top": "top", + "left": "left", + "width": "50%", + "height": 3, + "align": "center", + "content": "Staged Files", + "tags": true, + "border": { + "type": "none" + }, + "style": { + "fg": "green" + } + }, + "unstaged": { + "top": "top", + "left": "50%", + "width": "50%", + "height": 3, + "align": "center", + "content": "Not Staged Files", + "tags": true, + "border": { + "type": "none" + }, + "style": { + "fg": "red" + } + } + }, + "list": { + "staged": { + "top": "top+2", + "left": "left", + "data": null, + "border": "line", + "align": "left", + "tags": true, + "width": "50%", + "height": "100%-6", + "interactive": false, + "keys": true, + "style": { + "border": { + "fg": "green" + }, + "selected": { + "bg": "blue" + } + } + }, + "unstaged": { + "top": "top+2", + "left": "50%", + "data": null, + "border": "line", + "align": "left", + "tags": true, + "width": "50%", + "height": "100%-6", + "interactive": true, + "keys": true, + "style": { + "border": { + "fg": "red" + }, + "selected": { + "bg": "blue" + } + } + } + }, + "branchbox": { + "bottom": 3, + "height": 1, + "width": "100%", + "align": "right", + "padding": { + "right": 2 + }, + "style": { + "fg": "yellow" + } + }, + "menubar1": { + "align": "center", + "bottom": 1, + "height": 2, + "mouse": true, + "vi": true, + "keys": true, + "style": { + "prefix": { + "fg": "white" + }, + "item": { + "fg": "cyan" + }, + "selected": { + "fg": "cyan" + } + }, + "commands": { + "SELECT": { + "keys": config.keys.main.select + }, + "ADD": { + "keys": config.keys.main.add + }, + "RESET": { + "keys": config.keys.main.reset + }, + "COMMIT": { + "keys": config.keys.main.commit + } + } + }, + "menubar2": { + "align": "center", + "bottom": 1, + "height": 1, + "mouse": true, + "vi": true, + "keys": true, + "style": { + "prefix": { + "fg": "white" + }, + "item": { + "fg": "cyan" + }, + "selected": { + "fg": "cyan" + } + }, + "commands": { + "ALL ": { + "keys": config.keys.main.selectAll + }, + "LOG": { + "keys": config.keys.main.log + }, + "DIFF ": { + "keys": config.keys.main.diff + }, + "BRANCH": { + "keys": config.keys.main.showBranch + } + } + }, + "loading": { + "top": "center", + "left": "center", + "align": "center", + "height": 5, + "width": "50%", + "tags": true, + "hidden": true, + "border": "line" + }, + "popup": { + "top": "center", + "left": "center", + "align": "left", + "height": "shrink", + "width": "shrink", + "tags": true, + "hidden": true, + "border": "line", + "padding": { + "top": 1, + "bottom": 1, + "left": 3, + "right": 3 + }, + "style": { + "border": { + "fg": "red" + } + } + } + }; +}; diff --git a/view/style/main.json b/view/style/main.json deleted file mode 100644 index 171c5eb..0000000 --- a/view/style/main.json +++ /dev/null @@ -1,205 +0,0 @@ -{ - "screen": { - "autoPadding": false, - "fullUnicode": true - }, - "title": { - "staged": { - "top": "top", - "left": "left", - "width": "50%", - "height": 3, - "align": "center", - "content": "Staged Files", - "tags": true, - "border": { - "type": "none" - }, - "style": { - "fg": "green" - } - }, - "unstaged": { - "top": "top", - "left": "50%", - "width": "50%", - "height": 3, - "align": "center", - "content": "Not Staged Files", - "tags": true, - "border": { - "type": "none" - }, - "style": { - "fg": "red" - } - } - }, - "list": { - "staged": { - "top": "top+2", - "left": "left", - "data": null, - "border": "line", - "align": "left", - "tags": true, - "width": "50%", - "height": "100%-6", - "interactive": false, - "keys": true, - "style": { - "border": { - "fg": "green" - }, - "selected": { - "bg": "blue" - } - } - }, - "unstaged": { - "top": "top+2", - "left": "50%", - "data": null, - "border": "line", - "align": "left", - "tags": true, - "width": "50%", - "height": "100%-6", - "interactive": true, - "keys": true, - "style": { - "border": { - "fg": "red" - }, - "selected": { - "bg": "blue" - } - } - } - }, - "branchbox": { - "bottom": 3, - "height": 1, - "width": "100%", - "align": "right", - "padding": { - "right": 2 - }, - "style": { - "fg": "yellow" - } - }, - "menubar1": { - "align": "center", - "bottom": 1, - "height": 2, - "mouse": true, - "vi": true, - "keys": true, - "style": { - "prefix": { - "fg": "white" - }, - "item": { - "fg": "cyan" - }, - "selected": { - "fg": "cyan" - } - }, - "commands": { - "SELECT": { - "keys": [ - "SPC" - ] - }, - "ADD": { - "keys": [ - "C-a" - ] - }, - "RESET": { - "keys": [ - "C-r" - ] - }, - "COMMIT": { - "keys": [ - "C-c" - ] - } - } - }, - "menubar2": { - "align": "center", - "bottom": 1, - "height": 1, - "mouse": true, - "vi": true, - "keys": true, - "style": { - "prefix": { - "fg": "white" - }, - "item": { - "fg": "cyan" - }, - "selected": { - "fg": "cyan" - } - }, - "commands": { - "ALL ": { - "keys": [ - "ENTER" - ] - }, - "LOG": { - "keys": [ - "C-l" - ] - }, - "DIFF ": { - "keys": [ - "C-d" - ] - }, - "BRANCH": { - "keys": [ - "C-b" - ] - } - } - }, - "loading": { - "top": "center", - "left": "center", - "align": "center", - "height": 5, - "width": "50%", - "tags": true, - "hidden": true, - "border": "line" - }, - "popup": { - "top": "center", - "left": "center", - "align": "left", - "height": "shrink", - "width": "shrink", - "tags": true, - "hidden": true, - "border": "line", - "padding": { - "top": 1, - "bottom": 1, - "left": 3, - "right": 3 - }, - "style": { - "border": { - "fg": "red" - } - } - } -}