]> git.rmz.io Git - dotfiles.git/commitdiff
vim: add syntax and indent files for ros
authorSamir Benmendil <samir.benmendil@gmail.com>
Tue, 22 Apr 2014 23:49:05 +0000 (00:49 +0100)
committerSamir Benmendil <samir.benmendil@gmail.com>
Tue, 22 Apr 2014 23:49:05 +0000 (00:49 +0100)
vim/filetype.vim
vim/indent/roslaunch.vim [new file with mode: 0644]
vim/syntax/rosaction.vim [new file with mode: 0644]
vim/syntax/roslaunch.vim [new file with mode: 0644]
vim/syntax/rosmsg.vim [new file with mode: 0644]
vim/syntax/rossrv.vim [new file with mode: 0644]

index eca9dc6f26d4c8a3482fa30b4484128bd2e2e79d..ade77b054499c02b9e42a69bb6a3598ecf5f062a 100644 (file)
@@ -2,5 +2,6 @@ if exists("did_load_filetypes")
     finish
 endif
 augroup filetypedetect
     finish
 endif
 augroup filetypedetect
+    autocmd! BufNewFile,BufRead *.launch  setfiletype roslaunch
     autocmd! BufNewFile,BufRead PKGBUILD* setfiletype PKGBUILD
 augroup END
     autocmd! BufNewFile,BufRead PKGBUILD* setfiletype PKGBUILD
 augroup END
diff --git a/vim/indent/roslaunch.vim b/vim/indent/roslaunch.vim
new file mode 100644 (file)
index 0000000..6a4393b
--- /dev/null
@@ -0,0 +1,31 @@
+
+" Use XML indentation rules
+
+if exists("b:did_indent")
+  finish
+endif
+
+" load the XML indent rules
+runtime! indent/xml.vim
+runtime! indent/yaml.vim
+
+" override the vim indent expression (we'll call it ourselves)
+setlocal indentexpr=GetRoslaunchIndent(v:lnum)
+
+" Only define the function once.
+if exists("*GetRoslaunchIndent")
+  finish
+endif
+
+" wiki-indent will return vim indent inside a <pre> block,
+" and return -1 if not inside a block to trigger auto-indent
+function GetRoslaunchIndent(lnum)
+  return -1
+  if searchpair('<rosparam>','','</rosparam>','bWnm') > 0
+    return GetYAMLIndent(lnum)
+  else
+    return -1
+  endif
+endfunc
+
+
diff --git a/vim/syntax/rosaction.vim b/vim/syntax/rosaction.vim
new file mode 100644 (file)
index 0000000..ad86954
--- /dev/null
@@ -0,0 +1,18 @@
+" Vim syntax file
+" Language:     rosaction
+" Maintainer:   Sergey Alexandrov <alexandrov88@gmail.com>
+" Filenames:    *.action
+
+" Read the rosmsg syntax to start with
+if version < 600
+  so <sfile>:p:h/rosmsg.vim
+else
+  runtime! syntax/rosmsg.vim
+  unlet b:current_syntax
+endif
+
+syn match rosactionSeparator   "^---$"
+
+hi def link rosactionSeparator Special
+
+let b:current_syntax = "rosaction"
diff --git a/vim/syntax/roslaunch.vim b/vim/syntax/roslaunch.vim
new file mode 100644 (file)
index 0000000..c9acdd1
--- /dev/null
@@ -0,0 +1,24 @@
+" Vim syntax file
+" Language: roslaunch XML
+" Maintainer: Jonathan Bohren
+" Latest Revision: 8 July 2013
+"
+" roslaunch xml syntax hilighting with inline yaml support
+"
+" Put the following in your .vimrc:
+"   autocmd BufRead,BufNewFile *.launch setfiletype roslaunch
+
+if exists("b:current_syntax")
+  finish
+endif
+
+runtime syntax/xml.vim
+
+let s:current_syntax=b:current_syntax
+unlet b:current_syntax
+
+syntax include @YAML syntax/yaml.vim
+syntax region ymlSnipInline matchgroup=rosparamTag start="\m<.\{-}rosparam.\{-}>" end="\m</.\{-}rosparam.\{-}>" contains=@YAML containedin=xmlEntity
+hi link rosparamTag ModeMsg
+
+let b:current_syntax=s:current_syntax
diff --git a/vim/syntax/rosmsg.vim b/vim/syntax/rosmsg.vim
new file mode 100644 (file)
index 0000000..11e4632
--- /dev/null
@@ -0,0 +1,39 @@
+" Vim syntax file
+" Language:     rosmsg
+" Maintainer:   Sergey Alexandrov <alexandrov88@gmail.com>
+" Filenames:    *.msg
+
+if exists("b:current_syntax")
+  finish
+endif
+
+syn keyword rosmsgBuiltInType      bool
+syn keyword rosmsgBuiltInType      int8
+syn keyword rosmsgBuiltInType      uint8
+syn keyword rosmsgBuiltInType      int16
+syn keyword rosmsgBuiltInType      uint16
+syn keyword rosmsgBuiltInType      int32
+syn keyword rosmsgBuiltInType      uint32
+syn keyword rosmsgBuiltInType      int64
+syn keyword rosmsgBuiltInType      uint64
+syn keyword rosmsgBuiltInType      float32
+syn keyword rosmsgBuiltInType      float64
+syn keyword rosmsgBuiltInType      string
+syn keyword rosmsgBuiltInType      time
+syn keyword rosmsgBuiltInType      duration
+syn keyword rosmsgBuiltInType      Header
+
+syn match   rosmsgType             "\v^\h\w+(/\h\w+)=" nextgroup=rosmsgArray,rosmsgField,rosmsgConstant
+syn match   rosmsgArray            "\[\d*\]"
+syn match   rosmsgField            "\v\s+\h\w*(\w*\s*\=)@!"
+syn match   rosmsgConstant         "\v\s+\u[0-9A-Z_]*(\s*\=)@="
+syn match   rosmsgComment          "\v#.*$"
+
+hi def link rosmsgBuiltInType      Keyword
+hi def link rosmsgType             Type
+hi def link rosmsgArray            Normal
+hi def link rosmsgField            Identifier
+hi def link rosmsgConstant         Constant
+hi def link rosmsgComment          Comment
+
+let b:current_syntax = "rosmsg"
diff --git a/vim/syntax/rossrv.vim b/vim/syntax/rossrv.vim
new file mode 100644 (file)
index 0000000..d957915
--- /dev/null
@@ -0,0 +1,18 @@
+" Vim syntax file
+" Language:     rossrv
+" Maintainer:   Sergey Alexandrov <alexandrov88@gmail.com>
+" Filenames:    *.srv
+
+" Read the rosmsg syntax to start with
+if version < 600
+  so <sfile>:p:h/rosmsg.vim
+else
+  runtime! syntax/rosmsg.vim
+  unlet b:current_syntax
+endif
+
+syn match rossrvSeparator   "^---$"
+
+hi def link rossrvSeparator Special
+
+let b:current_syntax = "rossrv"