• attachment:rosvim.vim of IDEs

Attachment 'rosvim.vim'

Download

   1 " Vim global plugin for working with ROS
   2 " Last Change:  2010 Jul 27
   3 " Maintainer:   Michael Styer <michael@styer.net>
   4 
   5 " Helper commands
   6 function! s:RosDecodePath(path)
   7     let rosname = ""
   8     let reldir = ""
   9     let rosdir = ""
  10     let last = ""
  11 
  12     if match(a:path,'\v.+/.*') == -1
  13         let rosname = a:path
  14     else
  15         let result = matchlist(a:path,'\v^([^/]+)(/.{-})([^/]*)$')
  16         let rosname = result[1]
  17         let reldir =  result[2]
  18         let last =    result[3]
  19     endif
  20 
  21     let rosdir = s:RosLocationFind(rosname)
  22     let rosvals = [rosname, rosdir, reldir, last]
  23     return rosvals
  24 endfunction
  25 
  26 function! s:RosLocationFind(name)
  27     if $ROS_LOCATIONS != ""
  28         let loc_dict = {}
  29         for p in split($ROS_LOCATIONS,':')
  30             let pair = split(p, '=')
  31             let loc_dict[pair[0]] = pair[1]
  32         endfor
  33         if has_key(loc_dict,a:name)
  34             return loc_dict[a:name]
  35         endif
  36     endif
  37 
  38     if a:name == 'log'
  39         return $ROS_ROOT . "/bin/roslaunch-logs"
  40     elseif a:name == 'test_results'
  41         return $ROS_ROOT . "/test/rostest/bin/test-results-dir"
  42     endif
  43 
  44     let cmd = "export ROS_CACHE_TIMEOUT=-1.0 && rospack find " . a:name . " 2> /dev/null"
  45     let location = system(cmd)
  46     if v:shell_error != 0
  47         let cmd = "export ROS_CACHE_TIMEOUT=-1.0 && rosstack find " . a:name . " 2> /dev/null"
  48         let location = system(cmd)
  49     endif
  50     let location = substitute(location, "\n", "", "")
  51     return location
  52 endfunction
  53 
  54 " Top level commands
  55 function! s:RosChangeDir(...)
  56     if a:0 == 0 || a:1 == ""
  57         lcd $ROS_ROOT
  58         return
  59     endif
  60 
  61     let rosvals = s:RosDecodePath(a:1)
  62     if rosvals[1] == ""
  63         echo "No such package: " . a:1
  64         return
  65     else
  66         let dir = rosvals[1] . rosvals[2] . rosvals[3]
  67         echo dir
  68         execute "lcd " . dir
  69     endif
  70 
  71 endfunction
  72 
  73 function! Rosed(pack, dir)
  74     echo "rosed"
  75 endfunction
  76 
  77 if !exists(":Roscd")
  78     command -nargs=? Roscd :call s:RosChangeDir(<f-args>)
  79 endif

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2009-08-17 06:42:02, 0.1 KB) [[attachment:ROS_Node_Template.msg]]
  • [get | view] (2014-01-09 17:12:35, 17.2 KB) [[attachment:ROS_format-kepler.xml]]
  • [get | view] (2009-08-28 21:41:04, 15.5 KB) [[attachment:ROS_format.xml]]
  • [get | view] (2018-07-25 07:16:03, 35.8 KB) [[attachment:kdevelop show targets.png]]
  • [get | view] (2009-08-17 06:42:02, 0.2 KB) [[attachment:manifest.xml]]
  • [get | view] (2011-03-03 08:57:01, 1.3 KB) [[attachment:netbeans-ros-code_style.zip]]
  • [get | view] (2009-08-17 06:42:02, 4.7 KB) [[attachment:nodeTemplate.cpp]]
  • [get | view] (2009-08-17 06:42:02, 1.6 KB) [[attachment:nodeTemplate.h]]
  • [get | view] (2009-08-17 06:42:02, 0.1 KB) [[attachment:nodeTemplateServer.srv]]
  • [get | view] (2010-07-29 14:07:15, 2.0 KB) [[attachment:rosvim.vim]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.