class EmacsHelp::Command
Public Class Methods
new(argv=[])
click to toggle source
# File lib/emacs_help.rb, line 14 def initialize(argv=[]) @argv = argv data_path = File.join(ENV['HOME'], '.hikirc') end
run(argv=[])
click to toggle source
# File lib/emacs_help.rb, line 6 def self.run(argv=[]) print "\n 特殊キー操作:" print "\tc-f, controlキーを押しながらf \n" print "\t\tM-f, escキーを押した後一度離してf\n" print "\t操作の中断c-g, 操作の取り消し(Undo) c-x u \n\n" new(argv).execute end
Public Instance Methods
buffer()
click to toggle source
# File lib/emacs_help.rb, line 71 def buffer puts "バッファー操作buffer" cont =[ "c-x b, show Buffer, バッファのリスト", "c-x c-b, next Buffer, 次のバッファへ移動"] disp(cont) end
cursor_move()
click to toggle source
# File lib/emacs_help.rb, line 109 def cursor_move puts "カーソル移動cursor" cont = ["c-f, move Forwrard, 前・右へ", "c-b, move Backwrard, 後・左へ", "c-a, go Ahead of line, 行頭へ", "c-e, go End of line, 行末へ", "c-n, move Next line, 次行へ", "c-p, move Previous line, 前行へ"] disp(cont) end
disp(lines)
click to toggle source
# File lib/emacs_help.rb, line 42 def disp(lines) lines.each{|line| if line.include?(',') show line else puts line end } end
edit()
click to toggle source
# File lib/emacs_help.rb, line 78 def edit puts "編集操作editor" cont = ["c-d, Delete char, 一字削除", "c-k, Kill line, 一行抹消,カット", "c-y, Yank, ペースト", "c-w, Kill region, 領域抹消,カット", "領域選択は,先頭・最後尾でc-spaceした後,最後尾・先頭へカーソル移動", "c-s, forward incremental Search WORD, 前へWORDを検索", "c-r, backward incremental search WORD, 後へWORDを検索", "M-x query-replace WORD1 <return> WORD2:一括置換(y or nで選択)"] disp(cont) end
execute()
click to toggle source
# File lib/emacs_help.rb, line 19 def execute @argv << '--help' if @argv.size==0 command_parser = OptionParser.new do |opt| opt.on('-v', '--version','show program Version.') { |v| opt.version = EmacsHelp::VERSION puts opt.ver } opt.on('-c','--カーソル','Cursor移動') {cursor_move} opt.on('-p','--ページ','Page移動') {page_move} opt.on('-f','--ファイル','File操作') {file} opt.on('-e','--編集','Edit操作') {edit} opt.on('-w','--ウィンドウ','Window操作') {window} opt.on('-b','--バッファ','Buffer操作') {buffer} opt.on('-q','--終了','終了操作') {quit} end begin command_parser.parse!(@argv) rescue=> eval p eval end exit end
file()
click to toggle source
# File lib/emacs_help.rb, line 91 def file puts "ファイル操作file" cont =[ "c-x c-f, Fine file, ファイルを開く", "c-x c-s, Save file, ファイルを保存", "c-x c-w, Write file NAME, ファイルを別名で書き込む"] disp(cont) end
page_move()
click to toggle source
# File lib/emacs_help.rb, line 99 def page_move puts "ページ移動page" cont = ["c-v, move Vertical, 次のページへ", "M-v, move , 前のページへ", "c-l, centrise Line, 現在行を中心に", "M-<, move Top of file, ファイルの先頭へ", "M->, move Bottom of file, ファイルの最後尾へ"] disp(cont) end
quit()
click to toggle source
# File lib/emacs_help.rb, line 55 def quit puts "終了操作quit" cont = ["c-x c-c, Quit emacs, ファイルを保存して終了", "c-z, suspend emacs, 一時停止,fgで復活"] disp(cont) end
show(line)
click to toggle source
# File lib/emacs_help.rb, line 51 def show(line) puts "\t#{line}" end
window()
click to toggle source
# File lib/emacs_help.rb, line 62 def window puts "ウィンドウ操作window" cont=["c-x 2, 2 windows, 二つに分割", "c-x 1, 1 windows, 一つに戻す", "c-x 3, windows, 縦線分割", "c-x o, Other windows, 次の画面へ移動"] disp(cont) end