vimamsa 0.1.5 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/exe/vimamsa +4 -2
 - data/lib/vimamsa/ack.rb +0 -4
 - data/lib/vimamsa/actions.rb +26 -38
 - data/lib/vimamsa/buffer.rb +117 -60
 - data/lib/vimamsa/buffer_list.rb +27 -3
 - data/lib/vimamsa/buffer_manager.rb +83 -0
 - data/lib/vimamsa/conf.rb +21 -0
 - data/lib/vimamsa/debug.rb +9 -8
 - data/lib/vimamsa/easy_jump.rb +129 -125
 - data/lib/vimamsa/editor.rb +66 -48
 - data/lib/vimamsa/file_finder.rb +7 -8
 - data/lib/vimamsa/file_history.rb +15 -8
 - data/lib/vimamsa/file_manager.rb +9 -8
 - data/lib/vimamsa/gui.rb +560 -0
 - data/lib/vimamsa/gui_menu.rb +110 -0
 - data/lib/vimamsa/gui_select_window.rb +177 -0
 - data/lib/vimamsa/gui_sourceview.rb +294 -0
 - data/lib/vimamsa/hyper_plain_text.rb +8 -10
 - data/lib/vimamsa/{default_key_bindings.rb → key_actions.rb} +71 -190
 - data/lib/vimamsa/key_binding_tree.rb +48 -36
 - data/lib/vimamsa/key_bindings_vimlike.rb +260 -0
 - data/lib/vimamsa/macro.rb +6 -6
 - data/lib/vimamsa/main.rb +1 -2
 - data/lib/vimamsa/rbvma.rb +25 -1031
 - data/lib/vimamsa/search.rb +1 -5
 - data/lib/vimamsa/search_replace.rb +4 -6
 - data/lib/vimamsa/version.rb +1 -1
 - data/vimamsa.gemspec +1 -1
 - metadata +12 -5
 
| 
         @@ -0,0 +1,260 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
             
     | 
| 
      
 2 
     | 
    
         
            +
            bindkey ["VCB M","B m"], :run_last_macro
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            bindkey "VC s", :easy_jump
         
     | 
| 
      
 5 
     | 
    
         
            +
            bindkey "VC , m f", [:find_macro_gui, proc{$macro.find_macro_gui}, "Find named macro"]
         
     | 
| 
      
 6 
     | 
    
         
            +
            bindkey "C , m n", [:gui_name_macro, proc{$macro.gui_name_macro}, "Name last macro"]
         
     | 
| 
      
 7 
     | 
    
         
            +
            bindkey "C , j r", :jump_to_random
         
     | 
| 
      
 8 
     | 
    
         
            +
            bindkey "I enter", :insert_new_line
         
     | 
| 
      
 9 
     | 
    
         
            +
            bindkey "C , ; s k", :show_key_bindings #TODO: better binding
         
     | 
| 
      
 10 
     | 
    
         
            +
            bindkey "C , , c b", :put_file_path_to_clipboard #TODO: better binding or remove?
         
     | 
| 
      
 11 
     | 
    
         
            +
            bindkey "C , , e", :encrypt_file #TODO: better binding
         
     | 
| 
      
 12 
     | 
    
         
            +
            bindkey "C , ; u", :set_unencrypted #TODO: better binding
         
     | 
| 
      
 13 
     | 
    
         
            +
            bindkey "C , c b", :close_current_buffer
         
     | 
| 
      
 14 
     | 
    
         
            +
            bindkey "V ctrl-c", :comment_selection
         
     | 
| 
      
 15 
     | 
    
         
            +
            bindkey "C x", :delete_char_forward
         
     | 
| 
      
 16 
     | 
    
         
            +
            bindkey "C , , l t", :load_theme
         
     | 
| 
      
 17 
     | 
    
         
            +
            bindkey "C , f", :gui_file_finder
         
     | 
| 
      
 18 
     | 
    
         
            +
            bindkey "C , h", :gui_file_history_finder
         
     | 
| 
      
 19 
     | 
    
         
            +
            bindkey "C , r r", :gui_search_replace
         
     | 
| 
      
 20 
     | 
    
         
            +
            bindkey "V , r r", :gui_search_replace
         
     | 
| 
      
 21 
     | 
    
         
            +
            bindkey "V , t b", :set_style_bold
         
     | 
| 
      
 22 
     | 
    
         
            +
            bindkey "V , t l", :set_style_link
         
     | 
| 
      
 23 
     | 
    
         
            +
            bindkey "V J", :V_join_lines
         
     | 
| 
      
 24 
     | 
    
         
            +
            bindkey "V , t c", :clear_formats
         
     | 
| 
      
 25 
     | 
    
         
            +
            bindkey "C , t h", :set_line_style_heading
         
     | 
| 
      
 26 
     | 
    
         
            +
            bindkey "C , t 1", :set_line_style_h1
         
     | 
| 
      
 27 
     | 
    
         
            +
            bindkey "C , t 2", :set_line_style_h2
         
     | 
| 
      
 28 
     | 
    
         
            +
            bindkey "C , t 3", :set_line_style_h3
         
     | 
| 
      
 29 
     | 
    
         
            +
            bindkey "C , t 4", :set_line_style_h4
         
     | 
| 
      
 30 
     | 
    
         
            +
            bindkey "C , t b", :set_line_style_bold
         
     | 
| 
      
 31 
     | 
    
         
            +
            bindkey "C , t t", :set_line_style_title
         
     | 
| 
      
 32 
     | 
    
         
            +
            bindkey "C , t c", :clear_line_styles
         
     | 
| 
      
 33 
     | 
    
         
            +
            bindkey "C , b", :start_buf_manager
         
     | 
| 
      
 34 
     | 
    
         
            +
            # bindkey "C , f o", :open_file_dialog
         
     | 
| 
      
 35 
     | 
    
         
            +
            bindkey "CI ctrl-o", :open_file_dialog
         
     | 
| 
      
 36 
     | 
    
         
            +
            # bindkey "M enter", :minibuffer_end
         
     | 
| 
      
 37 
     | 
    
         
            +
            bindkey "C , a", :ack_search
         
     | 
| 
      
 38 
     | 
    
         
            +
            bindkey  "C d w", :delete_to_word_end
         
     | 
| 
      
 39 
     | 
    
         
            +
            bindkey  "C d 0", :delete_to_line_start
         
     | 
| 
      
 40 
     | 
    
         
            +
            bindkey "C , , f", :file_finder
         
     | 
| 
      
 41 
     | 
    
         
            +
            bindkey "VC h", :e_move_backward_char
         
     | 
| 
      
 42 
     | 
    
         
            +
            bindkey "C , , .", :backup_all_buffers
         
     | 
| 
      
 43 
     | 
    
         
            +
            bindkey "C z ", :start_browse_mode
         
     | 
| 
      
 44 
     | 
    
         
            +
            bindkey "B h", :history_switch_backwards
         
     | 
| 
      
 45 
     | 
    
         
            +
            bindkey "B l", :history_switch_forwards
         
     | 
| 
      
 46 
     | 
    
         
            +
            #bindkey 'B z', :center_on_current_line
         
     | 
| 
      
 47 
     | 
    
         
            +
            bindkey "B z", "center_on_current_line();call(:exit_browse_mode)"
         
     | 
| 
      
 48 
     | 
    
         
            +
            bindkey "B enter || B return || B esc || B j || B ctrl!", :exit_browse_mode
         
     | 
| 
      
 49 
     | 
    
         
            +
            bindkey "B s", :page_up
         
     | 
| 
      
 50 
     | 
    
         
            +
            bindkey "B d", :page_down
         
     | 
| 
      
 51 
     | 
    
         
            +
            bindkey "B s", :page_up
         
     | 
| 
      
 52 
     | 
    
         
            +
            bindkey "B d", :page_down
         
     | 
| 
      
 53 
     | 
    
         
            +
            bindkey "B i", :jump_to_start_of_buffer
         
     | 
| 
      
 54 
     | 
    
         
            +
            bindkey "B o", :jump_to_end_of_buffer
         
     | 
| 
      
 55 
     | 
    
         
            +
            bindkey "B c", :close_current_buffer
         
     | 
| 
      
 56 
     | 
    
         
            +
            bindkey "B ;", "buf.jump_to_last_edit"
         
     | 
| 
      
 57 
     | 
    
         
            +
            bindkey "B q", :jump_to_last_edit
         
     | 
| 
      
 58 
     | 
    
         
            +
            bindkey "B w", :jump_to_next_edit
         
     | 
| 
      
 59 
     | 
    
         
            +
            bindkey "C , d", :diff_buffer
         
     | 
| 
      
 60 
     | 
    
         
            +
            bindkey "C , g", :invoke_grep_search
         
     | 
| 
      
 61 
     | 
    
         
            +
            #bindkey 'C , g', proc{invoke_grep_search}
         
     | 
| 
      
 62 
     | 
    
         
            +
            bindkey "C , v", :auto_indent_buffer
         
     | 
| 
      
 63 
     | 
    
         
            +
            bindkey "C , , d", :savedebug
         
     | 
| 
      
 64 
     | 
    
         
            +
            bindkey "C , , u", :update_file_index
         
     | 
| 
      
 65 
     | 
    
         
            +
            bindkey "C , s a", :buf_save_as 
         
     | 
| 
      
 66 
     | 
    
         
            +
            bindkey "C d d", [:delete_line, proc{buf.delete_line}, "Delete current line"]
         
     | 
| 
      
 67 
     | 
    
         
            +
            bindkey "C enter || C return",  [:line_action,proc{buf.handle_line_action()}, "Line action"]
         
     | 
| 
      
 68 
     | 
    
         
            +
            bindkey  "C p" , [:paste_after,proc{buf.paste(AFTER)},""] # TODO: implement as replace for visual mode
         
     | 
| 
      
 69 
     | 
    
         
            +
            bindkey  "V d" , [:delete_selection,proc{buf.delete(SELECTION)},""]
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
            default_keys = {
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
      
 73 
     | 
    
         
            +
              # File handling
         
     | 
| 
      
 74 
     | 
    
         
            +
              "C ctrl-s" => :buf_save,
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
              # Buffer handling
         
     | 
| 
      
 77 
     | 
    
         
            +
              "C B" => "bufs.switch",
         
     | 
| 
      
 78 
     | 
    
         
            +
              "C tab" => "bufs.switch_to_last_buf",
         
     | 
| 
      
 79 
     | 
    
         
            +
              #    'C , s'=> 'gui_select_buffer',
         
     | 
| 
      
 80 
     | 
    
         
            +
              "C , r v b" => :buf_revert,
         
     | 
| 
      
 81 
     | 
    
         
            +
              "C , c b" => "bufs.close_current_buffer",
         
     | 
| 
      
 82 
     | 
    
         
            +
              #"C , b" => '$kbd.set_mode("S");gui_select_buffer',
         
     | 
| 
      
 83 
     | 
    
         
            +
              "C , n b" => :buf_new,
         
     | 
| 
      
 84 
     | 
    
         
            +
              # "C , , ." => "backup_all_buffers()",
         
     | 
| 
      
 85 
     | 
    
         
            +
              "VC , , s" => :search_actions,
         
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
      
 88 
     | 
    
         
            +
              # MOVING
         
     | 
| 
      
 89 
     | 
    
         
            +
              #    'VC h' => 'buf.move(BACKWARD_CHAR)',
         
     | 
| 
      
 90 
     | 
    
         
            +
              "VC l" => "buf.move(FORWARD_CHAR)",
         
     | 
| 
      
 91 
     | 
    
         
            +
              "VC j" => "buf.move(FORWARD_LINE)",
         
     | 
| 
      
 92 
     | 
    
         
            +
              "VC k" => "buf.move(BACKWARD_LINE)",
         
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
      
 94 
     | 
    
         
            +
              "VC pagedown" => "page_down",
         
     | 
| 
      
 95 
     | 
    
         
            +
              "VC pageup" => "page_up",
         
     | 
| 
      
 96 
     | 
    
         
            +
             
     | 
| 
      
 97 
     | 
    
         
            +
              "VCI left" => "buf.move(BACKWARD_CHAR)",
         
     | 
| 
      
 98 
     | 
    
         
            +
              "VCI right" => "buf.move(FORWARD_CHAR)",
         
     | 
| 
      
 99 
     | 
    
         
            +
              "VCI down" => "buf.move(FORWARD_LINE)",
         
     | 
| 
      
 100 
     | 
    
         
            +
              "VCI up" => "buf.move(BACKWARD_LINE)",
         
     | 
| 
      
 101 
     | 
    
         
            +
             
     | 
| 
      
 102 
     | 
    
         
            +
              "VC w" => "buf.jump_word(FORWARD,WORD_START)",
         
     | 
| 
      
 103 
     | 
    
         
            +
              "VC b" => "buf.jump_word(BACKWARD,WORD_START)",
         
     | 
| 
      
 104 
     | 
    
         
            +
              "VC e" => "buf.jump_word(FORWARD,WORD_END)",
         
     | 
| 
      
 105 
     | 
    
         
            +
              #    'C '=> 'buf.jump_word(BACKWARD,END)',#TODO
         
     | 
| 
      
 106 
     | 
    
         
            +
              "VC f <char>" => "buf.jump_to_next_instance_of_char(<char>)",
         
     | 
| 
      
 107 
     | 
    
         
            +
              "VC F <char>" => "buf.jump_to_next_instance_of_char(<char>,BACKWARD)",
         
     | 
| 
      
 108 
     | 
    
         
            +
              "VC f space" => "buf.jump_to_next_instance_of_char(' ')",
         
     | 
| 
      
 109 
     | 
    
         
            +
              "VC F space" => "buf.jump_to_next_instance_of_char(' ',BACKWARD)",
         
     | 
| 
      
 110 
     | 
    
         
            +
             
         
     | 
| 
      
 111 
     | 
    
         
            +
              "VC /[1-9]/" => "set_next_command_count(<char>)",
         
     | 
| 
      
 112 
     | 
    
         
            +
              #    'VC number=/[0-9]/+ g'=> 'jump_to_line(<number>)',
         
     | 
| 
      
 113 
     | 
    
         
            +
              #    'VC X=/[0-9]/+ * Y=/[0-9]/+ '=> 'x_times_y(<X>,<Y>)',
         
     | 
| 
      
 114 
     | 
    
         
            +
              "VC ^" => "buf.jump(BEGINNING_OF_LINE)",
         
     | 
| 
      
 115 
     | 
    
         
            +
              "VC G($next_command_count!=nil)" => "buf.jump_to_line()",
         
     | 
| 
      
 116 
     | 
    
         
            +
              "VC 0($next_command_count!=nil)" => "set_next_command_count(<char>)",
         
     | 
| 
      
 117 
     | 
    
         
            +
              "VC 0($next_command_count==nil)" => "buf.jump(BEGINNING_OF_LINE)",
         
     | 
| 
      
 118 
     | 
    
         
            +
              # 'C 0'=> 'buf.jump(BEGINNING_OF_LINE)',
         
     | 
| 
      
 119 
     | 
    
         
            +
              "VC g g" => "buf.jump(START_OF_BUFFER)",
         
     | 
| 
      
 120 
     | 
    
         
            +
              "VC g ;" => "buf.jump_to_last_edit",
         
     | 
| 
      
 121 
     | 
    
         
            +
              "VC G" => "buf.jump(END_OF_BUFFER)",
         
     | 
| 
      
 122 
     | 
    
         
            +
              #    'VC z z' => 'center_on_current_line',
         
     | 
| 
      
 123 
     | 
    
         
            +
              "VC *" => "buf.jump_to_next_instance_of_word",
         
     | 
| 
      
 124 
     | 
    
         
            +
             
     | 
| 
      
 125 
     | 
    
         
            +
              "C , e" => "invoke_command", # Currently eval
         
     | 
| 
      
 126 
     | 
    
         
            +
             
     | 
| 
      
 127 
     | 
    
         
            +
              "VC /" => :find_in_buffer,
         
     | 
| 
      
 128 
     | 
    
         
            +
             
     | 
| 
      
 129 
     | 
    
         
            +
              # READCHAR bindings
         
     | 
| 
      
 130 
     | 
    
         
            +
             
     | 
| 
      
 131 
     | 
    
         
            +
              "R <char>" => "readchar_new_char(<char>)",
         
     | 
| 
      
 132 
     | 
    
         
            +
             
     | 
| 
      
 133 
     | 
    
         
            +
              "C n" => "$search.jump_to_next()",
         
     | 
| 
      
 134 
     | 
    
         
            +
              "C N" => "$search.jump_to_previous()",
         
     | 
| 
      
 135 
     | 
    
         
            +
             
     | 
| 
      
 136 
     | 
    
         
            +
              # Debug
         
     | 
| 
      
 137 
     | 
    
         
            +
              "C , d r p" => "start_ripl",
         
     | 
| 
      
 138 
     | 
    
         
            +
              "C , D" => "debug_print_buffer",
         
     | 
| 
      
 139 
     | 
    
         
            +
              "C , c s" => "bufs.close_scrap_buffers",
         
     | 
| 
      
 140 
     | 
    
         
            +
              "C , d b" => "debug_print_buffer",
         
     | 
| 
      
 141 
     | 
    
         
            +
              "C , d c" => "debug_dump_clipboard",
         
     | 
| 
      
 142 
     | 
    
         
            +
              "C , d d" => "debug_dump_deltas",
         
     | 
| 
      
 143 
     | 
    
         
            +
              "VC O" => "buf.jump(END_OF_LINE)",
         
     | 
| 
      
 144 
     | 
    
         
            +
              "VC $" => "buf.jump(END_OF_LINE)",
         
     | 
| 
      
 145 
     | 
    
         
            +
             
     | 
| 
      
 146 
     | 
    
         
            +
              "C o" => 'buf.jump(END_OF_LINE);buf.insert_txt("\n");$kbd.set_mode(:insert)',
         
     | 
| 
      
 147 
     | 
    
         
            +
              "C X" => 'buf.jump(END_OF_LINE);buf.insert_txt("\n");',
         
     | 
| 
      
 148 
     | 
    
         
            +
              "C A" => "buf.jump(END_OF_LINE);$kbd.set_mode(:insert)",
         
     | 
| 
      
 149 
     | 
    
         
            +
              "C I" => "buf.jump(FIRST_NON_WHITESPACE);$kbd.set_mode(:insert)",
         
     | 
| 
      
 150 
     | 
    
         
            +
              "C a" => "buf.move(FORWARD_CHAR);$kbd.set_mode(:insert)",
         
     | 
| 
      
 151 
     | 
    
         
            +
              "C J" => "buf.join_lines()",
         
     | 
| 
      
 152 
     | 
    
         
            +
              "C u" => "buf.undo()",
         
     | 
| 
      
 153 
     | 
    
         
            +
             
     | 
| 
      
 154 
     | 
    
         
            +
              "C ^" => "buf.jump(BEGINNING_OF_LINE)",
         
     | 
| 
      
 155 
     | 
    
         
            +
              "C /[1-9]/" => "set_next_command_count(<char>)",
         
     | 
| 
      
 156 
     | 
    
         
            +
             
     | 
| 
      
 157 
     | 
    
         
            +
              # Command mode only:
         
     | 
| 
      
 158 
     | 
    
         
            +
              "C ctrl-r" => "buf.redo()", # TODO:???
         
     | 
| 
      
 159 
     | 
    
         
            +
              "C R" => "buf.redo()",
         
     | 
| 
      
 160 
     | 
    
         
            +
              "C v" => "buf.start_visual_mode",
         
     | 
| 
      
 161 
     | 
    
         
            +
              "C P" => "buf.paste(BEFORE)", # TODO: implement as replace for visual mode
         
     | 
| 
      
 162 
     | 
    
         
            +
              "C space <char>" => "buf.insert_txt(<char>)",
         
     | 
| 
      
 163 
     | 
    
         
            +
              "C space space" => "buf.insert_txt(' ')",
         
     | 
| 
      
 164 
     | 
    
         
            +
              "C y y" => "buf.copy_line",
         
     | 
| 
      
 165 
     | 
    
         
            +
              "C y O" => "buf.copy(:to_line_end)",
         
     | 
| 
      
 166 
     | 
    
         
            +
              "C y 0" => "buf.copy(:to_line_start)",
         
     | 
| 
      
 167 
     | 
    
         
            +
              "C y e" => "buf.copy(:to_word_end)", # TODO
         
     | 
| 
      
 168 
     | 
    
         
            +
              #### Deleting
         
     | 
| 
      
 169 
     | 
    
         
            +
              "C x" => "buf.delete(CURRENT_CHAR_FORWARD)",
         
     | 
| 
      
 170 
     | 
    
         
            +
              # 'C d k'=> 'delete_line(BACKWARD)', #TODO
         
     | 
| 
      
 171 
     | 
    
         
            +
              # 'C d j'=> 'delete_line(FORWARD)', #TODO
         
     | 
| 
      
 172 
     | 
    
         
            +
              # 'C d d'=> 'buf.delete_cur_line',
         
     | 
| 
      
 173 
     | 
    
         
            +
              "C d e" => "buf.delete2(:to_word_end)",
         
     | 
| 
      
 174 
     | 
    
         
            +
              "C d O" => "buf.delete2(:to_line_end)",
         
     | 
| 
      
 175 
     | 
    
         
            +
              "C d $" => "buf.delete2(:to_line_end)",
         
     | 
| 
      
 176 
     | 
    
         
            +
              #    'C d e'=> 'buf.delete_to_next_word_end',
         
     | 
| 
      
 177 
     | 
    
         
            +
              "C d <num> e" => "delete_next_word",
         
     | 
| 
      
 178 
     | 
    
         
            +
              "C r <char>" => "buf.replace_with_char(<char>)", # TODO
         
     | 
| 
      
 179 
     | 
    
         
            +
              "C , l b" => "load_buffer_list",
         
     | 
| 
      
 180 
     | 
    
         
            +
              "C , l l" => "save_buffer_list",
         
     | 
| 
      
 181 
     | 
    
         
            +
              "C , r <char>" => "set_register(<char>)", # TODO
         
     | 
| 
      
 182 
     | 
    
         
            +
              "C , p <char>" => "buf.paste(BEFORE,<char>)", # TODO
         
     | 
| 
      
 183 
     | 
    
         
            +
             
     | 
| 
      
 184 
     | 
    
         
            +
              "C ctrl-c" => "buf.comment_line()",
         
     | 
| 
      
 185 
     | 
    
         
            +
              "C ctrl-x" => "buf.comment_line(:uncomment)",
         
     | 
| 
      
 186 
     | 
    
         
            +
             
     | 
| 
      
 187 
     | 
    
         
            +
              # 'C 0($next_command_count==nil)'=> 'jump_to_beginning_of_line',
         
     | 
| 
      
 188 
     | 
    
         
            +
             
     | 
| 
      
 189 
     | 
    
         
            +
              # Visual mode only:
         
     | 
| 
      
 190 
     | 
    
         
            +
              "V esc" => "buf.end_visual_mode",
         
     | 
| 
      
 191 
     | 
    
         
            +
              "V ctrl!" => "buf.end_visual_mode",
         
     | 
| 
      
 192 
     | 
    
         
            +
              "V y" => "buf.copy_active_selection()",
         
     | 
| 
      
 193 
     | 
    
         
            +
              "V a y" => "buf.copy_active_selection(:append)",
         
     | 
| 
      
 194 
     | 
    
         
            +
              "V g U" => "buf.transform_selection(:upcase)",
         
     | 
| 
      
 195 
     | 
    
         
            +
              "V g u" => "buf.transform_selection(:downcase)",
         
     | 
| 
      
 196 
     | 
    
         
            +
              "V g c" => "buf.transform_selection(:capitalize)",
         
     | 
| 
      
 197 
     | 
    
         
            +
              "V g s" => "buf.transform_selection(:swapcase)",
         
     | 
| 
      
 198 
     | 
    
         
            +
              "V g r" => "buf.transform_selection(:reverse)",
         
     | 
| 
      
 199 
     | 
    
         
            +
             
     | 
| 
      
 200 
     | 
    
         
            +
              "V x" => "buf.delete(SELECTION)",
         
     | 
| 
      
 201 
     | 
    
         
            +
              # "V ctrl-c" => "buf.comment_selection",
         
     | 
| 
      
 202 
     | 
    
         
            +
              "V ctrl-x" => "buf.comment_selection(:uncomment)",
         
     | 
| 
      
 203 
     | 
    
         
            +
             
     | 
| 
      
 204 
     | 
    
         
            +
              "CI ctrl-v" => "buf.paste(BEFORE)",
         
     | 
| 
      
 205 
     | 
    
         
            +
              "CI backspace" => "buf.delete(BACKWARD_CHAR)",
         
     | 
| 
      
 206 
     | 
    
         
            +
             
     | 
| 
      
 207 
     | 
    
         
            +
              # Marks
         
     | 
| 
      
 208 
     | 
    
         
            +
              "CV m <char>" => "buf.mark_current_position(<char>)",
         
     | 
| 
      
 209 
     | 
    
         
            +
              'CV \' <char>' => "buf.jump_to_mark(<char>)",
         
     | 
| 
      
 210 
     | 
    
         
            +
              # "CV ''" =>'jump_to_mark(NEXT_MARK)', #TODO
         
     | 
| 
      
 211 
     | 
    
         
            +
             
     | 
| 
      
 212 
     | 
    
         
            +
              "C i" => "$kbd.set_mode(:insert)",
         
     | 
| 
      
 213 
     | 
    
         
            +
              "C ctrl!" => "$kbd.set_mode(:insert)",
         
     | 
| 
      
 214 
     | 
    
         
            +
             
     | 
| 
      
 215 
     | 
    
         
            +
              # Macros
         
     | 
| 
      
 216 
     | 
    
         
            +
              # (experimental, may not work correctly)
         
     | 
| 
      
 217 
     | 
    
         
            +
              # "C q a" => '$macro.start_recording("a")',
         
     | 
| 
      
 218 
     | 
    
         
            +
              "VC q <char>" => '$macro.start_recording(<char>)',
         
     | 
| 
      
 219 
     | 
    
         
            +
              "VC q($macro.is_recording==true) " => "$macro.end_recording", # TODO
         
     | 
| 
      
 220 
     | 
    
         
            +
              # 'C q'=> '$macro.end_recording', #TODO
         
     | 
| 
      
 221 
     | 
    
         
            +
              "C q v" => "$macro.end_recording",
         
     | 
| 
      
 222 
     | 
    
         
            +
              # 'C v'=> '$macro.end_recording',
         
     | 
| 
      
 223 
     | 
    
         
            +
              # "C M" => '$macro.run_last_macro',
         
     | 
| 
      
 224 
     | 
    
         
            +
              "C @ <char>" => '$macro.run_macro(<char>)',
         
     | 
| 
      
 225 
     | 
    
         
            +
              "C , m S" => '$macro.save_macro("a")',
         
     | 
| 
      
 226 
     | 
    
         
            +
              "C , m s" => '$macro.save',
         
     | 
| 
      
 227 
     | 
    
         
            +
              "C , t r" => "run_tests()",
         
     | 
| 
      
 228 
     | 
    
         
            +
             
     | 
| 
      
 229 
     | 
    
         
            +
              # "C ." => "repeat_last_action", # TODO
         
     | 
| 
      
 230 
     | 
    
         
            +
              "VC ;" => "repeat_last_find",
         
     | 
| 
      
 231 
     | 
    
         
            +
              # "CV Q" => :quit,
         
     | 
| 
      
 232 
     | 
    
         
            +
              "CV ctrl-q" => :quit,
         
     | 
| 
      
 233 
     | 
    
         
            +
              "CV , R" => "restart_application",
         
     | 
| 
      
 234 
     | 
    
         
            +
              "I ctrl!" => "$kbd.set_mode(:command)",
         
     | 
| 
      
 235 
     | 
    
         
            +
              "C shift!" => "buf.save",
         
     | 
| 
      
 236 
     | 
    
         
            +
              "I <char>" => "buf.insert_txt(<char>)",
         
     | 
| 
      
 237 
     | 
    
         
            +
              "I esc" => "$kbd.set_mode(:command)",
         
     | 
| 
      
 238 
     | 
    
         
            +
             
     | 
| 
      
 239 
     | 
    
         
            +
              "I ctrl-d" => "buf.delete2(:to_word_end)",
         
     | 
| 
      
 240 
     | 
    
         
            +
             
     | 
| 
      
 241 
     | 
    
         
            +
              # INSERT MODE: Moving
         
     | 
| 
      
 242 
     | 
    
         
            +
              "I ctrl-a" => "buf.jump(BEGINNING_OF_LINE)",
         
     | 
| 
      
 243 
     | 
    
         
            +
              "I ctrl-b" => "buf.move(BACKWARD_CHAR)",
         
     | 
| 
      
 244 
     | 
    
         
            +
              "I ctrl-f" => "buf.move(FORWARD_CHAR)",
         
     | 
| 
      
 245 
     | 
    
         
            +
              "I ctrl-n" => "buf.move(FORWARD_LINE)",
         
     | 
| 
      
 246 
     | 
    
         
            +
              "I ctrl-p" => "buf.move(BACKWARD_LINE)",
         
     | 
| 
      
 247 
     | 
    
         
            +
              "I ctrl-e" => "buf.jump(END_OF_LINE)", # context: mode:I, buttons down: {C}
         
     | 
| 
      
 248 
     | 
    
         
            +
              "I alt-f" => "buf.jump_word(FORWARD,WORD_START)",
         
     | 
| 
      
 249 
     | 
    
         
            +
              "I alt-b" => "buf.jump_word(BACKWARD,WORD_START)",
         
     | 
| 
      
 250 
     | 
    
         
            +
             
     | 
| 
      
 251 
     | 
    
         
            +
              "I tab" => 'buf.insert_txt("	")',
         
     | 
| 
      
 252 
     | 
    
         
            +
              "I space" => 'buf.insert_txt(" ")',
         
     | 
| 
      
 253 
     | 
    
         
            +
            #  "I return" => 'buf.insert_new_line()',
         
     | 
| 
      
 254 
     | 
    
         
            +
            }
         
     | 
| 
      
 255 
     | 
    
         
            +
             
     | 
| 
      
 256 
     | 
    
         
            +
            default_keys.each { |key, value|
         
     | 
| 
      
 257 
     | 
    
         
            +
              bindkey(key, value)
         
     | 
| 
      
 258 
     | 
    
         
            +
            }
         
     | 
| 
      
 259 
     | 
    
         
            +
             
     | 
| 
      
 260 
     | 
    
         
            +
             
     | 
    
        data/lib/vimamsa/macro.rb
    CHANGED
    
    | 
         @@ -1,6 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         | 
| 
       2 
2 
     | 
    
         
             
            def gui_find_macro_update_callback(search_str = "")
         
     | 
| 
       3 
     | 
    
         
            -
               
     | 
| 
      
 3 
     | 
    
         
            +
              debug "gui_find_macro_update_callback: #{search_str}"
         
     | 
| 
       4 
4 
     | 
    
         
             
              heystack = $macro.named_macros
         
     | 
| 
       5 
5 
     | 
    
         
             
              return [] if heystack.empty?
         
     | 
| 
       6 
6 
     | 
    
         
             
              $macro_search_list = []
         
     | 
| 
         @@ -14,10 +14,10 @@ def gui_find_macro_update_callback(search_str = "") 
     | 
|
| 
       14 
14 
     | 
    
         
             
            end
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
16 
     | 
    
         
             
            def gui_find_macro_select_callback(search_str, idx)
         
     | 
| 
       17 
     | 
    
         
            -
               
     | 
| 
      
 17 
     | 
    
         
            +
              debug "gui_find_macro_select_callback"
         
     | 
| 
       18 
18 
     | 
    
         
             
              selected = $macro_search_list[idx]
         
     | 
| 
       19 
19 
     | 
    
         
             
              m = $macro.named_macros[selected[0]].clone
         
     | 
| 
       20 
     | 
    
         
            -
               
     | 
| 
      
 20 
     | 
    
         
            +
              debug "SELECTED MACRO:#{selected}, #{m}"
         
     | 
| 
       21 
21 
     | 
    
         
             
              id = $macro.last_macro
         
     | 
| 
       22 
22 
     | 
    
         
             
              $macro.recorded_macros[id] = m
         
     | 
| 
       23 
23 
     | 
    
         
             
              $macro.run_macro(id)
         
     | 
| 
         @@ -58,13 +58,13 @@ class Macro 
     | 
|
| 
       58 
58 
     | 
    
         
             
                $macro_search_list = l
         
     | 
| 
       59 
59 
     | 
    
         
             
                $select_keys = ["h", "l", "f", "d", "s", "a", "g", "z"]
         
     | 
| 
       60 
60 
     | 
    
         | 
| 
       61 
     | 
    
         
            -
                 
     | 
| 
      
 61 
     | 
    
         
            +
                gui_select_update_window(l, $select_keys.collect { |x| x.upcase },
         
     | 
| 
       62 
62 
     | 
    
         
             
                                        "gui_find_macro_select_callback",
         
     | 
| 
       63 
63 
     | 
    
         
             
                                        "gui_find_macro_update_callback")
         
     | 
| 
       64 
64 
     | 
    
         
             
              end
         
     | 
| 
       65 
65 
     | 
    
         | 
| 
       66 
66 
     | 
    
         
             
              def name_macro(name, id = nil)
         
     | 
| 
       67 
     | 
    
         
            -
                 
     | 
| 
      
 67 
     | 
    
         
            +
                debug "NAME MACRO #{name}"
         
     | 
| 
       68 
68 
     | 
    
         
             
                if id.nil?
         
     | 
| 
       69 
69 
     | 
    
         
             
                  id = @last_macro
         
     | 
| 
       70 
70 
     | 
    
         
             
                end
         
     | 
| 
         @@ -134,7 +134,7 @@ class Macro 
     | 
|
| 
       134 
134 
     | 
    
         
             
                  # Ripl.start :binding => binding
         
     | 
| 
       135 
135 
     | 
    
         
             
                  for a in acts
         
     | 
| 
       136 
136 
     | 
    
         
             
                    ret = exec_action(a)
         
     | 
| 
       137 
     | 
    
         
            -
                     
     | 
| 
      
 137 
     | 
    
         
            +
                    debug ret
         
     | 
| 
       138 
138 
     | 
    
         
             
                    if ret == false
         
     | 
| 
       139 
139 
     | 
    
         
             
                      message("Error while running macro")
         
     | 
| 
       140 
140 
     | 
    
         
             
                      break
         
     | 
    
        data/lib/vimamsa/main.rb
    CHANGED
    
    | 
         @@ -28,7 +28,6 @@ $search_dirs = [] 
     | 
|
| 
       28 
28 
     | 
    
         
             
            $errors = []
         
     | 
| 
       29 
29 
     | 
    
         | 
| 
       30 
30 
     | 
    
         
             
            $cur_register = "a"
         
     | 
| 
       31 
     | 
    
         
            -
            $input_char_call_func = nil
         
     | 
| 
       32 
31 
     | 
    
         
             
            $debuginfo = {}
         
     | 
| 
       33 
32 
     | 
    
         | 
| 
       34 
33 
     | 
    
         
             
            $jump_sequence = []
         
     | 
| 
         @@ -51,7 +50,7 @@ end 
     | 
|
| 
       51 
50 
     | 
    
         | 
| 
       52 
51 
     | 
    
         
             
            require "vimamsa/editor.rb"
         
     | 
| 
       53 
52 
     | 
    
         | 
| 
       54 
     | 
    
         
            -
            # load " 
     | 
| 
      
 53 
     | 
    
         
            +
            # load "gui_funcs.rb"
         
     | 
| 
       55 
54 
     | 
    
         | 
| 
       56 
55 
     | 
    
         
             
            $vma = Editor.new
         
     | 
| 
       57 
56 
     | 
    
         
             
            def vma()
         
     |