-
Notifications
You must be signed in to change notification settings - Fork 64
/
Copy pathRemove Column.tmCommand
46 lines (46 loc) · 1.23 KB
/
Remove Column.tmCommand
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
<string>#!/usr/bin/env ruby18
require 'pp'
require ENV["TM_SUPPORT_PATH"] + "/lib/escape.rb"
data=STDIN.readlines
l,c = ENV['TM_LINE_NUMBER'].to_i-ENV['TM_INPUT_START_LINE'].to_i, ENV['TM_LINE_INDEX'].to_i
col_no = data[l].slice(/^.{#{c}}/).scan("&").length
if col_no == 0 then
data.each do |line|
if line =~ /^[^&]*&(.*)/ then
print $1
else
print line
end
end
else
data.each do |line|
if line =~ /^([^&]*&){#{col_no}}(?:[^&]*&)(.*\n?)/ then
print $1 + $2
else
print line
end
end
end</string>
<key>fallbackInput</key>
<string>scope</string>
<key>input</key>
<string>selection</string>
<key>keyEquivalent</key>
<string>^~</string>
<key>name</key>
<string>Remove Column</string>
<key>output</key>
<string>replaceSelectedText</string>
<key>scope</key>
<string>text.tex.latex meta.data.environment.tabular.latex</string>
<key>uuid</key>
<string>6E70284B-1694-46F5-BA99-FC3CC22705C6</string>
</dict>
</plist>