Skip to main content
Fix confusing syntax
Source Link
aecolley
  • 2.2k
  • 16
  • 15

Here's a way. It assumes you have the default key bindings.

bind '"\C-m": "\C-l\C-j"'

The \C-m simulatingintercepts the 'Enter' key, the \C-l simulating (Ctrl+lCtrl+L as it's clear) executes the Bash clear-screen function, and the \C-j is "newline-and-indent",executes the Bash newline-and-indent function; so the command is binding Enter key to Ctrl+lCtrl+L & Ctrl+jCtrl+J

Here's a way. It assumes you have the default key bindings.

bind '"\C-m": "\C-l\C-j"'

The \C-m simulating the 'Enter' key, the \C-l simulating Ctrl+l as it's clear and the \C-j is "newline-and-indent", so the command is binding Enter key to Ctrl+l & Ctrl+j

Here's a way. It assumes you have the default key bindings.

bind '"\C-m": "\C-l\C-j"'

The \C-m intercepts the 'Enter' key, the \C-l (Ctrl+L) executes the Bash clear-screen function, and the \C-j executes the Bash newline-and-indent function; so the command is binding Enter key to Ctrl+L & Ctrl+J

added 239 characters in body
Source Link
αғsнιη
  • 41.9k
  • 17
  • 75
  • 118

Here's a way. It assumes you have the default key bindings.

bind '"\C-m": "\C-l\C-j"'

bind '"\C-m": "\C-l\C-j"'

The \C-m simulating the 'Enter' key, the \C-l simulating Ctrl+l as it's clear and the \C-j is "newline-and-indent", so the command is binding Enter key to Ctrl+l & Ctrl+j

Here's a way. It assumes you have the default key bindings.

bind '"\C-m": "\C-l\C-j"'

Here's a way. It assumes you have the default key bindings.

bind '"\C-m": "\C-l\C-j"'

The \C-m simulating the 'Enter' key, the \C-l simulating Ctrl+l as it's clear and the \C-j is "newline-and-indent", so the command is binding Enter key to Ctrl+l & Ctrl+j

Source Link
aecolley
  • 2.2k
  • 16
  • 15

Here's a way. It assumes you have the default key bindings.

bind '"\C-m": "\C-l\C-j"'