Revision: 2643
Updated Code
at March 22, 2007 04:13 by charlesroper
Updated Code
#!/usr/bin/env ruby SUPPORT = ENV['TM_SUPPORT_PATH'] DIALOG = SUPPORT + '/bin/CocoaDialog.exe' selected_word = ENV['TM_CURRENT_WORD'] x = "--xpos #{ENV['TM_CARET_XPOS']} " y = "--ypos #{ENV['TM_CARET_YPOS']} " if selected_word != nil menu = [] all_words = STDIN.read.split(/\b/) all_words.each do |word| if word != selected_word if word.index(selected_word) == 0 menu << word + " " end end end menu.uniq! if menu.length < 1 abort elsif menu.length == 1 print menu[0].sub(selected_word, '').strip else selected = %x`"#{DIALOG}" menu --items #{menu} #{x} #{y}`.to_i - 1 print menu[selected].sub(selected_word, '').strip end end
Revision: 2642
Updated Code
at March 18, 2007 19:03 by charlesroper
Updated Code
#!/usr/bin/env ruby SUPPORT = ENV['TM_SUPPORT_PATH'] DIALOG = SUPPORT + '/bin/CocoaDialog.exe' selected_word = ENV['TM_CURRENT_WORD'] if selected_word != nil menu = [] all_words = STDIN.read.split(/\b/) all_words.each do |word| if word != selected_word if word.index(selected_word) == 0 menu << word + " " end end end menu.uniq! if menu.length < 1 abort elsif menu.length == 1 print menu[0].sub(selected_word, '').strip else selected = `\"#{DIALOG}\" menu --items #{menu}`.to_i - 1 print menu[selected].sub(selected_word, '').strip end end
Revision: 2641
Updated Code
at March 18, 2007 18:49 by charlesroper
Updated Code
#!/usr/bin/env ruby SUPPORT = ENV['TM_SUPPORT_PATH'] DIALOG = SUPPORT + '/bin/CocoaDialog.exe' cur = ENV['TM_CURRENT_WORD'] if cur != nil menu = [] str = STDIN.read strArr = str.split(/\b/) strArr.each do |s| if s != cur if s.index(cur) == 0 menu << s + " " end end end menu.uniq! if menu.length < 1 abort elsif menu.length == 1 print menu[0].sub(cur,'').strip else selected = `\"#{DIALOG}\" menu --items #{menu}`.to_i - 1 print menu[selected].sub(cur,'').strip end end
Revision: 2640
Updated Code
at March 18, 2007 18:46 by charlesroper
Updated Code
#!/usr/bin/env ruby SUPPORT = ENV['TM_SUPPORT_PATH'] DIALOG = SUPPORT + '/bin/CocoaDialog.exe' cur = ENV['TM_CURRENT_WORD'] menu = [] if cur != nil str = STDIN.read strArr = str.split(/\b/) strArr.each do |s| if s != cur if s.index(cur) == 0 menu << s + " " end end end menu.uniq! if menu.length < 1 abort elsif menu.length == 1 print menu[0].sub(cur,'').strip else selected = `\"#{DIALOG}\" menu --items #{menu}`.to_i - 1 print menu[selected].sub(cur,'').strip end end
Revision: 2639
Updated Code
at March 18, 2007 18:38 by charlesroper
Updated Code
#!/usr/bin/env ruby SUPPORT = ENV['TM_SUPPORT_PATH'] DIALOG = SUPPORT + '/bin/CocoaDialog.exe' cur = ENV['TM_CURRENT_WORD'] if cur != nil menu = [] str = STDIN.read strArr = str.split(/\b/) strArr.each do |s| if s != cur if s.index(cur) == 0 menu << s + " " end end end menu.uniq! if menu.length < 1 abort elsif menu.length == 1 print menu[0].sub(cur,'') else selected = `\"#{DIALOG}\" menu --items #{menu}`.to_i - 1 print menu[selected].sub(cur,'') end end
Revision: 2638
Updated Code
at March 18, 2007 18:37 by charlesroper
Updated Code
#!/usr/bin/env ruby SUPPORT = ENV['TM_SUPPORT_PATH'] DIALOG = SUPPORT + '/bin/CocoaDialog.exe' cur = ENV['TM_CURRENT_WORD'] if cur != nil menu = [] str = STDIN.read strArr = str.split(/\b/) strArr.each do |s| if s != cur if s.index(cur) == 0 menu << s + " " end end end menu.uniq! if menu.length < 1 abort elsif menu.length == 1 print menu[0].sub(cur,'') else selected = `\"#{DIALOG}\" menu --items #{menu}`.to_i - 1 print menu[selected].sub(cur,'') end end
Revision: 2637
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 18, 2007 18:30 by charlesroper
Initial Code
#!/usr/bin/env ruby SUPPORT = ENV['TM_SUPPORT_PATH'] DIALOG = SUPPORT + '/bin/CocoaDialog.exe' cur = ENV['TM_CURRENT_WORD'] menu = [] if cur != nil str = STDIN.read strArr = str.split(/\b/) strArr.each do |s| if s != cur if s.index(cur) == 0 menu << s + " " end end end menu.uniq! if menu.length < 1 abort elsif menu.length == 1 print menu[0].sub(cur,'') else selected = `\"#{DIALOG}\" menu --items #{menu}`.to_i - 1 print menu[selected].sub(cur,'') end end
Initial URL
Initial Description
Auto-complete command for E-TextEditor. Will popup a menu if there are multiple possibilities. Installation requirements: Save: Nothing Input: Entire Document Output: Insert as Text
Initial Title
Auto-complete with menu
Initial Tags
Initial Language
Ruby