Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
From: marc.hartstein@alum.vassar.edu (Marc Hartstein)
Subject: [sup-talk] [PATCH] Vi-style scroll keys
Date: Wed, 23 Apr 2008 20:43:12 -0400	[thread overview]
Message-ID: <1208997793-14546-1-git-send-email-marc.hartstein@alum.vassar.edu> (raw)

Adds ^f/^b ^d/^u ^e/^y keybindings to scroll-mode.
---
 lib/sup/modes/scroll-mode.rb |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/lib/sup/modes/scroll-mode.rb b/lib/sup/modes/scroll-mode.rb
index 922bf92..2d70fef 100644
--- a/lib/sup/modes/scroll-mode.rb
+++ b/lib/sup/modes/scroll-mode.rb
@@ -15,12 +15,14 @@ class ScrollMode < Mode
   COL_JUMP = 2
 
   register_keymap do |k|
-    k.add :line_down, "Down one line", :down, 'j', 'J'
-    k.add :line_up, "Up one line", :up, 'k', 'K'
+    k.add :line_down, "Down one line", :down, 'j', 'J', "\C-e"
+    k.add :line_up, "Up one line", :up, 'k', 'K', "\C-y"
     k.add :col_left, "Left one column", :left, 'h'
     k.add :col_right, "Right one column", :right, 'l'
-    k.add :page_down, "Down one page", :page_down, ' '
-    k.add :page_up, "Up one page", :page_up, 'p', :backspace
+    k.add :page_down, "Down one page", :page_down, ' ', "\C-f"
+    k.add :page_up, "Up one page", :page_up, 'p', :backspace, "\C-b"
+    k.add :half_page_down, "Down one half page", "\C-d"
+    k.add :half_page_up, "Up one half page", "\C-u"
     k.add :jump_to_start, "Jump to top", :home, '^', '1'
     k.add :jump_to_end, "Jump to bottom", :end, '$', '0'
     k.add :jump_to_left, "Jump to the left", '['
@@ -130,6 +132,8 @@ class ScrollMode < Mode
   def line_up;  jump_to_line @topline - 1; end
   def page_down; jump_to_line @topline + buffer.content_height - @slip_rows; end
   def page_up; jump_to_line @topline - buffer.content_height + @slip_rows; end
+  def half_page_down; jump_to_line @topline + buffer.content_height / 2; end
+  def half_page_up; jump_to_line @topline - buffer.content_height / 2; end
   def jump_to_start; jump_to_line 0; end
   def jump_to_end; jump_to_line lines - buffer.content_height; end
 
-- 
1.5.3.7



             reply	other threads:[~2008-04-24  0:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-24  0:43 Marc Hartstein [this message]
2008-04-24  0:43 ` [sup-talk] [PATCH] Fixes alignment when printing help screen if \C-x is bound Marc Hartstein

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1208997793-14546-1-git-send-email-marc.hartstein@alum.vassar.edu \
    --to=marc.hartstein@alum.vassar.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox