[gtksourceview] vim: use ctrl+shift+v to paste in insert mode
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] vim: use ctrl+shift+v to paste in insert mode
- Date: Thu, 6 Jan 2022 23:50:53 +0000 (UTC)
commit f11a4d000fca1a0d5f0b9d3a2c33f76fa3e7d74e
Author: Christian Hergert <chergert redhat com>
Date: Thu Jan 6 15:50:15 2022 -0800
vim: use ctrl+shift+v to paste in insert mode
Most terminal users are used to ctrl+shift+v to paste into the terminal
and therefore are likely to have that mental model built in when using
Vim there. This just makes it a bit nicer by making that work here too.
gtksourceview/vim/gtksourceviminsert.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/gtksourceview/vim/gtksourceviminsert.c b/gtksourceview/vim/gtksourceviminsert.c
index c9d2719e..516921a1 100644
--- a/gtksourceview/vim/gtksourceviminsert.c
+++ b/gtksourceview/vim/gtksourceviminsert.c
@@ -100,6 +100,7 @@ gtk_source_vim_insert_handle_keypress (GtkSourceVimState *state,
const char *string)
{
GtkSourceVimInsert *self = (GtkSourceVimInsert *)state;
+ GtkSourceView *view;
g_assert (GTK_SOURCE_IS_VIM_STATE (state));
g_assert (string != NULL);
@@ -112,6 +113,8 @@ gtk_source_vim_insert_handle_keypress (GtkSourceVimState *state,
return TRUE;
}
+ view = gtk_source_vim_state_get_view (state);
+
/* Now handle our commands */
if ((mods & GDK_CONTROL_MASK) != 0)
{
@@ -126,6 +129,11 @@ gtk_source_vim_insert_handle_keypress (GtkSourceVimState *state,
gtk_source_vim_state_push (state, gtk_source_vim_insert_literal_new ());
return TRUE;
+ case GDK_KEY_V:
+ /* For the terminal users out there */
+ g_signal_emit_by_name (view, "paste-clipboard");
+ return TRUE;
+
default:
break;
}
@@ -179,7 +187,6 @@ gtk_source_vim_insert_handle_event (GtkSourceVimState *state,
if (gdk_event_get_event_type (event) != GDK_KEY_PRESS)
return TRUE;
-
gtk_source_vim_state_keyval_to_string (keyval, mods, string);
return GTK_SOURCE_VIM_STATE_GET_CLASS (self)->handle_keypress (state, keyval, keycode, mods, string);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]