Keys in status line (p in vi mode, M-y in emacs) to paste the first line of the upper paste buffer. Suggested by Dan Colish.

This commit is contained in:
Nicholas Marriott
2009-05-14 19:36:56 +00:00
parent 8931f0018a
commit cba338ac13
4 changed files with 44 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $Id: mode-key.c,v 1.11 2009-05-04 17:58:27 nicm Exp $ */
/* $Id: mode-key.c,v 1.12 2009-05-14 19:36:56 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@ -54,6 +54,13 @@ mode_key_lookup(struct mode_key_data *mdata, int key)
enum mode_key_cmd
mode_key_lookup_vi(struct mode_key_data *mdata, int key)
{
if (KEYC_ISESC(key)) {
key = KEYC_REMOVEESC(key);
if (mdata->flags & MODEKEY_CANEDIT)
mdata->flags ^= MODEKEY_EDITMODE;
}
if (mdata->flags & MODEKEY_EDITMODE) {
switch (key) {
case '\003':
@ -131,6 +138,8 @@ mode_key_lookup_vi(struct mode_key_data *mdata, int key)
case 'k':
case KEYC_UP:
return (MODEKEYCMD_UP);
case 'p':
return (MODEKEYCMD_PASTE);
}
return (MODEKEYCMD_NONE);
@ -173,6 +182,8 @@ mode_key_lookup_emacs(struct mode_key_data *mdata, int key)
return (MODEKEYCMD_NEXTPAGE);
case KEYC_ADDESC('f'):
return (MODEKEYCMD_NEXTWORD);
case '\031':
return (MODEKEYCMD_PASTE);
case KEYC_ADDESC('v'):
case KEYC_PPAGE:
return (MODEKEYCMD_PREVIOUSPAGE);