diff runtime/indent/raku.vim @ 24520:5bda4653aced

Update runtime files Commit: https://github.com/vim/vim/commit/11e3c5ba820325b69cb56f70e13c21d7b8808d33 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Apr 21 18:09:37 2021 +0200 Update runtime files
author Bram Moolenaar <Bram@vim.org>
date Wed, 21 Apr 2021 18:15:04 +0200
parents runtime/indent/perl6.vim@bd021eb62e73
children 5c220cf30f1f
line wrap: on
line diff
copy from runtime/indent/perl6.vim
copy to runtime/indent/raku.vim
--- a/runtime/indent/perl6.vim
+++ b/runtime/indent/raku.vim
@@ -36,7 +36,7 @@ let b:did_indent = 1
 " Is syntax highlighting active ?
 let b:indent_use_syntax = has("syntax")
 
-setlocal indentexpr=GetPerl6Indent()
+setlocal indentexpr=GetRakuIndent()
 
 " we reset it first because the Perl 5 indent file might have been loaded due
 " to a .pl/pm file extension, and indent files don't clean up afterwards
@@ -50,7 +50,7 @@ endif
 let s:cpo_save = &cpo
 set cpo-=C
 
-function! GetPerl6Indent()
+function! GetRakuIndent()
 
     " Get the line to be indented
     let cline = getline(v:lnum)
@@ -60,11 +60,6 @@ function! GetPerl6Indent()
         return 0
     endif
 
-    " Don't reindent coments on first column
-    if cline =~ '^#'
-        return 0
-    endif
-
     " Get current syntax item at the line's first char
     let csynid = ''
     if b:indent_use_syntax
@@ -72,7 +67,7 @@ function! GetPerl6Indent()
     endif
 
     " Don't reindent POD and heredocs
-    if csynid =~ "^p6Pod"
+    if csynid =~ "^rakuPod"
         return indent(v:lnum)
     endif
 
@@ -92,7 +87,7 @@ function! GetPerl6Indent()
         let skippin = 2
         while skippin
             let synid = synIDattr(synID(lnum,1,0),"name")
-            if (synid =~ "^p6Pod" || synid =~ "p6Comment")
+            if (synid =~ "^rakuPod" || synid =~ "rakuComment")
                 let lnum = prevnonblank(lnum - 1)
                 if lnum == 0
                     return 0
@@ -107,19 +102,19 @@ function! GetPerl6Indent()
     endif
 
         if line =~ '[<«\[{(]\s*\(#[^)}\]»>]*\)\=$'
-            let ind = ind + shiftwidth()
+            let ind = ind + &sw
         endif
         if cline =~ '^\s*[)}\]»>]'
-            let ind = ind - shiftwidth()
+            let ind = ind - &sw
         endif
 
     " Indent lines that begin with 'or' or 'and'
     if cline =~ '^\s*\(or\|and\)\>'
         if line !~ '^\s*\(or\|and\)\>'
-            let ind = ind + shiftwidth()
+            let ind = ind + &sw
         endif
     elseif line =~ '^\s*\(or\|and\)\>'
-        let ind = ind - shiftwidth()
+        let ind = ind - &sw
     endif
 
     return ind