diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2012-07-31 21:34:49 +0100 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2012-08-01 07:56:12 +0100 |
commit | 21d106c1dfb0c1ef7c743490178d1b7447b2b7c9 (patch) | |
tree | f4c1b54b11c7aff71177e5bba97c408238500182 | |
parent | 8bcd5560af59e2476272e64559d7461ec7247342 (diff) |
read default bindings from default/default.bindings
This re-introduces a separate file containing the default keybindings
for alot. The values from this file are *always* used as fallbacks
and can be overwritten by bindings from the users config.
To be able to unbind a default binding just bind it to an empty string.
The same will allow buffer-local bindings to be overwritten by global
bindings as described in https://github.com/pazz/alot/issues/403#issuecomment-4434948.
cf issue #487
-rw-r--r-- | alot/defaults/default.bindings | 66 | ||||
-rw-r--r-- | alot/settings/__init__.py | 8 | ||||
-rwxr-xr-x | setup.py | 1 |
3 files changed, 72 insertions, 3 deletions
diff --git a/alot/defaults/default.bindings b/alot/defaults/default.bindings new file mode 100644 index 00000000..204f3cb6 --- /dev/null +++ b/alot/defaults/default.bindings @@ -0,0 +1,66 @@ +j = move down +k = move up +' ' = move page down +esc = cancel +enter = select +@ = refresh +? = help bindings +I = search tag:inbox AND NOT tag:killed +L = taglist +shift tab = bprevious +U = search tag:unread +tab = bnext +\ = prompt 'search ' +d = bclose +$ = flush +m = compose +o = prompt 'search ' +q = exit +';' = bufferlist +':' = prompt + +[bufferlist] + x = close + select = openfocussed + +[search] + a = toggletags inbox + & = toggletags killed + ! = toggletags flagged + s = toggletags unread + l = retagprompt + O = refineprompt + | = refineprompt + +[envelope] + a = prompt 'attach ~/' + y = send + P = save + s = 'refine Subject' + t = 'refine To' + b = 'refine Bcc' + c = 'refine Cc' + S = togglesign + select = edit + H = toggleheaders + +[taglist] + +[thread] + C = fold --all + E = unfold --all + c = fold + e = unfold + < = fold + > = unfold + H = toggleheaders + h = togglesource + P = print --all --separately --add_tags + S = save --all + g = reply --all + f = forward + p = print --add_tags + n = editnew + s = save + r = reply + | = prompt 'pipeto ' diff --git a/alot/settings/__init__.py b/alot/settings/__init__.py index 0edfc24c..35599fa8 100644 --- a/alot/settings/__init__.py +++ b/alot/settings/__init__.py @@ -44,8 +44,8 @@ class SettingsManager(object): theme_path = theme or os.path.join(DEFAULTSPATH, 'default.theme') self._theme = Theme(theme_path) - self._bindings = ConfigObj() - + bindings_path = os.path.join(DEFAULTSPATH, 'default.bindings') + self._bindings = ConfigObj(bindings_path) self._config = ConfigObj() self._accounts = None self._accountmap = None @@ -331,7 +331,9 @@ class SettingsManager(object): cmdline = bindings[key] if mode in bindings.sections: if key in bindings[mode].scalars: - cmdline = bindings[mode][key] + value = bindings[mode][key] + if value: + cmdline = value return cmdline def get_accounts(self): @@ -18,6 +18,7 @@ setup(name='alot', 'defaults/notmuch.rc.spec', 'defaults/abook_contacts.spec', 'defaults/default.theme', + 'defaults/default.bindings', 'defaults/config.stub', 'defaults/theme.spec', ]}, |