1
0
Fork 0
mirror of https://github.com/vim/vim synced 2025-05-10 02:03:51 +02:00
Commit graph

469 commits

Author SHA1 Message Date
Aliaksei Budavei
85f054aa3f
runtime(java): Recognise the CommonMark form (///) of Javadoc comments
Complement "g:java_ignore_javadoc" with "g:java_ignore_html"
and "g:java_ignore_markdown" to allow selectively disabling
the recognition of HTML and CommonMark respectively.

(Note that this is not a preview feature.)

======================== LIMITATION ========================

According to the syntactical details of JEP 467:

> Any leading whitespace and the three initial / characters
> are removed from each line.
>
> The lines are shifted left, by removing leading whitespace
> characters, until the non-blank line with the least
> leading whitespace has no remaining leading whitespace.
>
> Additional leading whitespace and any trailing whitespace
> in each line is preserved, because it may be significant.

the following example:
------------------------------------------------------------
///    A summary sentence.
///     A list:
///      - Item A.
///     - Item B.
///
///     Some code span, starting here `
///      1 + 2 ` and ending at the previous \`.
------------------------------------------------------------

should be interpreted as if it were written thus:
------------------------------------------------------------
///A summary sentence.
/// A list:
///  - Item A.
/// - Item B.
///
/// Some code span, starting here `
///  1 + 2 ` and ending at the previous \`.
------------------------------------------------------------

Since automatic line rewriting will not be pursued, parts of
such comments having significant whitespace may be ‘wrongly’
highlighted.  For convenience, a &fex function is defined to
‘correct’ it: g:javaformat#RemoveCommonMarkdownWhitespace()
(:help ft-java-plugin).

References:
https://openjdk.org/jeps/467
https://spec.commonmark.org/0.31.2

closes: 

Co-authored-by: Tim Pope <code@tpope.net>
Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-09-30 19:40:04 +02:00
GuyBrush
c854efc6fe
runtime(glvs): fix a few issues
Fix errors on  that:
* led to use the wrong vim runtime directory name if using powershell or
  bash on windows.
* use a wrong pattern to detect the users runtime dir
* allow to use global variables to specify un-archive commands

closes: 

Signed-off-by: GuyBrush <miguel.barro@live.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-09-26 16:14:08 +02:00
Peter Aronoff
be551dacb8
runtime(netrw): remove extraneous closing bracket
fixes: 
closes: 

Signed-off-by: Peter Aronoff <peter@aronoff.org>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-09-22 11:29:40 +02:00
Christian Brabandt
e6b01cfe01
runtime(dist): do not output a message if executable is not found
closes: 

Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-09-20 22:26:56 +02:00
yasuda
c18a9d5835
runtime(netrw): using inefficient highlight pattern for 'mf'
Fixes E872 too many '(' in highlight pattern for `mf` selection

fixup for 
closes: 

Signed-off-by: yasuda <yasuda@kyoto-sr.co.jp>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-09-19 18:09:51 +02:00
Christian Brabandt
0f5effbd1f
runtime(netrw): delete confirmation not strict enough
fixes: 

Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-09-15 19:17:23 +02:00
GuyBrush
609599cc45
runtime(glvs): update GetLatestVimScripts plugin
GetLatestVimScripts builtin plugin required several fixes:
* Support for the new vimbal `.vmb` extension introduced in
  [patch 9.0.1797](f97f6bbf56):
  Vimball/Visual Basic filetype detection conflict
* Update the urls from the old `sourceforge.net` to `vim.org`.
  The download url was hardcoded and a new variable is introduced.
* Fix `curl` command line option to set a filename (`-O` uses the remote
  filename and `-o` specifies a filename).
* Replace windows' command to move files. `REN` can only rename files and
  the script actually moves them. My educated guess was that originally
  only renaming was necessary. When the script was modified to move
  files no change was required on linux because `mv` does both.
* Fix Autoinstall support to check `ftplugins` and `pack-plugins` too
  (`pack-plugins` did not exist when the plugin was created).

closes: 

Signed-off-by: GuyBrush <miguel.barro@live.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-09-08 19:54:43 +02:00
Gregory Anders
150b5078ac
runtime(hcl,terraform): Add runtime files for HCL and Terraform
closes: 

Signed-off-by: Gregory Anders <greg@gpanders.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-09-04 22:19:45 +02:00
yasuda
c75dad0177
runtime(netrw): Change line on mx if command output exists
closes: 

Signed-off-by: yasuda <yasuda@kyoto-sr.co.jp>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-08-22 21:06:32 +02:00
yasuda
38cfa2b662
runtime(netrw): Fix mf-selected entry highlighting
closes: 

Signed-off-by: yasuda <yasuda@kyoto-sr.co.jp>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-08-22 20:54:47 +02:00
Christian Brabandt
bc29ea6286
runtime(zip): simplify condition to detect MS-Windows
related: 

Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-08-21 08:20:13 +02:00
Christian Brabandt
7790ea0c68
patch 9.1.0686: zip-plugin has problems with special characters
Problem:  zip-plugin has problems with special characters
          (user202729)
Solution: escape '*?[\' on Unix and handle those chars
          a bit differently on MS-Windows, add a test, check
          before overwriting files

runtime(zip): small fixes for zip plugin

This does the following:
- verify the unzip plugin is executable when loading the autoload plugin
- handle extracting file names with '[*?\' in its name correctly by
  escaping those characters for the unzip command (and handle those
  characters a bit differently on MS-Windows, since the quoting is different)
- verify, that the extract plugin is not overwriting a file (could cause
  a hang, because unzip asking for confirmation)
- add a test zip file which contains those special file names

fixes: 
closes: 

Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-08-20 22:41:52 +02:00
Christian Brabandt
8e25d91cb7
runtime(dist): verify that executable is in $PATH
Otherwise, if the executable to be verified does not exist,
this would cause a false-positive in the 'IsSafeExecutable()' check,
because 'exepath(executable)' returns an empty string and
'fnamemodify('', ':p:h')' returns the current directory and as a result
the 'IsSafeExecutable()' returns false (for the wrong reason).

Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-08-17 21:00:55 +02:00
Damien
1fbccc1e96
runtime(netrw): Drop committed trace lines
closes: 

Signed-off-by: Damien <141588647+xrandomname@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-08-15 22:01:24 +02:00
Damien
b4d1164425
runtime(netrw): Error popup not always used
Problem:  g:netrw_use_errorwindow=2 does not work
          without +balloon_eval.
Solution: Check for popup_atcursor().

related: 

Signed-off-by: Damien <141588647+xrandomname@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-08-15 22:00:45 +02:00
Damien
7c754110ff
runtime(netrw): ErrorMsg() may throw E121
Move variables declaration

related: 

Signed-off-by: Damien <141588647+xrandomname@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-08-15 22:00:10 +02:00
Christian Brabandt
e2d9b0d499
runtime(zip): zip plugin does not work with Vim 9.0
Problem:  zip plugin does not work with Vim 9.0
          because of :defer
Solution: raise minimum Vim version to Vim 9.1

Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-08-07 08:13:32 +02:00
Christian Brabandt
afea6b9468
runtime(zip): use defer to restore old settings
Problem:  RestoreOpts() plugin called too often
Solution: use :defer to have the RestoreOpts() function
          called when the function returns automatically

Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-08-06 20:19:50 +02:00
Christian Brabandt
8d52926857
runtime(zip): add a generic Message function
Problem:  the zip plugin duplicates a lot of code for displaying
          warnings/errors
Solution: refactor common code into a generic Mess() function

Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-08-06 20:19:49 +02:00
Christian Brabandt
a336d8f21e
runtime(zip): increment base version of zip plugin
Problem:  the zip plugin version is still v33
Solution: increment the version to v34

Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-08-06 20:19:49 +02:00
Christian Brabandt
e1044fb72e
runtime(zip): raise minimum Vim version to v9.0
Problem:  the zip plugin uses features of Vim 9.0, but
          checks for a Vim version >= 7.2
          (interpolated strings and readblob() function)
Solution: raise the minimum Vim version to v9.0

Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-08-06 20:19:49 +02:00
Christian Brabandt
19636be55e
runtime(zip): refactor save and restore of options
Problem:  zip plugin has no way to set/restore option values
Solution: Add the SetSaneOpts() and RestoreOpts() functions,
          so options that cause issues are set to sane values
          and restored back to their initial values later on.
          (this affects the 'shellslash' option on windows, which also
          changes how the shellescape() function works)

Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-08-06 20:19:37 +02:00
Christian Brabandt
33836d38b8
runtime(zip): remove test for fnameescape
Problem:  zip plugin tests for fnameescape() function
Solution: Remove the check, fnameescape() has been available since
          7.1.299, it should nowadays always be available

Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-08-06 20:03:22 +02:00
Christian Brabandt
120c0dd815
runtime(zip): use :echomsg instead of :echo
Problem:  zip plugin uses :echo which does not store messages
Solution: use :echomsg instead of :echo so that messages are stored in
          the message history

Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-08-06 20:02:05 +02:00
Christian Brabandt
a63f66e953
runtime(zip): clean up and remove comments
Problem:  zip plugin contains a lot of comments from the decho plugin
Solution: Clean up and remove un-used comments

Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-08-06 20:00:31 +02:00
Damien
f0e9b72c8f
runtime(zip): Fix for FreeBSD's unzip command
Problem:  Cannot browse zipfiles with the unzip program found
	  on FreeBSD.
Solution: Adjust command arguments.

Unzip found on FreeBSD complain about missing argument with the
zipinfo modifier '-Z -1'. Joining arguments seems to work
for both implementations.

Also change `:sil!` to `:sil` so that error messages are properly
reported (per review of Christian Brabandt).

related: 

Signed-off-by: Damien <141588647+xrandomname@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-08-05 20:21:18 +02:00
zeertzjq
c5bdd66558
runtime(zip): escape '[' on Unix as well
Problem:  After 6f1cbfc9ab483a09877e153ad130164875c40b1d fnameescape()
          is no longer called on the name of the file to be extracted.
          However, while spaces indeed don't need to be escaped, unzip
          treats '[' as a wildcard character, so it need to be escaped.
Solution: Escape '[' on both MS-Windows and Unix.

From the docs it seems '*' and '?' also need escaping, but they seem to
actually work without escaping.

fixes: neovim/neovim#29977
closes: 

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-08-04 18:35:50 +02:00
Ivan Shapovalov
c527d90fae
runtime(netrw): honor g:netrw_alt{o,v} for :{S,H,V}explore
Make `:Sexplore` / `:Hexplore` / `:Vexplore` commands honor the user
`&split{right,below}` settings (or netrw-specific `g:netrw_alt{o,v}`)
instead of hardcoding a split direction. Similarly, update banged
variants of the two latter commands to follow the inverted preference.

closes: 

Signed-off-by: Ivan Shapovalov <intelfx@intelfx.name>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-08-02 19:43:12 +02:00
Travis Shelton
e34d0e37e3
runtime(netrw): removing trailing slash when copying files in same directory
closes: 

Signed-off-by: Travis Shelton <tshelton.mail@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-07-30 21:10:38 +02:00
Damien
c4be066817
runtime(zip): Opening a remote zipfile don't work
Problem:  Opening a zipfile from HTTP gives an empty buffer.
Solution: Ensure that the magic bytes check does not
          skip protocol processing.

Also use readblob() and remove commented out lines.

closes: 

Signed-off-by: Damien <141588647+xrandomname@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-07-30 19:14:35 +02:00
EliSauder
e57c9a19ed
patch 9.1.0635: filetype: SuperHTML template files not recognized
Problem:  filetype: SuperHTML template files not recognized
Solution: Update the filetype detection code to detect '*.shtml' either
          as HTML (Server Side Includes) or SuperHTML (template files)
          (EliSauder)

related: 
related: 

Signed-off-by: EliSauder <24995216+EliSauder@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-07-28 21:28:11 +02:00
Ken Takata
eb4b903c9b
patch 9.1.0616: filetype: Make syntax highlighting off for MS Makefiles
Problem:  filetype: Make syntax highlighting off for MS Makefiles
Solution: Try to detect MS Makefiles and adjust syntax rules to it.
          (Ken Takata)

Highlighting of variable expansion in Microsoft Makefile can be broken.
E.g.:
2979cfc262/src/Make_mvc.mak (L1331)

Don't use backslash as escape characters if `make_microsoft` is set.
Also fix that `make_no_comments` was not considered if `make_microsoft`
was set.

Also add description for `make_microsoft` and `make_no_comments` to the
documentation and include a very simple filetype test

closes: 

Signed-off-by: Christian Brabandt <cb@256bit.org>
Signed-off-by: Ken Takata <kentkt@csc.jp>
2024-07-25 21:16:37 +02:00
Damien
2cad941dc0
runtime(zip): Use delete() for deleting directory
This is safer because we don't invoke the shell.

closes: 

Signed-off-by: Damien <141588647+xrandomname@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-07-24 20:07:00 +02:00
Christian Brabandt
581d4a7b35
runtime(netrw): escape filename before trying to delete it
fixes: 

Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-07-23 21:14:06 +02:00
Damien
38ce71c1c3
runtime(zip): correctly extract file from zip browser
Problem:  Enter 'x' in zip browser fail with E121
Solution: Fix typo in zip#Extract()

closes: 

Signed-off-by: Damien <141588647+xrandomname@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-07-23 19:58:36 +02:00
Damien
9d57ea5cd3
runtime(netrw): Fix endless recursion in netrw#Explore()
Problem:  ':E /etc BOOM' give E132 error.
Solution: Avoid recursion call with same arguments.

fixes: 
closes: 

Signed-off-by: Damien <141588647+xrandomname@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-07-22 20:25:34 +02:00
igna_martinoli
37853b7de3
patch 9.1.0602: filetype: Prolog detection can be improved
Problem:  filetype: Prolog detection can be improved
Solution: update the prolog detection regex
          (igna_martinoli)

related: 
related: 
closes: 

Co-authored-by: clason <c.clason@uni-graz.at>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: igna_martinoli <ignamartinoli@protonmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-07-18 21:34:36 +02:00
Gregory Anders
1cc4cae961
runtime(typst): Add typst runtime files
closes: 

Signed-off-by: Gregory Anders <greg@gpanders.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-07-15 20:00:48 +02:00
igna_martinoli
7347642633
runtime(filetype): Fix Prolog file detection regex
Problem: filetype: .pro file detection for Prolog is broken
Solution: fixed the regex to only match on the tested
          cases (igna_martinoli)

fixes: 
closes: 

Signed-off-by: igna_martinoli <ignamartinoli@protonmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-07-12 07:33:32 +02:00
igna_martinoli
50dc83cf92
patch 9.1.0558: filetype: prolog detection can be improved
Problem:  filetype: prolog detection can be improved
Solution: Improved the Prolog file detection regex and added tests for
          all cases. (igna_martinoli)

fixes: 
closes: 

Signed-off-by: igna_martinoli <ignamartinoli@protonmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-07-10 21:25:04 +02:00
Christian Brabandt
c03f631b7b
patch 9.1.0555: filetype: angular ft detection is still problematic
Problem:  filetype: angular ft detection is still problematic
          (after 9.1.0551)
Solution: detect htmlangular filetype only by inspecting the content,
          do not try to determine it from a generic name like
          '*.component.html'

For the reasons mentioned here:

https://github.com/vim/vim/pull/13594#issuecomment-1834465890

related: 
related: 
related: 

Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-07-10 19:31:00 +02:00
Dennis van den Berg
1ad194c0df
patch 9.1.0551: filetype: htmlangular files are not properly detected
Problem:  filetype: htmlangular files are not properly detected
Solution: Use the new htmlangular filetype for angular files, because
          since angular v17, those are no longer valid HTML files.
          (Dennis van den Berg)

Since Angular 17, the new Control Flow Syntax is not valid HTML. This PR
adds a new filetype detection for the HTML templates of Angular.

It first checks the filename. The Angular convention is to use
*.component.html for the template. However, this is not mandatory.

If the filename does not match, it will check the contents of the file
if it contains:

  - One of the Control-Flow blocks: @if, @for, @switch, @defer
  - A structural directive: *ngIf, *ngFor, *ngSwitch, *ngTemplateOutlet
  - Builtin Angular elements: ng-template or ng-content
  - String interpolation: {{ something }}

This enables the Angular LSP to attach only to htmlangular filetypes, as
well as language parsers, such as tree-sitter.

closes: 

Signed-off-by: Dennis van den Berg <dennis.vandenberg@nedap.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-07-09 19:44:32 +02:00
Ivan Shapovalov
84ca1388d8
runtime(man): honor cmd modifiers before g:ft_man_open_mode
Give priority to (placement) command modifiers, specifically
`:vertical`, `:horizontal` and `:tab`, ahead of `g:ft_man_open_mode`,
so that if the user says e.g. `:vert Man`, Vim does the expected thing.

closes: 

Signed-off-by: Ivan Shapovalov <intelfx@intelfx.name>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-07-06 16:57:18 +02:00
Enno
3146d63267
runtime(netrw): fix remaining case of register clobber
complements 62f7b55c1a

closes: 

Signed-off-by: Enno <Konfekt@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-07-04 19:45:36 +02:00
Christian Brabandt
62f7b55c1a
runtime(netrw): save and restore register 0-9, a and unnamed
fixes: 

Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-06-23 20:23:40 +02:00
PowerUser64
aa61b8a908
patch 9.1.0505: filetype: Faust files are not recognized
Problem:  filetype: Faust files are not recognized
Solution: Detect '*.lib' files as Faust filetype, add detection for
          '*.dsp' files (Faust or Make), remove '*.lib' from Cobol
          filetype (PowerUser64)

closes: 

Signed-off-by: PowerUser64 <blake@blakenorth.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-06-19 20:32:11 +02:00
Afiq Nazrie
9718ed7ab9
runtime(filetype): update htmldjango detection
- update tags to detect djangohtml based on
  https://docs.djangoproject.com/en/5.0/ref/templates/builtins/#built-in-tag-reference

- increase the lines to inspect to 40 lines

  10 lines is too few and might result in high false negative.
  Increasing it to 40 lines should reduce the false negative.

closes: 

Signed-off-by: Afiq Nazrie <afnazrie@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-06-18 19:59:53 +02:00
Doug Kearns
0d4d23dac0
patch 9.1.0492: filetype: Vim-script files not detected by shebang line
Problem:  Vim-script files may not be recognised
Solution: Add shebang line detection (Doug Kearns)

closes: 

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-06-16 08:32:15 +02:00
Christian Brabandt
52f2ff0363
runtime(zip): revert unintended change to zip#Write()
This was wrongly included as of patch 1c67342912
because apparently I messed up the use of git apply :/

Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-06-15 16:05:35 +02:00
Christian Brabandt
1c67342912
runtime(zip): MS-Windows: handle files with spaces properly
This change does the following 3 things:

1) non need to quote the file to be extracted

The zipfile plugin used to quote and fnameescape() the path to the
file to be extracted. However testing with unzip showed, that while this
works on Linux on Windows you shall not escape the blanks in filenames.

As long as the pathname is properly quoted, this words on Linux and
Windows.

2) reset shellslash (MS-Windows only)

When shellslash is set, filenames to the zip archive will be forward
quoted. However since the filename is eventually handed over to the
unzip command, we need to make sure to use native paths so that the
command will understand what file to open. Therefore, if shellslash is
set (and the shell is cmd.exe), replace any forward slashes by the
expected backslashes

3) style:
Use tabs for the Header, remove a few comments in the s:Escape() and
zip#read() functions

fixes: 

Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-06-15 14:51:07 +02:00