Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

automatic_update

  • Loading branch information...
commit 088b9216f2231b1dab995bacce55c1d56feafdcc 1 parent a11f92f
@fileability fileability authored
View
19 commands/clear.selfml
@@ -1,19 +0,0 @@
-(trigger
- (tab cl))
-
-(name clear)
-
-(only-in [source.matlab, source.octave])
-
-(input document)
-
-(output snippet)
-
-(save nothing)
-
-(script [#!/usr/bin/env ruby
-require ENV["TM_BUNDLE_SUPPORT"] + "/lib/MATLABUtils.rb"
-include MATLAB
-variables = MATLAB.get_variables
-puts "clear('${1:#{variables.join("','")}}'$2);"
-])
View
82 commands/create-table.selfml
@@ -1,82 +0,0 @@
-(trigger
- (key [[ctrl][shift][cmd]T]))
-
-(name [Create matrix])
-
-(only-in [source.matlab, source.octave])
-
-(input selection nothing)
-
-(output snippet)
-
-(save nothing)
-
-(script [#!/usr/bin/env ruby
-
-if ENV.has_key?('TM_SELECTED_TEXT') then
- result = ENV['TM_SELECTED_TEXT'].strip
- case result
- when /'.*'/
- @pad = "' '"
- else
- @pad = "0"
- end
- @input_table = result.to_a.collect {|row| row.chomp.split(/\s+|,/)}
- rows = @input_table.length
- columns = @input_table.inject { |memo, row| memo.length > row.length ? memo : row }.length
-else
- result=`"$TM_SUPPORT_PATH/bin"/CocoaDialog.app/Contents/MacOS/CocoaDialog standard-inputbox \
- --title 'Matlab Array Creation' \
- --informative-text 'Number of rows and columns:' \
- --text '6 4'`.split
- exit if result[0] == "2" || result.length == 1
- @input_table = nil
- result.collect! { |num| num.to_i}
- result[2] = result[1] if result.length == 2
- # We'll only create up to two-dimensional arrays
- # with up to N elements
- N = 200
- product = result[1..2].inject(1) {|product, num| product * num }
- if product.zero?
- # give error message
- exit
- elsif product > N
- open('|"$DIALOG" tooltip', 'w') do |io|
- io << "The matrix dimensions are too large.\nThe maximum is set to #{N} elements."
- end
- exit
- else
- rows, columns = result[1..2]
- end
-end
-
-@pos = 0
-def self.insert(row,column)
- if @input_table.nil?
- @pos += 1
- "${#{@pos}:#{@pos}}"
- else
- ret = @input_table[row][column]
- if ret.nil?
- @pos += 1
- "${#{@pos}:#{@pad}}"
- else
- ret
- end
- end
-end
-
-table = ""
-table += "[" if rows > 1
-rows.times do |m|
- table += "["
- columns.times do |n|
- table += insert(m,n)
- table += (n == columns-1) ? "]" : "\t"
- end
- table += ";\n" unless (m == rows-1)
-end
-table += "]" if rows > 1
-table += "${#{@pos+1}:;}\n$0"
-puts table
-])
View
61 commands/introduce-variable-(throughout).selfml
@@ -1,61 +0,0 @@
-(trigger
- (key [[ctrl][shift]C]))
-
-(name [Introduce variable (throughout)])
-
-(only-in source.matlab,source.python)
-
-(input document)
-
-(output replace-all)
-
-(save nothing)
-
-(script [#!/usr/bin/env python
-
-import sys,os
-sys.path.append(os.environ['TM_SUPPORT_PATH'] + '/lib')
-
-import dialog
-
-def first_occurance(arr, str):
- """find first_occurance of str in an array of strings"""
- line_no = 0
- # Find first instance of `sel`
- for line in lines:
- try:
- line.index(sel)
- line_no = lines.index(line)
- break
- except ValueError:
- pass
-
- return line_no
-
-lines = sys.stdin.readlines()
-sel = ''
-var = ''
-
-try:
- sel = os.environ['TM_SELECTED_TEXT']
-except KeyError:
- pass
-else:
- line_no = first_occurance(lines, sel)-1
- try:
- var = dialog.get_string(text='Enter new variable name',
- prompt='Variable name:')
- except AttributeError:
- print '% Please update your support directory'
- var = 'var'
-
-for line in lines[0:line_no]:
- print line.replace(sel, var),
-
-term = os.environ.get('TM_LINE_TERMINATOR') or ';'
-print '%s = %s%s\n' % (var, sel, term),
-
-for line in lines[line_no:]:
- print line.replace(sel, var),
-
-])
View
41 commands/introduce-variable.selfml
@@ -1,41 +0,0 @@
-(trigger
- (key [[ctrl][shift]C]))
-
-(name [Introduce variable (line)])
-
-(only-in source.matlab,source.python)
-
-(input document)
-
-(output replace-all)
-
-(save nothing)
-
-(script [#!/usr/bin/env python
-
-import sys,os
-sys.path.append(os.environ['TM_SUPPORT_PATH'] + '/lib')
-
-import dialog
-
-line_no = int(os.environ.get('TM_LINE_NUMBER'))-1
-lines = sys.stdin.readlines()
-
-try:
- sel = os.environ['TM_SELECTED_TEXT']
-except KeyError:
- pass
-else:
- try:
- var = dialog.get_string(text='Enter new variable name',
- prompt='Variable name:')
- except AttributeError:
- print '% Please update your support directory'
- var = 'var'
-
- term = os.environ.get('TM_LINE_TERMINATOR') or ';'
- lines[line_no] = lines[line_no].replace(sel, var)
- lines.insert(line_no, '%s = %s%s\n' % (var, sel, term))
-
-for line in lines:
- print line,])
View
19 commands/save.selfml
@@ -1,19 +0,0 @@
-(trigger
- (tab save))
-
-(name save)
-
-(only-in [source.matlab, source.octave])
-
-(input document)
-
-(output snippet)
-
-(save nothing)
-
-(script [#!/usr/bin/env ruby
-require ENV["TM_BUNDLE_SUPPORT"] + "/lib/MATLABUtils.rb"
-include MATLAB
-variables = MATLAB.get_variables
-puts "save(${1:'${2:filename}'},${3:'${4:#{variables.join("','")}}'}$5);"
-])
View
5 menu.selfml
@@ -1,9 +1,8 @@
(menu
(submenu Comments snippet.bsd snippet.gpl --- snippet.comment-divide command.insert-section-division command.insert-header-comment --- command.replace-comments-with-default command.toggle-comment-style)
- (submenu Declarations command.create-table --- [snippet.function-(fun)] snippet.small-function --- snippet.if snippet.if-else snippet.if-elseif snippet.else snippet.elseif --- snippet.switch___case___otherwise___end snippet.case --- snippet.for snippet.while)
+ (submenu Declarations [snippet.function-(fun)] snippet.small-function --- snippet.if snippet.if-else snippet.if-elseif snippet.else snippet.elseif --- snippet.switch___case___otherwise___end snippet.case --- snippet.for snippet.while)
(submenu Figures command.subplot --- snippet.line snippet.title --- snippet.get snippet.set --- snippet.xlabel snippet.ylabel snippet.zlabel --- snippet.xtick snippet.ytick)
- (submenu Refactoring command.introduce-variable [command.introduce-variable-(throughout)])
- (submenu Functions snippet.^ command.clear snippet.clear snippet.dlmwrite snippet.exp snippet.griddata snippet.unix command.save)
+ (submenu Functions snippet.^ snippet.clear snippet.dlmwrite snippet.exp snippet.griddata snippet.unix)
(submenu [Text and Messages] snippet.revisions --- snippet.disp snippet.disp-sprintf --- snippet.fprintf snippet.sprintf command.num2str --- snippet.error snippet.warning --- snippet.nargchk)
(submenu [↩ and ⌅ Commands] command.enter-in-incomplete-variable-assignment command.enter-in-double-comment command.enter-in-string-in-brackets command.enter-in-brackets-or-parens command.enter-in-string)
command.open-function
Please sign in to comment.
Something went wrong with that request. Please try again.