# New Ticket Created by  Andrew Rodland 
# Please include the string:  [perl #30943]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=30943 >


Further improvements under editor/

* Added POD highlighting to pasm.vim
* Fixed POD highlighting in pmc.vim
* Added an indent-script for .imc files
* Fixed the filetype-detect plugin to override previous choices; vim was               
         
mistaking imc and pasm files for ini-files.
* Fixed up MAKEFILE to install the new files
* Updated the documentation
* Manifest update

--hobbs
? myrpn-new.pbc
? editor/imc.vim
? editor/indent_imc.vim
? icu/source/test
? languages/python/.pir
? languages/python/mdis.pyc
? languages/python/mydis.pir
? src/py_func.str
Index: editor/Makefile
===================================================================
RCS file: /cvs/public/parrot/editor/Makefile,v
retrieving revision 1.5
diff -u -r1.5 Makefile
--- editor/Makefile	19 Mar 2004 11:09:31 -0000	1.5
+++ editor/Makefile	4 Aug 2004 00:33:01 -0000
@@ -1,9 +1,18 @@
-all: imc.vim
+all: imc.vim vim-install
 
 imc.vim: imc.vim.in ../ops/*.ops
 	cp -f imc.vim.in imc.vim
 	perl ops2vim.pl ../ops/*.ops >> imc.vim
+
+vim-install: 
+	mkdir -p $(HOME)/.vim/syntax/
 	cp imc.vim $(HOME)/.vim/syntax/
+	cp pasm.vim $(HOME)/.vim/syntax/
+	cp pmc.vim $(HOME)/.vim/syntax/
+	mkdir -p $(HOME)/.vim/ftdetect/
+	cp filetype_parrot.vim $(HOME)/.vim/ftdetect/parrot.vim
+	mkdir -p $(HOME)/.vim/indent
+	cp indent_imc.vim $(HOME)/.vim/indent/imc.vim
 
 imc.kate:
 	perl kate_syntax.pl '../' > imcc.xml
Index: editor/README.pod
===================================================================
RCS file: /cvs/public/parrot/editor/README.pod,v
retrieving revision 1.1
diff -u -r1.1 README.pod
--- editor/README.pod	3 Aug 2004 05:14:09 -0000	1.1
+++ editor/README.pod	4 Aug 2004 00:33:01 -0000
@@ -2,7 +2,7 @@
 
 editor/README.pod - Productivity Comes in Pretty Colors
 
-=head1 Syntax Highlighting
+=head1 Syntax Highlighting and Other Editor Assistance
 
 Included in this directory are some add-ins for making working on parrot (or in
 parrot) easier, for various popular editors. Mostly that means
@@ -11,15 +11,15 @@
 
 =head2 Vim
 
-There are four files here: C<imc.vim> (generated from C<imc.vim.in>),
-C<pasm.vim>, C<pmc.vim>, and C<filetype_parrot.vim>. The first three are syntax
-files, and the last is a filetype script that tells vim to associate the
-extensions .imc, .imcc, .pasm, and .pmc with the right syntax. Copy C<imc.vim>,
-C<pasm.vim>, and C<pmc.vim> into C<~/.vim/syntax> or C<$VIMRUNTIME/syntax>,
-creating the directory if it doesn't exist. Copy C<filetype_parrot.vim> into
-C<~/.vim/ftdetect> or C<$VIMRUNTIME/ftdetect>, creating the directory if it
-doesn't exist. C<pmc.vim> requires C<pod.vim>, which is standard in the Vim
-distribution.
+There are several files here, all with the C<.vim> extension. C<imc.vim>
+(generated from C<imc.vim.in>), C<pasm.vim>, and C<pmc.vim> are syntax
+files; C<indent_imc.vim> is an indent plugin;  and C<filetype_parrot.vim> is a
+filetype script that tells vim to associate the extensions .imc, .imcc, .pasm,
+and .pmc with the right syntax. The syntax files should be installed to
+C<~/.vim/syntax/>; C<filetype_parrot.vim> should be installed to
+C<~/.vim/ftdetect>; C<indent_imc.vim> should be called C<~/.vim/indent/imc.vim>.
+C<make> in the C<editor/> dir will do this automatically. If you want indenting,
+you should also place C<filetype indent on> somewhere in your vimrc.
 
 =head2 Kate
 
Index: editor/filetype_parrot.vim
===================================================================
RCS file: /cvs/public/parrot/editor/filetype_parrot.vim,v
retrieving revision 1.1
diff -u -r1.1 filetype_parrot.vim
--- editor/filetype_parrot.vim	3 Aug 2004 05:14:09 -0000	1.1
+++ editor/filetype_parrot.vim	4 Aug 2004 00:33:01 -0000
@@ -1,3 +1,3 @@
-au BufNewFile,BufRead *.pmc setf pmc
-au BufNewFile,BufRead *.pasm setf pasm
-au BufNewFile,BufRead *.imc,*.imcc setf imc
+au BufNewFile,BufRead *.pmc set ft=pmc
+au BufNewFile,BufRead *.pasm set ft=pasm
+au BufNewFile,BufRead *.imc,*.imcc set ft=imc
Index: editor/pasm.vim
===================================================================
RCS file: /cvs/public/parrot/editor/pasm.vim,v
retrieving revision 1.1
diff -u -r1.1 pasm.vim
--- editor/pasm.vim	28 Feb 2002 21:27:05 -0000	1.1
+++ editor/pasm.vim	4 Aug 2004 00:33:02 -0000
@@ -11,6 +11,9 @@
   finish
 endif
 
+syn include @Pod syntax/pod.vim
+syn region myPod start="^=pod" start="^=item" start="^=head" end="^=cut" keepend [EMAIL PROTECTED]
+
 syn match pasmIdentifier "[A-Za-z0-9_]\+"
 syn match pasmLabel      "[A-Za-z0-9_]\+:"he=e-1
 syn match pasmComment    "#.*"
Index: editor/pmc.vim
===================================================================
RCS file: /cvs/public/parrot/editor/pmc.vim,v
retrieving revision 1.1
diff -u -r1.1 pmc.vim
--- editor/pmc.vim	3 Aug 2004 05:14:09 -0000	1.1
+++ editor/pmc.vim	4 Aug 2004 00:33:04 -0000
@@ -11,8 +11,8 @@
   finish
 endif
 
-syn include @Pod <sfile>:p:h/pod.vim
-syn region pmcPod start="^=[a-z]" end="^=cut" [EMAIL PROTECTED] keepend contained
+syn include @Pod syntax/pod.vim
+syn region pmcPod start="^=[a-z]" end="^=cut" keepend contained [EMAIL PROTECTED]
 
 " A bunch of useful C keywords
 syn keyword	cStatement	goto break return continue asm
@@ -129,7 +129,7 @@
   syntax region cComment	matchgroup=cCommentStart start="/\*" end="\*/" [EMAIL PROTECTED],cCommentStartError,cCommentString,cCharacter,cNumbersCom,cSpaceError,pmcPOD
 else
   syn region	cCommentL	start="//" skip="\\$" end="$" keepend [EMAIL PROTECTED],cSpaceError
-  syn region	cComment	matchgroup=cCommentStart start="/\*" end="\*/" [EMAIL PROTECTED],cCommentStartError,cSpaceError
+  syn region	cComment	matchgroup=cCommentStart start="/\*" end="\*/" [EMAIL PROTECTED],cCommentStartError,cSpaceError,pmcPOD
 endif
 " keep a // comment separately, it terminates a preproc. conditional
 syntax match	cCommentError	display "\*/"
--- /dev/null	2003-09-14 16:16:13.000000000 -0400
+++ editor/indent_imc.vim	2004-08-03 20:23:26.000000000 -0400
@@ -0,0 +1,75 @@
+" Description:	imcc indenter
+" Author:	Andrew Rodland <[EMAIL PROTECTED]>
+" Last Change: 2004 Aug 3
+
+" As usual, we want to be alone
+if exists("b:did_indent")
+	finish
+endif
+let b:did_indent=1
+
+setlocal indentexpr=IMCIndent()
+setlocal indentkeys=o,O,*<Return>,<bs>,:,=.end,0#
+
+fun! InPOD(lnum)
+	return synIDattr(synID(a:lnum, 1, 1), "name") =~? '^myPod$\|^pod[A-Z]'
+endfun
+
+fun! IMCIndent()
+	let thisline = getline(v:lnum)
+
+	let POD_START = '^=[a-z]'
+
+	if thisline =~? POD_START
+		return 0
+	endif
+
+	
+	if InPOD(v:lnum)
+		return -1
+	endif
+
+	let LABEL_OR_COMMENT = '^\s*\k\+:\s*$\|^#'
+	if thisline =~? LABEL_OR_COMMENT
+		return 0
+	endif
+
+	let lnum=v:lnum
+	while lnum > 0
+		let lnum = prevnonblank(lnum-1)
+		let prevline = getline(lnum)
+		
+		if prevline !~? LABEL_OR_COMMENT
+			if !InPOD(lnum)
+				break
+			endif
+		endif
+	endwhile
+
+	if lnum < 1
+		return 0
+	endif
+
+	let ind = indent(lnum)
+	
+	let SUB = '^\s*\.pcc_sub\s\+\|^\s*\.sub\s\+'
+	let RETURNBLOCK = '\s*\.pcc_begin_return\s*$'
+	let END = '^\s*\.end\s*$\|^\s*\.pcc_end_return\s*$'
+
+	if prevline =~? SUB
+		let ind = ind + &sw
+	endif
+
+	if prevline =~? RETURNBLOCK
+		let ind = ind + &sw
+	endif
+
+	if thisline =~? END
+		let ind = ind - &sw
+	endif
+
+	return ind
+
+endfun
+
+
Index: MANIFEST
===================================================================
RCS file: /cvs/public/parrot/MANIFEST,v
retrieving revision 1.715
diff -u -r1.715 MANIFEST
--- MANIFEST	3 Aug 2004 05:14:05 -0000	1.715
+++ MANIFEST	4 Aug 2004 00:42:14 -0000
@@ -351,6 +351,7 @@
 editor/pasm.vim                                   [devel]
 editor/pmc.vim                                    [devel]
 editor/filetype_parrot.vim                        [devel]
+editor/indent_imc.vim                             [devel]
 encodings/utf8.c                                  []
 examples/assembly/99beer.pasm                     [main]doc
 examples/assembly/Makefile                        [main]doc

Reply via email to