perl-support
perl-support copied to clipboard
Cursor position not honoured after Comments.shebang
Hello,
I've just upgraded vim, perl and perl-support and TBH, things are working surprisingly well. However I have one issue to report regarding the Comments.shebang used in Perl::FileSkeleton::Script. As it stands in the default templates the position of <CURSOR> is not honoured when opening a new *.pl script - the cursor is at the very top left (on the hash of the shebang line) and the user is in insert mode.
Other filetypes (*.t, *.pm, etc) are fine so I was able to narrow it down to the shebang line. Furthermore, if the Comments.shebang is moved to the end of the list in Perl::FileSkeleton::Script, ie.
SetProperty ( 'Perl::FileSkeleton::Script', 'Comments.file description pl; ;Skeleton.script-use;Comments.shebang' )
then the position of <CURSOR> is honoured, but of course the shebang line is now at the end of the file which is no use.
Obviously, I can work around this for now quite simply. However I wanted to raise it in case it was indicative of some wider problem.
I am using a fresh clone of perl-support from this repo (up to f3f588155946932a77a049634aa9b548ee681337) with vim 8.2.4649 (and perl 5.34.0). The shebang line it puts in is #!/usr/bin/env perl
Let me know if I can help debugging this further. If you can't reproduce this then it's likely something else odd in my personal config and I am sorry to have troubled you with it.
Pete
Thank you for your report.
Are you using the standard template library? The shebang template simply does not have a cursor tag, so it defaults to placing the cursor at the beginning of the line. I guess one would expect the cursor after the interpreter command, so you can add further options to it?
Like so:
== Comments.shebang == start, map:csh ==
#!|PERL_INTERPRETER|<CURSOR>
== ENDTEMPLATE ==
Also, there seems to be a bug with the cursor tag, at least on my maschine. If the tag appears on the end of the line, the cursor is placed in the wrong position. I will investigate.
I am using the Comments.shebang template unaltered. ie:
== Comments.shebang == start, map:csh ==
#!|PERL_INTERPRETER|
== ENDTEMPLATE ==
The problem is that the cursor should not be on the shebang line at all, but rather in the DESCRIPTION line of the pl file template which I have modified only slightly and looks like this:
== Comments.file description pl == map:chpl, sc:d, start, noindent ==
#===============================================================================
#
# FILE: |FILENAME|
#
# USAGE: ./|FILENAME|
#
# DESCRIPTION: <CURSOR>
#
# OPTIONS: ---
# REQUIREMENTS: ---
# BUGS: ---
# NOTES: ---
# AUTHOR: |AUTHOR| (|AUTHORREF|), |EMAIL|
# ORGANIZATION: |ORGANIZATION|
# VERSION: 1.0
# CREATED: |DATE|
#===========================================================================
Thanks for investigating.