Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add a new command which moves to the parent directory’s listfile (on …

…⌥⌘↑)

git-svn-id: http://svn.textmate.org/trunk/Review/Bundles/CMake.tmbundle@11040 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
  • Loading branch information...
commit ea3ef02c527ac4d5224344da1591dc7e6d2da746 1 parent a1a260c
Ciarán Walsh authored December 19, 2008
51  Commands/Move to Parent Listfile.tmCommand
... ...
@@ -0,0 +1,51 @@
  1
+<?xml version="1.0" encoding="UTF-8"?>
  2
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  3
+<plist version="1.0">
  4
+<dict>
  5
+	<key>beforeRunningCommand</key>
  6
+	<string>nop</string>
  7
+	<key>command</key>
  8
+	<string>#!/usr/bin/env ruby
  9
+require ENV['TM_SUPPORT_PATH'] + '/lib/textmate'
  10
+
  11
+abort "Unsaved file" unless ENV['TM_FILEPATH']
  12
+
  13
+path = File.dirname(File.dirname(ENV['TM_FILEPATH'])) + "/CMakeLists.txt"
  14
+abort "No parent listfile" unless File.exist?(path)
  15
+TextMate.go_to(:file =&gt; path)
  16
+
  17
+# subdir = nil
  18
+# 
  19
+# if line =~ /ADD_SUBDIRECTORY\s*\((.+?)\)/i
  20
+#   subdir = $1
  21
+# else
  22
+#   subdirs = Dir[dir + "/*/CMakeLists.txt"].map { |p| File.basename(File.dirname(p)) }.sort
  23
+#   abort "No listfile found in subdirectories" if subdirs.empty?
  24
+#   choice = TextMate::UI.menu(subdirs)
  25
+#   abort "Cancelled" unless choice
  26
+#   subdir = subdirs[choice]
  27
+# end
  28
+# 
  29
+# if subdir
  30
+#   file = subdir + "/CMakeLists.txt"
  31
+#   path = File.join(dir, file)
  32
+#   abort "The file at #{file} doesn't exist" unless File.exist?(path)
  33
+#   TextMate.go_to(:file =&gt; path)
  34
+# end
  35
+</string>
  36
+	<key>fallbackInput</key>
  37
+	<string>line</string>
  38
+	<key>input</key>
  39
+	<string>none</string>
  40
+	<key>keyEquivalent</key>
  41
+	<string>~@</string>
  42
+	<key>name</key>
  43
+	<string>Move to Parent Listfile</string>
  44
+	<key>output</key>
  45
+	<string>showAsTooltip</string>
  46
+	<key>scope</key>
  47
+	<string>source.cmake</string>
  48
+	<key>uuid</key>
  49
+	<string>48A1D967-E8CF-4C16-A58F-60471E9469E3</string>
  50
+</dict>
  51
+</plist>
1  info.plist
@@ -41,6 +41,7 @@
41 41
 		<string>E9362AB2-F35B-436F-A042-69135E2F3744</string>
42 42
 		<string>6AA1ED0A-6E0F-48EC-965C-D57AD98A100B</string>
43 43
 		<string>6F326FB4-8DC0-49BE-B74C-7B49CFA5283F</string>
  44
+		<string>48A1D967-E8CF-4C16-A58F-60471E9469E3</string>
44 45
 		<string>6E939107-5C78-455D-A7E6-1107ADC777C2</string>
45 46
 		<string>E60C579C-BEE8-4C0F-8FA3-0F9E1A851154</string>
46 47
 		<string>3C9C38E0-2EC5-4963-9FC1-BD2D04EC62F7</string>

0 notes on commit ea3ef02

Please sign in to comment.
Something went wrong with that request. Please try again.