diff options
| author | Maxime Coste <mawww@kakoune.org> | 2018-09-03 22:15:28 +1000 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2018-09-03 22:15:28 +1000 |
| commit | 4b7e77ae000083ad0eb2400e03738ebe7453db14 (patch) | |
| tree | a196a5ed12000051fd022a16fea96e6b1946fc9f /src/input_handler.cc | |
| parent | 60a338b9bdf7ab35ad0c63664c0664971128ac41 (diff) | |
Change line editing bindings to match readline's
In the end, no better solution materialized so far, and custom
Kakoune line editing bindings are hard to remember. Using well
known readline bindings seems just more convenient.
Closes #800, although it does not contain all the binding proposed
by it (I might accept a few additional ones, such as <c-w>, but not
too much, I still see that as a hack pending a nicer solution).
Diffstat (limited to 'src/input_handler.cc')
| -rw-r--r-- | src/input_handler.cc | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/input_handler.cc b/src/input_handler.cc index 260dbf30..df63933c 100644 --- a/src/input_handler.cc +++ b/src/input_handler.cc @@ -437,21 +437,21 @@ public: void handle_key(Key key) { - if (key == Key::Left or key == alt('h')) + if (key == Key::Left or key == ctrl('b')) { if (m_cursor_pos > 0) --m_cursor_pos; } - else if (key == Key::Right or key == alt('l')) + else if (key == Key::Right or key == ctrl('f')) { if (m_cursor_pos < m_line.char_length()) ++m_cursor_pos; } - else if (key == Key::Home) + else if (key == Key::Home or key == ctrl('a')) m_cursor_pos = 0; - else if (key == Key::End) + else if (key == Key::End or key == ctrl('e')) m_cursor_pos = m_line.char_length(); - else if (key == Key::Backspace or key == alt('x')) + else if (key == Key::Backspace or key == ctrl('h')) { if (m_cursor_pos != 0) { @@ -461,23 +461,23 @@ public: --m_cursor_pos; } } - else if (key == Key::Delete or key == alt('d')) + else if (key == Key::Delete or key == ctrl('d')) { if (m_cursor_pos != m_line.char_length()) m_line = m_line.substr(0, m_cursor_pos) + m_line.substr(m_cursor_pos+1); } - else if (key == ctrl('w')) + else if (key == alt('f')) to_next_word_begin<Word>(m_cursor_pos, m_line); - else if (key == ctrl(alt('w'))) + else if (key == alt('W')) to_next_word_begin<WORD>(m_cursor_pos, m_line); - else if (key == ctrl('b')) + else if (key == alt('b')) to_prev_word_begin<Word>(m_cursor_pos, m_line); - else if (key == ctrl(alt('b'))) + else if (key == alt('B')) to_prev_word_begin<WORD>(m_cursor_pos, m_line); - else if (key == ctrl('e')) + else if (key == alt('e')) to_next_word_end<Word>(m_cursor_pos, m_line); - else if (key == ctrl(alt('e'))) + else if (key == alt('E')) to_next_word_end<WORD>(m_cursor_pos, m_line); else if (key == ctrl('k')) m_line = m_line.substr(0_char, m_cursor_pos).str(); |
