summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--AUTHORS1
-rw-r--r--changelog.rst1
-rw-r--r--pgcli/key_bindings.py6
3 files changed, 8 insertions, 0 deletions
diff --git a/AUTHORS b/AUTHORS
index 1e8169b9..034a1ea3 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -97,6 +97,7 @@ Contributors:
* Zane C. Bowers-Hadley
* Telmo "Trooper" (telmotrooper)
* Alexander Zawadzki
+ * Pablo A. Bianchi (pabloab)
Creator:
--------
diff --git a/changelog.rst b/changelog.rst
index a49e0ddf..a4ae7cb6 100644
--- a/changelog.rst
+++ b/changelog.rst
@@ -889,6 +889,7 @@ Features:
* Cancel a command using Ctrl+C. (Thanks: https://github.com/macobo)
* Faster startup by reading all columns and tables in a single query. (Thanks: https://github.com/macobo)
* Improved psql compliance with env vars and password prompting. (Thanks: `Darik Gamble`_)
+* Pressing Alt-Enter will introduce a line break. This is a way to break up the query into multiple lines without switching to multi-line mode. (Thanks: https://github.com/pabloab).
Bug Fixes:
----------
diff --git a/pgcli/key_bindings.py b/pgcli/key_bindings.py
index cc078977..626cd142 100644
--- a/pgcli/key_bindings.py
+++ b/pgcli/key_bindings.py
@@ -90,4 +90,10 @@ def pgcli_bindings(pgcli):
event.current_buffer.complete_state = None
event.app.current_buffer.complete_state = None
+ @kb.add("escape", "enter")
+ def _(event):
+ """Introduces a line break regardless of multi-line mode or not."""
+ _logger.debug("Detected alt-enter key.")
+ event.app.current_buffer.insert_text("\n")
+
return kb