diff options
-rw-r--r-- | runtime/doc/Makefile | 2 | ||||
-rw-r--r-- | runtime/doc/ft_raku.txt | 126 | ||||
-rw-r--r-- | runtime/doc/options.txt | 2 | ||||
-rw-r--r-- | runtime/doc/tags | 3 | ||||
-rw-r--r-- | runtime/doc/todo.txt | 31 | ||||
-rw-r--r-- | runtime/doc/usr_12.txt | 6 | ||||
-rw-r--r-- | runtime/doc/usr_41.txt | 22 | ||||
-rw-r--r-- | runtime/ftplugin/perl6.vim | 77 | ||||
-rw-r--r-- | runtime/ftplugin/r.vim | 4 | ||||
-rw-r--r-- | runtime/ftplugin/raku.vim | 127 | ||||
-rw-r--r-- | runtime/ftplugin/rhelp.vim | 4 | ||||
-rw-r--r-- | runtime/ftplugin/rmd.vim | 4 | ||||
-rw-r--r-- | runtime/ftplugin/rnoweb.vim | 4 | ||||
-rw-r--r-- | runtime/ftplugin/rrst.vim | 4 | ||||
-rw-r--r-- | runtime/indent/raku.vim (renamed from runtime/indent/perl6.vim) | 21 | ||||
-rw-r--r-- | runtime/indent/rmd.vim | 32 | ||||
-rw-r--r-- | runtime/indent/vim.vim | 5 | ||||
-rw-r--r-- | runtime/syntax/perl6.vim | 2242 | ||||
-rw-r--r-- | runtime/syntax/r.vim | 38 | ||||
-rw-r--r-- | runtime/syntax/raku.vim | 1971 | ||||
-rw-r--r-- | runtime/syntax/rmd.vim | 44 | ||||
-rw-r--r-- | runtime/syntax/rnoweb.vim | 4 | ||||
-rw-r--r-- | runtime/tutor/tutor.tr.iso9 | 2 | ||||
-rw-r--r-- | src/INSTALL | 2 |
24 files changed, 2367 insertions, 2410 deletions
diff --git a/runtime/doc/Makefile b/runtime/doc/Makefile index e5ff1646ce..e0c0f841e8 100644 --- a/runtime/doc/Makefile +++ b/runtime/doc/Makefile @@ -31,6 +31,7 @@ DOCS = \ fold.txt \ ft_ada.txt \ ft_ps1.txt \ + ft_raku.txt \ ft_rust.txt \ ft_sql.txt \ gui.txt \ @@ -175,6 +176,7 @@ HTMLS = \ fold.html \ ft_ada.html \ ft_ps1.html \ + ft_raku.html \ ft_rust.html \ ft_sql.html \ gui.html \ diff --git a/runtime/doc/ft_raku.txt b/runtime/doc/ft_raku.txt new file mode 100644 index 0000000000..26ada8a140 --- /dev/null +++ b/runtime/doc/ft_raku.txt @@ -0,0 +1,126 @@ +*vim-raku.txt* The Raku programming language filetype + + *vim-raku* + +Vim-raku provides syntax highlighting, indentation, and other support for +editing Raku programs. + +1. Using Unicode in your Raku files |raku-unicode| + +============================================================================== +1. Using Unicode in your Raku files *raku-unicode* + +Defining new operators using Unicode symbols is a good way to make your +Raku program easy to read. See: +https://perl6advent.wordpress.com/2012/12/18/day-18-formulas-resistance-is-futile/ + +While Raku does define ASCII alternatives for some common operators (see +https://docs.raku.org/language/unicode_ascii), using the full range of +Unicode operators is highly desirable. Your operating system provides input +facilities, but using the features built in to Vim may be preferable. + +The natural way to produce these symbols in Vim is to use digraph shortcuts +(:help |digraphs-use|). Many of them are defined; type `:digraphs` to get +the list. A convenient way to read the list of digraphs is to save them in a +file. From the shell: > + vim +'redir >/tmp/vim-digraphs-listing.txt' +digraphs +'redir END' +q + +Some of them are available with standard Vim digraphs: + << « /0 ∅ !< ≮ ~ + >> » Ob ∘ !> ≯ ~ + ., … 00 ∞ (C ⊂ ~ + (U ∩ -: ÷ )C ⊃ ~ + )U ∪ (_ ⊆ >= ≥ ~ + ?= ≅ )_ ⊇ =< ≤ ~ + (- ∈ ?= ≅ != ≠ ~ + -) ∋ ?- ≃ ~ + +The Greek alphabet is available with '*' followed by a similar Latin symbol: + *p π ~ + *t τ ~ + *X × ~ + +Numbers, subscripts and superscripts are available with 's' and 'S': + 0s ₀ 0S ⁰ ~ + 1s ₁ 1S ¹ ~ + 2s ₂ 9S ⁹ ~ + +But some don´t come defined by default. Those are digraph definitions you can +add in your ~/.vimrc file. > + exec 'digraph \\ '.char2nr('∖') + exec 'digraph \< '.char2nr('≼') + exec 'digraph \> '.char2nr('≽') + exec 'digraph (L '.char2nr('⊈') + exec 'digraph )L '.char2nr('⊉') + exec 'digraph (/ '.char2nr('⊄') + exec 'digraph )/ '.char2nr('⊅') + exec 'digraph )/ '.char2nr('⊅') + exec 'digraph U+ '.char2nr('⊎') + exec 'digraph 0- '.char2nr('⊖') + " Euler's constant + exec 'digraph ne '.char2nr('𝑒') + " Raku's atomic operations marker + exec 'digraph @@ '.char2nr('⚛') + +Alternatively, you can write Insert mode abbreviations that convert ASCII- +based operators into their single-character Unicode equivalent. > + iabbrev <buffer> !(<) ⊄ + iabbrev <buffer> !(<=) ⊈ + iabbrev <buffer> !(>) ⊅ + iabbrev <buffer> !(>=) ⊉ + iabbrev <buffer> !(cont) ∌ + iabbrev <buffer> !(elem) ∉ + iabbrev <buffer> != ≠ + iabbrev <buffer> (&) ∩ + iabbrev <buffer> (+) ⊎ + iabbrev <buffer> (-) ∖ + iabbrev <buffer> (.) ⊍ + iabbrev <buffer> (<) ⊂ + iabbrev <buffer> (<+) ≼ + iabbrev <buffer> (<=) ⊆ + iabbrev <buffer> (>) ⊃ + iabbrev <buffer> (>+) ≽ + iabbrev <buffer> (>=) ⊇ + iabbrev <buffer> (\|) ∪ + iabbrev <buffer> (^) ⊖ + iabbrev <buffer> (atomic) ⚛ + iabbrev <buffer> (cont) ∋ + iabbrev <buffer> (elem) ∈ + iabbrev <buffer> * × + iabbrev <buffer> **0 ⁰ + iabbrev <buffer> **1 ¹ + iabbrev <buffer> **2 ² + iabbrev <buffer> **3 ³ + iabbrev <buffer> **4 ⁴ + iabbrev <buffer> **5 ⁵ + iabbrev <buffer> **6 ⁶ + iabbrev <buffer> **7 ⁷ + iabbrev <buffer> **8 ⁸ + iabbrev <buffer> **9 ⁹ + iabbrev <buffer> ... … + iabbrev <buffer> / ÷ + iabbrev <buffer> << « + iabbrev <buffer> <<[=]<< «=« + iabbrev <buffer> <<[=]>> «=» + iabbrev <buffer> <= ≤ + iabbrev <buffer> =~= ≅ + iabbrev <buffer> >= ≥ + iabbrev <buffer> >> » + iabbrev <buffer> >>[=]<< »=« + iabbrev <buffer> >>[=]>> »=» + iabbrev <buffer> Inf ∞ + iabbrev <buffer> atomic-add-fetch ⚛+= + iabbrev <buffer> atomic-assign ⚛= + iabbrev <buffer> atomic-fetch ⚛ + iabbrev <buffer> atomic-dec-fetch --⚛ + iabbrev <buffer> atomic-fetch-dec ⚛-- + iabbrev <buffer> atomic-fetch-inc ⚛++ + iabbrev <buffer> atomic-inc-fetch ++⚛ + iabbrev <buffer> atomic-sub-fetch ⚛−= + iabbrev <buffer> e 𝑒 + iabbrev <buffer> o ∘ + iabbrev <buffer> pi π + iabbrev <buffer> set() ∅ + iabbrev <buffer> tau τ +< + vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 1f4c7e703c..266ab46e3f 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 8.2. Last change: 2021 Apr 16 +*options.txt* For Vim version 8.2. Last change: 2021 Apr 17 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/tags b/runtime/doc/tags index ddc4ce0218..2af7217cc1 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -8718,6 +8718,7 @@ quotestar gui.txt /*quotestar* quote~ change.txt /*quote~* r change.txt /*r* r.vim syntax.txt /*r.vim* +raku-unicode ft_raku.txt /*raku-unicode* rand() eval.txt /*rand()* random eval.txt /*random* range() eval.txt /*range()* @@ -10129,6 +10130,8 @@ vim-dev intro.txt /*vim-dev* vim-mac intro.txt /*vim-mac* vim-modes intro.txt /*vim-modes* vim-modes-intro intro.txt /*vim-modes-intro* +vim-raku ft_raku.txt /*vim-raku* +vim-raku.txt ft_raku.txt /*vim-raku.txt* vim-script-intro usr_41.txt /*vim-script-intro* vim-use intro.txt /*vim-use* vim-variable eval.txt /*vim-variable* diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index 0a00f0ff8c..612e28c89e 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 8.2. Last change: 2021 Apr 17 +*todo.txt* For Vim version 8.2. Last change: 2021 Apr 21 VIM REFERENCE MANUAL by Bram Moolenaar @@ -38,22 +38,7 @@ browser use: https://github.com/vim/vim/issues/1234 *known-bugs* -------------------- Known bugs and current work ----------------------- -make "skiprtp" also omit 'packpath'? - -- Implement blob index and slice assignment? - Make all of test_blob run in three ways - Vim9 - Make everything work: -- use CheckLegacyAndVim9Success(lines) in many more places -- For builtin functions using tv_get_string*() use check_for_string() to be - more strict about the argument type (not a bool). - done: balloon_() -- Check many more builtin function arguments at compile time. - map() could check that the return type of the function argument matches - the type of the list or dict member. (#8092) -- Compile replacement of :s command: s/pat/\=expr/ -- Compile redir to local variable: var_redir_start(). -- Implement type cast at the script level. - Compile builtin functions that access local variables: islocked() - When evaluating constants for script variables, some functions could work: @@ -70,11 +55,15 @@ Vim9 - Make everything work: - give an error for "echo Func()" if Func() does not return anything. - Using "windo echo expr" does not accept a line break inside "expr" (in a :def function and at script level in a not executed block). #7681 -- "assert_fails()" cannot access local variables. Perhaps add this: - assertfails - ... cmd ... - endassertfails /E99:.*cmd/ - Similar to try/catch/endtry but without the boilerplate. +- use CheckLegacyAndVim9Success(lines) in many more places +- For builtin functions using tv_get_string*() use check_for_string() to be + more strict about the argument type (not a bool). + done: balloon_() +- Check many more builtin function arguments at compile time. + map() could check that the return type of the function argument matches + the type of the list or dict member. (#8092) +- Allow for using an autoload function name without quotes. It is then loaded + (and compiled) right away. #8124 Once Vim9 is stable: - Change the help to prefer Vim9 syntax where appropriate diff --git a/runtime/doc/usr_12.txt b/runtime/doc/usr_12.txt index f1af6be194..7781f8e388 100644 --- a/runtime/doc/usr_12.txt +++ b/runtime/doc/usr_12.txt @@ -1,4 +1,4 @@ -*usr_12.txt* For Vim version 8.2. Last change: 2017 Aug 11 +*usr_12.txt* For Vim version 8.2. Last change: 2021 Apr 19 VIM USER MANUAL - by Bram Moolenaar @@ -180,14 +180,14 @@ after it. That way you don't have this problem again. The |:global| command can be combined with the |:move| command to move all the lines before the first line, resulting in a reversed file. The command is: > - :global/^/m 0 + :global/^/move 0 Abbreviated: > :g/^/m 0 The "^" regular expression matches the beginning of the line (even if the line -is blank). The |:move| command moves the matching line to after the mythical +is blank). The |:move| command moves the matching line to after the imaginary zeroth line, so the current matching line becomes the first line of the file. As the |:global| command is not confused by the changing line numbering, |:global| proceeds to match all remaining lines of the file and puts each as diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index f0e1ee5c14..f34891a905 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -1,4 +1,4 @@ -*usr_41.txt* For Vim version 8.2. Last change: 2021 Mar 14 +*usr_41.txt* For Vim version 8.2. Last change: 2021 Apr 19 VIM USER MANUAL - by Bram Moolenaar @@ -115,12 +115,20 @@ if you are impatient. FOUR KINDS OF NUMBERS -Numbers can be decimal, hexadecimal, octal or binary. A hexadecimal number -starts with "0x" or "0X". For example "0x1f" is decimal 31. An octal number -starts with a zero. "017" is decimal 15. A binary number starts with "0b" or -"0B". For example "0b101" is decimal 5. Careful: don't put a zero before a -decimal number, it will be interpreted as an octal number! - The ":echo" command always prints decimal numbers. Example: > +Numbers can be decimal, hexadecimal, octal or binary. + +A hexadecimal number starts with "0x" or "0X". For example "0x1f" is decimal +31. + +An octal number starts with "0o", "0O" or a zero and another digit. "0o17" is +decimal 15. Using just a zero prefix is not supported in Vim9 script. + +A binary number starts with "0b" or "0B". For example "0b101" is decimal 5. + +A decimal number is just digits. Careful: don't put a zero before a decimal +number, it will be interpreted as an octal number in legacy script! + +The ":echo" command always prints decimal numbers. Example: > :echo 0x7f 0o36 < 127 30 ~ diff --git a/runtime/ftplugin/perl6.vim b/runtime/ftplugin/perl6.vim deleted file mode 100644 index 0467bea0c2..0000000000 --- a/runtime/ftplugin/perl6.vim +++ /dev/null @@ -1,77 +0,0 @@ -" Vim filetype plugin file -" Language: Perl 6 -" Maintainer: vim-perl <vim-perl@googlegroups.com> -" Homepage: https://github.com/vim-perl/vim-perl -" Bugs/requests: https://github.com/vim-perl/vim-perl/issues -" Last Change: 2020 Apr 15 -" Contributors: Hinrik Örn Sigurðsson <hinrik.sig@gmail.com> -" -" Based on ftplugin/perl.vim by Dan Sharp <dwsharp at hotmail dot com> - -if exists("b:did_ftplugin") | finish | endif -let b:did_ftplugin = 1 - -" Make sure the continuation lines below do not cause problems in -" compatibility mode. -let s:save_cpo = &cpo -set cpo-=C - -setlocal formatoptions-=t -setlocal formatoptions+=crqol -setlocal keywordprg=p6doc - -setlocal comments=:# -setlocal commentstring=#%s - -" Change the browse dialog on Win32 to show mainly Perl-related files -if has("gui_win32") - let b:browsefilter = "Perl Source Files (*.pl)\t*.pl\n" . - \ "Perl Modules (*.pm)\t*.pm\n" . - \ "Perl Documentation Files (*.pod)\t*.pod\n" . - \ "All Files (*.*)\t*.*\n" -endif - -" Provided by Ned Konz <ned at bike-nomad dot com> -"--------------------------------------------- -setlocal include=\\<\\(use\\\|require\\)\\> -setlocal includeexpr=substitute(substitute(v:fname,'::','/','g'),'$','.pm','') -setlocal define=[^A-Za-z_] - -" The following line changes a global variable but is necessary to make -" gf and similar commands work. Thanks to Andrew Pimlott for pointing out -" the problem. If this causes a " problem for you, add an -" after/ftplugin/perl6.vim file that contains -" set isfname-=: -set isfname+=: -setlocal iskeyword=48-57,_,A-Z,a-z,:,- - -" Set this once, globally. -if !exists("perlpath") - if executable("perl6") - try - if &shellxquote != '"' - let perlpath = system('perl6 -e "@*INC.join(q/,/).say"') - else - let perlpath = system("perl6 -e '@*INC.join(q/,/).say'") - endif - let perlpath = substitute(perlpath,',.$',',,','') - catch /E145:/ - let perlpath = ".,," - endtry - else - " If we can't call perl to get its path, just default to using the - " current directory and the directory of the current file. - let perlpath = ".,," - endif -endif - -let &l:path=perlpath -"--------------------------------------------- - -" Undo the stuff we changed. -let b:undo_ftplugin = "setlocal fo< com< cms< inc< inex< def< isk<" . - \ " | unlet! b:browsefilter" - -" Restore the saved compatibility options. -let &cpo = s:save_cpo -unlet s:save_cpo diff --git a/runtime/ftplugin/r.vim b/runtime/ftplugin/r.vim index 4ea3073922..a78afa2e7e 100644 --- a/runtime/ftplugin/r.vim +++ b/runtime/ftplugin/r.vim @@ -2,7 +2,7 @@ " Language: R " Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com> " Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Tue Apr 07, 2015 04:38PM +" Last Change: Sat Aug 15, 2020 11:37AM " Only do this when not yet done for this buffer if exists("b:did_ftplugin") @@ -20,7 +20,7 @@ setlocal formatoptions-=t setlocal commentstring=#\ %s setlocal comments=:#',:###,:##,:# -if has("gui_win32") && !exists("b:browsefilter") +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") let b:browsefilter = "R Source Files (*.R)\t*.R\n" . \ "Files that include R (*.Rnw *.Rd *.Rmd *.Rrst)\t*.Rnw;*.Rd;*.Rmd;*.Rrst\n" . \ "All Files (*.*)\t*.*\n" diff --git a/runtime/ftplugin/raku.vim b/runtime/ftplugin/raku.vim new file mode 100644 index 0000000000..941222bd38 --- /dev/null +++ b/runtime/ftplugin/raku.vim @@ -0,0 +1,127 @@ +" Vim filetype plugin file +" Language: Raku +" Maintainer: vim-perl <vim-perl@googlegroups.com> +" Homepage: https://github.com/Raku/vim-raku +" Bugs/requests: https://github.com/Raku/vim-raku/issues +" Last Change: 2021-04-16 +" Contributors: Hinrik Örn Sigurðsson <hinrik.sig@gmail.com> +" +" Based on ftplugin/perl.vim by Dan Sharp <dwsharp at hotmail dot com> + +if exists("b:did_ftplugin") | finish | endif +let b:did_ftplugin = 1 + +" Make sure the continuation lines below do not cause problems in +" compatibility mode. +let s:save_cpo = &cpo +set cpo-=C + +setlocal formatoptions-=t +setlocal formatoptions+=crqol +setlocal keywordprg=p6doc + +setlocal comments=:#\|,:#=,:# +setlocal commentstring=#%s + +" Provided by Ned Konz <ned at bike-nomad dot com> +"--------------------------------------------- +setlocal include=\\<\\(use\\\|require\\)\\> +setlocal includeexpr=substitute(v:fname,'::','/','g') +setlocal suffixesadd=.rakumod,.rakudoc,.pm6,.pm +setlocal define=[^A-Za-z_] + +" The following line changes a global variable but is necessary to make +" gf and similar commands work. Thanks to Andrew Pimlott for pointing out +" the problem. If this causes a problem for you, add an +" after/ftplugin/raku.vim file that contains +" set isfname-=: +set isfname+=: +setlocal iskeyword=@,48-57,_,192-255,- + +" Raku exposes its CompUnits through $*REPO, but mapping module names to +" compunit paths is nontrivial. Probably it's more convenient to rely on +" people using zef, which has a handy store of sources for modules it has +" installed. +func s:compareReverseFtime(a, b) + let atime = getftime(a:a) + let btime = getftime(a:b) + return atime > btime ? -1 : atime == btime ? 0 : 1 +endfunc + +let &l:path = "lib,." +if exists('$RAKULIB') + let &l:path = &l:path . "," . $RAKULIB +endif +let &l:path = &l:path . "," . join( + \ sort(glob("~/.zef/store/*/*/lib", 0, 1), "s:compareReverseFtime"), + \ ',') + +" Convert ascii-based ops into their single-character unicode equivalent +if get(g:, 'raku_unicode_abbrevs', 0) + iabbrev <buffer> !(<) ⊄ + iabbrev <buffer> !(<=) ⊈ + iabbrev <buffer> !(>) ⊅ + iabbrev <buffer> !(>=) ⊉ + iabbrev <buffer> !(cont) ∌ + iabbrev <buffer> !(elem) ∉ + iabbrev <buffer> != ≠ + iabbrev <buffer> (&) ∩ + iabbrev <buffer> (+) ⊎ + iabbrev <buffer> (-) ∖ + iabbrev <buffer> (.) ⊍ + iabbrev <buffer> (<) ⊂ + iabbrev <buffer> (<+) ≼ + iabbrev <buffer> (<=) ⊆ + iabbrev <buffer> (>) ⊃ + iabbrev <buffer> (>+) ≽ + iabbrev <buffer> (>=) ⊇ + iabbrev <buffer> (\|) ∪ + iabbrev <buffer> (^) ⊖ + iabbrev <buffer> (atomic) ⚛ + iabbrev <buffer> (cont) ∋ + iabbrev <buffer> (elem) ∈ + iabbrev <buffer> * × + iabbrev <buffer> **0 ⁰ + iabbrev <buffer> **1 ¹ + iabbrev <buffer> **2 ² + iabbrev <buffer> **3 ³ + iabbrev <buffer> **4 ⁴ + iabbrev <buffer> **5 ⁵ + iabbrev <buffer> **6 ⁶ + iabbrev <buffer> **7 ⁷ + iabbrev <buffer> **8 ⁸ + iabbrev <buffer> **9 ⁹ + iabbrev <buffer> ... … + iabbrev <buffer> / ÷ + iabbrev <buffer> << « + iabbrev <buffer> <<[=]<< «=« + iabbrev <buffer> <<[=]>> «=» + iabbrev <buffer> <= ≤ + iabbrev <buffer> =~= ≅ + iabbrev <buffer> >= ≥ + iabbrev <buffer> >> » + iabbrev <buffer> >>[=]<< »=« + iabbrev <buffer> >>[=]>> »=» + iabbrev <buffer> Inf ∞ + iabbrev <buffer> atomic-add-fetch ⚛+= + iabbrev <buffer> atomic-assign ⚛= + iabbrev <buffer> atomic-fetch ⚛ + iabbrev <buffer> atomic-dec-fetch --⚛ + iabbrev <buffer> atomic-fetch-dec ⚛-- + iabbrev <buffer> atomic-fetch-inc ⚛++ + iabbrev <buffer> atomic-inc-fetch ++⚛ + iabbrev <buffer> atomic-sub-fetch ⚛−= + iabbrev <buffer> e 𝑒 + iabbrev <buffer> o ∘ + iabbrev <buffer> pi π + iabbrev <buffer> set() ∅ + iabbrev <buffer> tau τ +endif + +" Undo the stuff we changed. +let b:undo_ftplugin = "setlocal fo< com< cms< inc< inex< def< isf< isk< kp< path<" . + \ " | unlet! b:browsefilter" + +" Restore the saved compatibility options. +let &cpo = s:save_cpo +unlet s:save_cpo diff --git a/runtime/ftplugin/rhelp.vim b/runtime/ftplugin/rhelp.vim index fdac38f3e9..d0b546d62d 100644 --- a/runtime/ftplugin/rhelp.vim +++ b/runtime/ftplugin/rhelp.vim @@ -2,7 +2,7 @@ " Language: R help file " Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com> " Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Tue Apr 07, 2015 04:37PM +" Last Change: Sat Aug 15, 2020 12:01PM " Only do this when not yet done for this buffer if exists("b:did_ftplugin") @@ -17,7 +17,7 @@ set cpo&vim setlocal iskeyword=@,48-57,_,. -if has("gui_win32") && !exists("b:browsefilter") +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst\n" . \ "All Files (*.*)\t*.*\n" endif diff --git a/runtime/ftplugin/rmd.vim b/runtime/ftplugin/rmd.vim index 7b0db8dbb5..2ee72ffc6c 100644 --- a/runtime/ftplugin/rmd.vim +++ b/runtime/ftplugin/rmd.vim @@ -2,7 +2,7 @@ " Language: R Markdown file " Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com> " Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Sun Jul 22, 2018 06:51PM +" Last Change: Sat Aug 15, 2020 12:03PM " Original work by Alex Zvoleff (adjusted from R help for rmd by Michel Kuhlmann) " Only do this when not yet done for this buffer @@ -46,7 +46,7 @@ runtime ftplugin/pandoc.vim " Don't load another plugin for this buffer let b:did_ftplugin = 1 -if has("gui_win32") && !exists("b:browsefilter") +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst\n" . \ "All Files (*.*)\t*.*\n" endif diff --git a/runtime/ftplugin/rnoweb.vim b/runtime/ftplugin/rnoweb.vim index e184399dcb..dc5f1b5e06 100644 --- a/runtime/ftplugin/rnoweb.vim +++ b/runtime/ftplugin/rnoweb.vim @@ -2,7 +2,7 @@ " Language: Rnoweb " Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com> " Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Tue Apr 07, 2015 04:37PM +" Last Change: Sat Aug 15, 2020 12:02PM " Only do this when not yet done for this buffer if exists("b:did_ftplugin") @@ -24,7 +24,7 @@ setlocal iskeyword=@,48-57,_,. setlocal suffixesadd=.bib,.tex setlocal comments=b:%,b:#,b:##,b:###,b:#' -if has("gui_win32") && !exists("b:browsefilter") +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst\n" . \ "All Files (*.*)\t*.*\n" endif diff --git a/runtime/ftplugin/rrst.vim b/runtime/ftplugin/rrst.vim index 3e82847d35..a56fd6478e 100644 --- a/runtime/ftplugin/rrst.vim +++ b/runtime/ftplugin/rrst.vim @@ -2,7 +2,7 @@ " Language: reStructuredText documentation format with R code " Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com> " Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Wed Nov 01, 2017 10:47PM +" Last Change: Sat Aug 15, 2020 12:02PM " Original work by Alex Zvoleff " Only do this when not yet done for this buffer @@ -37,7 +37,7 @@ if !exists("g:rrst_dynamic_comments") || (exists("g:rrst_dynamic_comments") && g setlocal formatexpr=FormatRrst() endif -if has("gui_win32") && !exists("b:browsefilter") +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst\n" . \ "All Files (*.*)\t*.*\n" endif diff --git a/runtime/indent/perl6.vim b/runtime/indent/raku.vim index 51c7923182..3f9b49ec77 100644 --- 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 diff --git a/runtime/indent/rmd.vim b/runtime/indent/rmd.vim index 83fe4e4fed..8fd57257fa 100644 --- a/runtime/indent/rmd.vim +++ b/runtime/indent/rmd.vim @@ -2,7 +2,7 @@ " Language: Rmd " Author: Jakson Alves de Aquino <jalvesaq@gmail.com> " Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Sun Aug 19, 2018 09:14PM +" Last Change: Sun Mar 28, 2021 08:05PM " Only load this indent file when no other was loaded. @@ -13,7 +13,7 @@ runtime indent/r.vim let s:RIndent = function(substitute(&indentexpr, "()", "", "")) let b:did_indent = 1 -setlocal indentkeys=0{,0},:,!^F,o,O,e +setlocal indentkeys=0{,0},<:>,!^F,o,O,e setlocal indentexpr=GetRmdIndent() if exists("*GetRmdIndent") @@ -23,6 +23,21 @@ endif let s:cpo_save = &cpo set cpo&vim +" Simple Python indentation algorithm +function s:GetPyIndent() + let plnum = prevnonblank(v:lnum - 1) + let pline = getline(plnum) + let cline = getline(v:lnum) + if pline =~ '^s```\s*{\s*python ' + return 0 + elseif pline =~ ':$' + return indent(plnum) + &shiftwidth + elseif cline =~ 'else:$' + return indent(plnum) - &shiftwidth + endif + return indent(plnum) +endfunction + function s:GetMdIndent() let pline = getline(v:lnum - 1) let cline = getline(v:lnum) @@ -37,13 +52,14 @@ function s:GetMdIndent() endfunction function s:GetYamlIndent() - let pline = getline(v:lnum - 1) + let plnum = prevnonblank(v:lnum - 1) + let pline = getline(plnum) if pline =~ ':\s*$' - return indent(v:lnum) + shiftwidth() + return indent(plnum) + shiftwidth() elseif pline =~ '^\s*- ' return indent(v:lnum) + 2 endif - return indent(prevnonblank(v:lnum - 1)) + return indent(plnum) endfunction function GetRmdIndent() @@ -52,9 +68,11 @@ function GetRmdIndent() endif if search('^[ \t]*```{r', "bncW") > search('^[ \t]*```$', "bncW") return s:RIndent() - elseif v:lnum > 1 && search('^---$', "bnW") == 1 && - \ (search('^---$', "nW") > v:lnum || search('^...$', "nW") > v:lnum) + elseif v:lnum > 1 && (search('^---$', "bnW") == 1 && + \ (search('^---$', "nW") > v:lnum || search('^\.\.\.$', "nW") > v:lnum)) return s:GetYamlIndent() + elseif search('^[ \t]*```{python', "bncW") > search('^[ \t]*```$', "bncW") + return s:GetPyIndent() else return s:GetMdIndent() endif diff --git a/runtime/indent/vim.vim b/runtime/indent/vim.vim index 5c022642b5..ca1e4725af 100644 --- a/runtime/indent/vim.vim +++ b/runtime/indent/vim.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Vim script " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2021 Feb 18 +" Last Change: 2021 Apr 18 " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -71,7 +71,8 @@ function GetVimIndentIntern() " End of heredoc: use indent of matching start line let lnum = v:lnum - 1 while lnum > 0 - if synIDattr(synID(lnum, 1, 1), "name") !~ 'vimLetHereDoc' + let attr = synIDattr(synID(lnum, 1, 1), "name") + if attr != '' && attr !~ 'vimLetHereDoc' return indent(lnum) endif let lnum -= 1 diff --git a/runtime/syntax/perl6.vim b/runtime/syntax/perl6.vim deleted file mode 100644 index 62ddc456e2..0000000000 --- a/runtime/syntax/perl6.vim +++ /dev/null @@ -1,2242 +0,0 @@ -" Vim syntax file -" Language: Perl 6 -" Maintainer: vim-perl <vim-perl@googlegroups.com> -" Homepage: https://github.com/vim-perl/vim-perl/tree/master -" Bugs/requests: https://github.com/vim-perl/vim-perl/issues -" Last Change: 2020 Apr 15 - -" Contributors: Luke Palmer <fibonaci@babylonia.flatirons.org> -" Moritz Lenz <moritz@faui2k3.org> -" Hinrik Örn Sigurðsson <hinrik.sig@gmail.com> -" -" This is a big undertaking. Perl 6 is the sort of language that only Perl -" can parse. But I'll do my best to get vim to. -" -" You can associate the extension ".pl" with the filetype "perl6" by setting -" autocmd BufNewFile,BufRead *.pl setf perl6 -" in your ~/.vimrc. But that will infringe on Perl 5, so you might want to -" put a modeline near the beginning or end of your Perl 6 files instead: -" # vim: filety |