mirror of
https://github.com/neovim/neovim.git
synced 2026-07-31 12:49:11 +00:00
refactor(zip)!: builtin zip.lua plugin #40846
Problem: The bundled `zip` plugin is implemented in Vimscript, making it harder to maintain and build on with Nvim's Lua runtime infrastructure. Solution: Add an opt-out `zip.lua` browser backed by `nvim.dir`, and disable the legacy Vimscript implementation by moving it to `pack/dist/opt/zip/`. Load it with `:packadd zip`.
This commit is contained in:
@@ -68,7 +68,7 @@ unlet! s:zip_func_upgradable
|
||||
if exists("g:ftplugin_java_source_path") &&
|
||||
\ type(g:ftplugin_java_source_path) == type("")
|
||||
if filereadable(g:ftplugin_java_source_path)
|
||||
if exists("#zip") &&
|
||||
if (exists("#zip") || exists("#nvim.zip")) &&
|
||||
\ g:ftplugin_java_source_path =~# '.\.\%(jar\|zip\)$'
|
||||
if !exists("s:zip_files")
|
||||
let s:zip_files = {}
|
||||
@@ -79,8 +79,9 @@ if exists("g:ftplugin_java_source_path") &&
|
||||
let s:zip_func_upgradable = 1
|
||||
|
||||
function! JavaFileTypeZipFile() abort
|
||||
let @/ = substitute(v:fname, '\.', '\\/', 'g') . '.java'
|
||||
return get(s:zip_files, bufnr('%'), s:zip_files[0])
|
||||
let l:member = substitute(v:fname, '\.', '/', 'g') . '.java'
|
||||
return 'zipfile://' . get(s:zip_files, bufnr('%'), s:zip_files[0]) .
|
||||
\ '::' . l:member
|
||||
endfunction
|
||||
|
||||
" E120 for "inex=s:JavaFileTypeZipFile()" before v8.2.3900.
|
||||
@@ -389,8 +390,8 @@ if exists("s:zip_func_upgradable")
|
||||
delfunction! JavaFileTypeZipFile
|
||||
|
||||
def! s:JavaFileTypeZipFile(): string
|
||||
@/ = substitute(v:fname, '\.', '\\/', 'g') .. '.java'
|
||||
return get(zip_files, bufnr('%'), zip_files[0])
|
||||
const member: string = substitute(v:fname, '\.', '/', 'g') .. '.java'
|
||||
return 'zipfile://' .. get(zip_files, bufnr('%'), zip_files[0]) .. '::' .. member
|
||||
enddef
|
||||
|
||||
setlocal includeexpr=s:JavaFileTypeZipFile()
|
||||
|
||||
Reference in New Issue
Block a user