Class: EmacsHelp::Command
- Inherits:
-
Object
- Object
- EmacsHelp::Command
- Defined in:
- lib/emacs_help.rb
Class Method Summary collapse
Instance Method Summary collapse
- #buffer ⇒ Object
- #cursor_move ⇒ Object
- #disp(lines) ⇒ Object
- #edit ⇒ Object
- #execute ⇒ Object
- #file ⇒ Object
-
#initialize(argv = []) ⇒ Command
constructor
A new instance of Command.
- #page_move ⇒ Object
- #quit ⇒ Object
- #show(line) ⇒ Object
- #window ⇒ Object
Constructor Details
#initialize(argv = []) ⇒ Command
Returns a new instance of Command.
15 16 17 18 |
# File 'lib/emacs_help.rb', line 15 def initialize(argv=[]) @argv = argv data_path = File.join(ENV['HOME'], '.hikirc') end |
Class Method Details
.run(argv = []) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/emacs_help.rb', line 7 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" new(argv).execute end |
Instance Method Details
#buffer ⇒ Object
87 88 89 90 91 92 |
# File 'lib/emacs_help.rb', line 87 def buffer puts "\nバッファー操作buffer" cont =[ "c-x b, show Buffer, バッファのリスト", "c-x c-b, next Buffer, 次のバッファへ移動"] disp(cont) end |
#cursor_move ⇒ Object
125 126 127 128 129 130 131 132 133 134 |
# File 'lib/emacs_help.rb', line 125 def cursor_move puts "\nカーソル移動cursor" cont = ["c-f, move Forwrard, 前or右へ", "c-b, move Backwrard, 後or左へ", "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) ⇒ Object
58 59 60 61 62 63 64 65 66 |
# File 'lib/emacs_help.rb', line 58 def disp(lines) lines.each{|line| if line.include?(',') show line else puts " #{line}" end } end |
#edit ⇒ Object
94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/emacs_help.rb', line 94 def edit puts "\n編集操作editor" cont = ["c-d, Delete char, 一字削除", "c-k, Kill line, 一行抹消,カット", "c-y, Yank, ペースト", "c-w, Kill region, 領域抹消,カット", "領域選択は,先頭or最後尾でc-spaceした後,最後尾or先頭へカーソル移動", "c-s, forward incremental Search WORD, 前へWORDを検索", "c-r, Reverse incremental search WORD, 後へWORDを検索", "M-x query-replace WORD1 <ret> WORD2:対話的置換(y or nで可否選択)"] disp(cont) end |
#execute ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/emacs_help.rb', line 20 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} opt.on('--edit','edit help contents'){edit_help} opt.on('--edit','edit help contentsを開く'){edit_help} # opt.on('--to_hiki','convert to hikidoc format'){to_hiki} opt.on('--to_hiki','hikiのformatに変更する'){to_hiki} # opt.on('--all','display all helps'){all_help} opt.on('--all','すべてのhelp画面を表示させる'){all_help} # opt.on('--store [item]','store [item] in backfile'){|item| store(item)} opt.on('--store [item]','store [item] でback upをとる'){|item| store(item)} # opt.on('--remove [item]','remove [item] and store in backfile'){|item| remove(item) } opt.on('--remove [item]','remove [item] back upしてるlistを消去する'){|item| remove(item) } # opt.on('--add [item]','add new [item]'){|item| add(item) } opt.on('--add [item]','add new [item]で新しいhelpを作る'){|item| add(item) } # opt.on('--backup_list [val]','show last [val] backup list'){|val| backup_list(val)} opt.on('--backup_list [val]','back upしているlistを表示させる'){|val| backup_list(val)} end begin command_parser.parse!(@argv) rescue=> eval p eval end exit end |
#file ⇒ Object
107 108 109 110 111 112 113 |
# File 'lib/emacs_help.rb', line 107 def file puts "\nファイル操作file" cont =[ "c-x c-f, Find file, ファイルを開く", "c-x c-s, Save file, ファイルを保存", "c-x c-w, Write file NAME, ファイルを別名で書き込む"] disp(cont) end |
#page_move ⇒ Object
115 116 117 118 119 120 121 122 123 |
# File 'lib/emacs_help.rb', line 115 def page_move puts "\nページ移動page" cont = ["c-v, move Vertical, 次のページへ", "M-v, move reversive Vertical,前のページへ", "c-l, centerise Line, 現在行を中心に", "M-<, move Top of file, ファイルの先頭へ", "M->, move Bottom of file, ファイルの最後尾へ"] disp(cont) end |
#quit ⇒ Object
71 72 73 74 75 76 |
# File 'lib/emacs_help.rb', line 71 def quit puts "\n終了操作quit" cont = ["c-x c-c, Quit emacs, ファイルを保存して終了", "c-z, suspend emacs, 一時停止,fgで復活"] disp(cont) end |
#show(line) ⇒ Object
67 68 69 |
# File 'lib/emacs_help.rb', line 67 def show(line) puts " #{line}" end |
#window ⇒ Object
78 79 80 81 82 83 84 85 |
# File 'lib/emacs_help.rb', line 78 def window puts "\nウィンドウ操作window" cont=["c-x 2, 2 windows, 二つに分割", "c-x 1, 1 windows, 一つに戻す", "c-x 3, 3rd window sep,縦線分割", "c-x o, Other windows, 次の画面へ移動"] disp(cont) end |