diff options
-rw-r--r-- | Filelist | 2 | ||||
-rw-r--r-- | runtime/autoload/context.vim | 267 | ||||
-rw-r--r-- | runtime/autoload/typeset.vim | 233 | ||||
-rw-r--r-- | runtime/compiler/context.vim | 80 | ||||
-rw-r--r-- | runtime/doc/eval.txt | 1 | ||||
-rw-r--r-- | runtime/doc/motion.txt | 3 | ||||
-rw-r--r-- | runtime/doc/options.txt | 9 | ||||
-rw-r--r-- | runtime/doc/tags | 2 | ||||
-rw-r--r-- | runtime/doc/textprop.txt | 13 | ||||
-rw-r--r-- | runtime/doc/todo.txt | 33 | ||||
-rw-r--r-- | runtime/doc/vim9.txt | 6 | ||||
-rw-r--r-- | runtime/ftplugin/context.vim | 192 | ||||
-rw-r--r-- | runtime/ftplugin/elixir.vim | 20 | ||||
-rw-r--r-- | runtime/ftplugin/mf.vim | 124 | ||||
-rw-r--r-- | runtime/ftplugin/mp.vim | 147 | ||||
-rw-r--r-- | runtime/syntax/README.txt | 3 | ||||
-rw-r--r-- | runtime/syntax/context.vim | 187 | ||||
-rw-r--r-- | runtime/syntax/mf.vim | 99 | ||||
-rw-r--r-- | runtime/syntax/mp.vim | 684 | ||||
-rw-r--r-- | runtime/syntax/shared/README.txt | 2 | ||||
-rw-r--r-- | runtime/syntax/shared/typescriptcommon.vim | 2099 | ||||
-rw-r--r-- | runtime/syntax/swayconfig.vim | 8 | ||||
-rw-r--r-- | runtime/syntax/typescript.vim | 2 | ||||
-rw-r--r-- | runtime/syntax/typescriptreact.vim | 2 |
24 files changed, 3015 insertions, 1203 deletions
@@ -814,6 +814,8 @@ RT_SCRIPTS = \ runtime/plugin/README.txt \ runtime/syntax/*.vim \ runtime/syntax/README.txt \ + runtime/syntax/shared/*.vim \ + runtime/syntax/shared/README.txt \ # Unix runtime RT_UNIX = \ diff --git a/runtime/autoload/context.vim b/runtime/autoload/context.vim index 254d710c01..e42b99e2e9 100644 --- a/runtime/autoload/context.vim +++ b/runtime/autoload/context.vim @@ -1,184 +1,95 @@ -" Language: ConTeXt typesetting engine -" Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com> -" Latest Revision: 2016 Oct 21 - -let s:keepcpo= &cpo -set cpo&vim - -" Helper functions {{{ -function! s:context_echo(message, mode) - redraw - echo "\r" - execute 'echohl' a:mode - echomsg '[ConTeXt]' a:message - echohl None -endf - -function! s:sh() - return has('win32') || has('win64') || has('win16') || has('win95') - \ ? ['cmd.exe', '/C'] - \ : ['/bin/sh', '-c'] -endfunction - -" For backward compatibility -if exists('*win_getid') - - function! s:win_getid() - return win_getid() - endf - - function! s:win_id2win(winid) - return win_id2win(a:winid) - endf - -else - - function! s:win_getid() - return winnr() - endf - - function! s:win_id2win(winnr) - return a:winnr - endf - -endif -" }}} - -" ConTeXt jobs {{{ -if has('job') - - let g:context_jobs = [] - - " Print the status of ConTeXt jobs - function! context#job_status() - let l:jobs = filter(g:context_jobs, 'job_status(v:val) == "run"') - let l:n = len(l:jobs) - call s:context_echo( - \ 'There '.(l:n == 1 ? 'is' : 'are').' '.(l:n == 0 ? 'no' : l:n) - \ .' job'.(l:n == 1 ? '' : 's').' running' - \ .(l:n == 0 ? '.' : ' (' . join(l:jobs, ', ').').'), - \ 'ModeMsg') - endfunction - - " Stop all ConTeXt jobs - function! context#stop_jobs() - let l:jobs = filter(g:context_jobs, 'job_status(v:val) == "run"') - for job in l:jobs - call job_stop(job) - endfor - sleep 1 - let l:tmp = [] - for job in l:jobs - if job_status(job) == "run" - call add(l:tmp, job) - endif - endfor - let g:context_jobs = l:tmp - if empty(g:context_jobs) - call s:context_echo('Done. No jobs running.', 'ModeMsg') +vim9script + +# Language: ConTeXt typesetting engine +# Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com> +# Former Maintainers: Nikolai Weibull <now@bitwi.se> +# Latest Revision: 2022 Aug 12 + +# Typesetting {{{ +import autoload './typeset.vim' + +export def ConTeXtCmd(path: string): list<string> + return ['mtxrun', '--script', 'context', '--nonstopmode', '--autogenerate', path] +enddef + +export def Typeset(bufname: string, env = {}, Cmd = ConTeXtCmd): bool + return typeset.TypesetBuffer(bufname, Cmd, env, 'ConTeXt') +enddef + +export def JobStatus() + typeset.JobStatus('ConTeXt') +enddef + +export def StopJobs() + typeset.StopJobs('ConTeXt') +enddef + +export def Log(bufname: string) + execute 'edit' typeset.LogPath(bufname) +enddef +# }}} + +# Completion {{{ +def BinarySearch(base: string, keywords: list<string>): list<string> + const pat = '^' .. base + const len = len(keywords) + var res = [] + var lft = 0 + var rgt = len + + # Find the leftmost index matching base + while lft < rgt + var i = (lft + rgt) / 2 + if keywords[i] < base + lft = i + 1 else - call s:context_echo('There are still some jobs running. Please try again.', 'WarningMsg') + rgt = i endif - endfunction + endwhile - function! context#callback(path, job, status) - if index(g:context_jobs, a:job) != -1 && job_status(a:job) != 'run' " just in case - call remove(g:context_jobs, index(g:context_jobs, a:job)) + while lft < len && keywords[lft] =~ pat + add(res, keywords[lft]) + lft += 1 + endwhile + + return res +enddef + +var isMetaPostBlock = false + +var MP_KEYWORDS: list<string> = [] +var CTX_KEYWORDS: list<string> = [] + +# Complete only MetaPost keywords in MetaPost blocks, and complete only +# ConTeXt keywords otherwise. +export def Complete(findstart: number, base: string): any + if findstart == 1 + if len(synstack(line("."), 1)) > 0 && synIDattr(synstack(line("."), 1)[0], "name") ==# 'contextMPGraphic' + isMetaPostBlock = true + return match(getline('.'), '\S\+\%' .. col('.') .. 'c') + endif + + # Complete only \commands starting with a backslash + isMetaPostBlock = false + var pos = match(getline('.'), '\\\zs\S\+\%' .. col('.') .. 'c') + return (pos == -1) ? -3 : pos + endif + + if isMetaPostBlock + if empty(MP_KEYWORDS) + MP_KEYWORDS = sort(syntaxcomplete#OmniSyntaxList(['mf\w\+', 'mp\w\+'])) endif - call s:callback(a:path, a:job, a:status) - endfunction - - function! context#close_cb(channel) - call job_status(ch_getjob(a:channel)) " Trigger exit_cb's callback for faster feedback - endfunction - - function! s:typeset(path) - call add(g:context_jobs, - \ job_start(add(s:sh(), context#command() . ' ' . shellescape(fnamemodify(a:path, ":t"))), { - \ 'close_cb' : 'context#close_cb', - \ 'exit_cb' : function(get(b:, 'context_callback', get(g:, 'context_callback', 'context#callback')), - \ [a:path]), - \ 'in_io' : 'null' - \ })) - endfunction - -else " No jobs - - function! context#job_status() - call s:context_echo('Not implemented', 'WarningMsg') - endfunction! - - function! context#stop_jobs() - call s:context_echo('Not implemented', 'WarningMsg') - endfunction - - function! context#callback(path, job, status) - call s:callback(a:path, a:job, a:status) - endfunction - - function! s:typeset(path) - execute '!' . context#command() . ' ' . shellescape(fnamemodify(a:path, ":t")) - call call(get(b:, 'context_callback', get(g:, 'context_callback', 'context#callback')), - \ [a:path, 0, v:shell_error]) - endfunction - -endif " has('job') - -function! s:callback(path, job, status) abort - if a:status < 0 " Assume the job was terminated - return + return BinarySearch(base, MP_KEYWORDS) endif - " Get info about the current window - let l:winid = s:win_getid() " Save window id - let l:efm = &l:errorformat " Save local errorformat - let l:cwd = fnamemodify(getcwd(), ":p") " Save local working directory - " Set errorformat to parse ConTeXt errors - execute 'setl efm=' . escape(b:context_errorformat, ' ') - try " Set cwd to expand error file correctly - execute 'lcd' fnameescape(fnamemodify(a:path, ':h')) - catch /.*/ - execute 'setl efm=' . escape(l:efm, ' ') - throw v:exception - endtry - try - execute 'cgetfile' fnameescape(fnamemodify(a:path, ':r') . '.log') - botright cwindow - finally " Restore cwd and errorformat - execute s:win_id2win(l:winid) . 'wincmd w' - execute 'lcd ' . fnameescape(l:cwd) - execute 'setl efm=' . escape(l:efm, ' ') - endtry - if a:status == 0 - call s:context_echo('Success!', 'ModeMsg') - else - call s:context_echo('There are errors. ', 'ErrorMsg') + + if empty(CTX_KEYWORDS) + CTX_KEYWORDS = sort(syntaxcomplete#OmniSyntaxList([ + 'context\w\+', 'texAleph', 'texEtex', 'texLuatex', 'texOmega', + 'texPdftex', 'texTex', 'texXeTeX' + ])) endif -endfunction - -function! context#command() - return get(b:, 'context_mtxrun', get(g:, 'context_mtxrun', 'mtxrun')) - \ . ' --script context --autogenerate --nonstopmode' - \ . ' --synctex=' . (get(b:, 'context_synctex', get(g:, 'context_synctex', 0)) ? '1' : '0') - \ . ' ' . get(b:, 'context_extra_options', get(g:, 'context_extra_options', '')) -endfunction - -" Accepts an optional path (useful for big projects, when the file you are -" editing is not the project's root document). If no argument is given, uses -" the path of the current buffer. -function! context#typeset(...) abort - let l:path = fnamemodify(strlen(a:000[0]) > 0 ? a:1 : expand("%"), ":p") - let l:cwd = fnamemodify(getcwd(), ":p") " Save local working directory - call s:context_echo('Typesetting...', 'ModeMsg') - execute 'lcd' fnameescape(fnamemodify(l:path, ":h")) - try - call s:typeset(l:path) - finally " Restore local working directory - execute 'lcd ' . fnameescape(l:cwd) - endtry -endfunction! -"}}} - -let &cpo = s:keepcpo -unlet s:keepcpo - -" vim: sw=2 fdm=marker + return BinarySearch(base, CTX_KEYWORDS) +enddef +# }}} + +# vim: sw=2 fdm=marker diff --git a/runtime/autoload/typeset.vim b/runtime/autoload/typeset.vim new file mode 100644 index 0000000000..35cf17ba87 --- /dev/null +++ b/runtime/autoload/typeset.vim @@ -0,0 +1,233 @@ +vim9script + +# Language: Generic TeX typesetting engine +# Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com> +# Latest Revision: 2022 Aug 12 + +# Constants and helpers {{{ +const SLASH = !exists("+shellslash") || &shellslash ? '/' : '\' + +def Echo(msg: string, mode: string, label: string) + redraw + echo "\r" + execute 'echohl' mode + echomsg printf('[%s] %s', label, msg) + echohl None +enddef + +def EchoMsg(msg: string, label = 'Notice') + Echo(msg, 'ModeMsg', label) +enddef + +def EchoWarn(msg: string, label = 'Warning') + Echo(msg, 'WarningMsg', label) +enddef + +def EchoErr(msg: string, label = 'Error') + Echo(msg, 'ErrorMsg', label) +enddef +# }}} + +# Track jobs {{{ +var running_jobs = {} # Dictionary of job IDs of jobs currently executing + +def AddJob(label: string, j: job) + if !has_key(running_jobs, label) + running_jobs[label] = [] + endif + + add(running_jobs[label], j) +enddef + +def RemoveJob(label: string, j: job) + if has_key(running_jobs, label) && index(running_jobs[label], j) != -1 + remove(running_jobs[label], index(running_jobs[label], j)) + endif +enddef + +def GetRunningJobs(label: string): list<job> + return has_key(running_jobs, label) ? running_jobs[label] : [] +enddef +# }}} + +# Callbacks {{{ +def ProcessOutput(qfid: number, wd: string, efm: string, ch: channel, msg: string) + # Make sure the quickfix list still exists + if getqflist({'id': qfid}).id != qfid + EchoErr("Quickfix list not found, stopping the job") + call job_stop(ch_getjob(ch)) + return + endif + + # Make sure the working directory is correct + silent execute "lcd" wd + setqflist([], 'a', {'id': qfid, 'lines': [msg], 'efm': efm}) + silent lcd - +enddef + +def CloseCb(ch: channel) + job_status(ch_getjob(ch)) # Trigger exit_cb's callback +enddef + +def ExitCb(label: string, jobid: job, exitStatus: number) + RemoveJob(label, jobid) + + if exitStatus == 0 + botright cwindow + EchoMsg('Success!', label) + elseif exitStatus < 0 + EchoWarn('Job terminated', label) + else + botright copen + wincmd p + EchoWarn('There are errors.', label) + endif +enddef +# }}} + +# Create a new empty quickfix list at the end of the stack and return its id {{{ +def NewQuickfixList(path: string): number + if setqflist([], ' ', {'nr': '$', 'title': path}) == -1 + return -1 + endif + + return getqflist({'nr': '$', 'id': 0}).id +enddef +# }}} + +# Public interface {{{ +# When a TeX document is split into several source files, each source file +# may contain a "magic line" specifiying the "root" file, e.g.: +# +# % !TEX root = main.tex +# +# Using this line, Vim can know which file to typeset even if the current +# buffer is different from main.tex. +# +# This function searches for the magic line in the first ten lines of the +# given buffer, and returns the full path of the root document. +# +# NOTE: the value of "% !TEX root" *must* be a relative path. +export def FindRootDocument(bufname: string = bufname("%")): string + const bufnr = bufnr(bufname) + + if !bufexists(bufnr) + return bufname + endif + + var rootpath = fnamemodify(bufname(bufnr), ':p') + + # Search for magic line `% !TEX root = ...` in the first ten lines + const header = getbufline(bufnr, 1, 10) + const idx = match(header, '^\s*%\s\+!TEX\s\+root\s*=\s*\S') + if idx > -1 + const main = matchstr(header[idx], '!TEX\s\+root\s*=\s*\zs.*$') + rootpath = simplify(fnamemodify(rootpath, ":h") .. SLASH .. main) + endif + + return rootpath +enddef + +export def LogPath(bufname: string): string + const logfile = FindRootDocument(bufname) + return fnamemodify(logfile, ":r") .. ".log" +enddef + +# Typeset the specified path +# +# Parameters: +# label: a descriptive string used in messages to identify the kind of job +# Cmd: a function that takes the path of a document and returns the typesetting command +# path: the path of the document to be typeset. To avoid ambiguities, pass a *full* path. +# efm: the error format string to parse the output of the command. +# env: environment variables for the process (passed to job_start()) +# +# Returns: +# true if the job is started successfully; +# false otherwise. +export def Typeset( + label: string, + Cmd: func(string): list<string>, + path: string, + efm: string, + env: dict<string> = {} +): bool + var fp = fnamemodify(path, ":p") + var wd = fnamemodify(fp, ":h") + var qfid = NewQuickfixList(fp) + + if qfid == -1 + EchoErr('Could not create quickfix list', label) + return false + endif + + if !filereadable(fp) + EchoErr(printf('File not readable: %s', fp), label) + return false + endif + + var jobid = job_start(Cmd(path), { + env: env, + cwd: wd, + in_io: "null", + callback: (c, m) => ProcessOutput(qfid, wd, efm, c, m), + close_cb: CloseCb, + exit_cb: (j, e) => ExitCb(label, j, e), + }) + + if job_status(jobid) ==# "fail" + EchoErr("Failed to start job", label) + return false + endif + + AddJob(label, jobid) + + EchoMsg('Typesetting...', label) + + return true +enddef + +export def JobStatus(label: string) + EchoMsg('Jobs still running: ' .. string(len(GetRunningJobs(label))), label) +enddef + +export def StopJobs(label: string) + for job in GetRunningJobs(label) + job_stop(job) + endfor + + EchoMsg('Done.', label) +enddef + +# Typeset the specified buffer +# +# Parameters: +# name: a buffer's name. this may be empty to indicate the current buffer. +# cmd: a function that takes the path of a document and returns the typesetting command +# label: a descriptive string used in messages to identify the kind of job +# env: environment variables for the process (passed to job_start()) +# +# Returns: +# true if the job is started successfully; +# false otherwise. +export def TypesetBuffer( + name: string, + Cmd: func(string): list<string>, + env = {}, + label = 'Typeset' +): bool + const bufname = bufname(name) + + if empty(bufname) + EchoErr('Please save the buffer first.', label) + return false + endif + + const efm = getbufvar(bufnr(bufname), "&efm") + const rootpath = FindRootDocument(bufname) + + return Typeset('ConTeXt', Cmd, rootpath, efm, env) +enddef +# }}} + +# vim: sw=2 fdm=marker diff --git a/runtime/compiler/context.vim b/runtime/compiler/context.vim index cb78c96df0..4cabf145c5 100644 --- a/runtime/compiler/context.vim +++ b/runtime/compiler/context.vim @@ -1,54 +1,48 @@ -" Vim compiler file -" Compiler: ConTeXt typesetting engine -" Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com> -" Last Change: 2016 Oct 21 +vim9script -if exists("current_compiler") +# Language: ConTeXt typesetting engine +# Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com> +# Former Maintainers: Nikolai Weibull <now@bitwi.se> +# Latest Revision: 2022 Aug 12 + +if exists("g:current_compiler") finish endif -let s:keepcpo= &cpo -set cpo&vim -if exists(":CompilerSet") != 2 " older Vim always used :setlocal +import autoload '../autoload/context.vim' + +if exists(":CompilerSet") != 2 # Older Vim always used :setlocal command -nargs=* CompilerSet setlocal <args> endif -" If makefile exists and we are not asked to ignore it, we use standard make -" (do not redefine makeprg) +g:current_compiler = 'context' + if get(b:, 'context_ignore_makefile', get(g:, 'context_ignore_makefile', 0)) || - \ (!filereadable('Makefile') && !filereadable('makefile')) - let current_compiler = 'context' - " The following assumes that the current working directory is set to the - " directory of the file to be typeset - let &l:makeprg = get(b:, 'context_mtxrun', get(g:, 'context_mtxrun', 'mtxrun')) - \ . ' --script context --autogenerate --nonstopmode --synctex=' - \ . (get(b:, 'context_synctex', get(g:, 'context_synctex', 0)) ? '1' : '0') - \ . ' ' . get(b:, 'context_extra_options', get(g:, 'context_extra_options', '')) - \ . ' ' . shellescape(expand('%:p:t')) + (!filereadable('Makefile') && !filereadable('makefile')) + &l:makeprg = join(context.ConTeXtCmd(shellescape(expand('%:p:t'))), ' ') else - let current_compiler = 'make' + g:current_compiler = 'make' endif -let b:context_errorformat = '' - \ . '%-Popen source%.%#> %f,' - \ . '%-Qclose source%.%#> %f,' - \ . "%-Popen source%.%#name '%f'," - \ . "%-Qclose source%.%#name '%f'," - \ . '%Etex %trror%.%#mp error on line %l in file %f:%.%#,' - \ . 'tex %trror%.%#error on line %l in file %f: %m,' - \ . '%Elua %trror%.%#error on line %l in file %f:,' - \ . '%+Emetapost %#> error: %#,' - \ . '! error: %#%m,' - \ . '%-C %#,' - \ . '%C! %m,' - \ . '%Z[ctxlua]%m,' - \ . '%+C<*> %.%#,' - \ . '%-C%.%#,' - \ . '%Z...%m,' - \ . '%-Zno-error,' - \ . '%-G%.%#' " Skip remaining lines - -execute 'CompilerSet errorformat=' . escape(b:context_errorformat, ' ') - -let &cpo = s:keepcpo -unlet s:keepcpo +const context_errorformat = join([ + "%-Popen source%.%#> %f", + "%-Qclose source%.%#> %f", + "%-Popen source%.%#name '%f'", + "%-Qclose source%.%#name '%f'", + "tex %trror%.%#error on line %l in file %f: %m", + "%Elua %trror%.%#error on line %l in file %f:", + "%+Emetapost %#> error: %#", + "%Emetafun%.%#error: %m", + "! error: %#%m", + "%-C %#", + "%C! %m", + "%Z[ctxlua]%m", + "%+C<*> %.%#", + "%-C%.%#", + "%Z...%m", + "%-Zno-error", + "%-G%.%#"], ",") + +execute 'CompilerSet errorformat=' .. escape(context_errorformat, ' ') + +# vim: sw=2 fdm=marker diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 6eab0833f7..5947703fb2 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1098,6 +1098,7 @@ a different type means the values are different: > echo 0 is [] 0 "is#"/"isnot#" and "is?"/"isnot?" can be used to match and ignore case. +In |Vim9| script this doesn't work, two strings are never identical. In legacy script, when comparing a String with a Number, the String is converted to a Number, and the comparison is done on Numbers. This means diff --git a/runtime/doc/motion.txt b/runtime/doc/motion.txt index 4cd1a32b4c..9d6142ba5c 100644 --- a/runtime/doc/motion.txt +++ b/runtime/doc/motion.txt @@ -612,7 +612,8 @@ i) *v_i)* *i)* *i(* i( *vib* *v_ib* *v_i(* *ib* ib "inner block", select [count] blocks, from "[count] [(" to the matching ')', excluding the '(' and ')' (see - |[(|). + |[(|). If the cursor is not inside a () block, then + find the next "(". When used in Visual mode it is made characterwise. a> *v_a>* *v_a<* *a>* *a<* diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index ee17e64454..0b35e94052 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -814,7 +814,7 @@ A jump table for the options with a short description can be found at |Q_op|. if [[ -n "$VIM_TERMINAL" ]]; then PROMPT_COMMAND='_vim_sync_PWD' function _vim_sync_PWD() { - printf "\033]7;file://%s\033\\" "$PWD" + printf '\033]7;file://%s\033\\' "$PWD" } fi < @@ -823,14 +823,14 @@ A jump table for the options with a short description can be found at |Q_op|. autoload -Uz add-zsh-hook add-zsh-hook -Uz chpwd _vim_sync_PWD function _vim_sync_PWD() { - printf "\033]7;file://%s\033\\" "$PWD" + printf '\033]7;file://%s\033\\' "$PWD" } fi < In a fish init file: > if test -n "$VIM_TERMINAL" function _vim_sync_PWD --on-variable=PWD - printf "\033]7;file://%s\033\\" "$PWD" + printf '\033]7;file://%s\033\\' "$PWD" end end < @@ -1793,7 +1793,8 @@ A jump table for the options with a short description can be found at |Q_op|. When 'cmdheight' is zero, there is no command-line unless it is being used. Some informative messages will not be displayed, any other - messages will cause the |hit-enter| prompt. + messages will cause the |hit-enter| prompt. Expect some other + unexpected behavior too. *'cmdwinheight'* *'cwh'* 'cmdwinheight' 'cwh' number (default 7) diff --git a/runtime/doc/tags b/runtime/doc/tags index 7e3fe4313f..58650d4771 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -4300,6 +4300,7 @@ E1290 change.txt /*E1290* E1291 testing.txt /*E1291* E1292 cmdline.txt /*E1292* E1293 textprop.txt /*E1293* +E1294 textprop.txt /*E1294* E13 message.txt /*E13* E131 eval.txt /*E131* E132 eval.txt /*E132* @@ -7933,6 +7934,7 @@ indentkeys-format indent.txt /*indentkeys-format* index index.txt /*index* index() builtin.txt /*index()* index.txt index.txt /*index.txt* +indexof() builtin.txt /*indexof()* info-message starting.txt /*info-message* inform.vim syntax.txt /*inform.vim* informix ft_sql.txt /*informix* diff --git a/runtime/doc/textprop.txt b/runtime/doc/textprop.txt index fd9133327f..9a148455e0 100644 --- a/runtime/doc/textprop.txt +++ b/runtime/doc/textprop.txt @@ -143,12 +143,16 @@ prop_add({lnum}, {col}, {props}) zero is used text text to be displayed before {col}, or after the line if {col} is zero + *E1294* text_align when "text" is present and {col} is zero specifies where to display the text: after after the end of the line - right right aligned in the window + right right aligned in the window (unless + the text wraps to the next screen + line) below in the next screen line - When omitted "after" is used. + When omitted "after" is used. Only one + "right" property can fit in earch line. text_wrap when "text" is present and {col} is zero, specifies what happens if the text doesn't fit: @@ -186,9 +190,10 @@ prop_add({lnum}, {col}, {props}) buffer line, the cursor cannot be placed on it. A mouse click in the text will move the cursor to the first character after the text, or the last character of the line. + Any Tab and other control character in the text will be + changed to a space (Rationale: otherwise the size of the text + is difficult to compute). A negative "id" will be chosen and is returned. Once a - Any Tab in the text will be changed to a space (Rationale: - otherwise the size of the text is difficult to compute). property with "text" has been added for a buffer then using a negative "id" for any other property will give an error: *E1293* diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index 059e44b89a..66640aa532 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -38,6 +38,11 @@ browser use: https://github.com/vim/vim/issues/1234 *known-bugs* -------------------- Known bugs and current work ----------------------- +Text props: Add "padding" argument - only for when using "text" and {col} is +zero. Use tp_len field and n_attr_skip. #10906 + +Graduate FEAT_TEXTOBJ ? + Further Vim9 improvements, possibly after launch: - Use Vim9 for more runtime files. - Check performance with callgrind and kcachegrind. @@ -67,18 +72,6 @@ Further Vim9 improvements, possibly after launch: has(featureName), len(someString) - Implement as part of an expression: ++expr, --expr, expr++, expr--. -Update list of features to vote on: -- Remove Athena item (won't happen) -- Remove "add open mode" (won't happen) -- Remove "editing of a hidden buffer" (done) -- Change "add IDE features" to "improve terminal debugger" -- Change "diff/merge capability for CVS" to "CVS and git" -- Remove "pre-compile them" from "improve the performance of Vim scripts" -- Add: multiple cursors, edit text in more than one place at a time -- Add: fast syntax highlighting with parser instead of regex patterns -- Add: virtual text, text properties can insert text in the line -- Add: start first line halfway, scroll per wrapped screen line - Popup windows: - Preview popup not properly updated when it overlaps with completion menu. (Yegappan Lakshmanan, 2021 May 22) @@ -192,6 +185,7 @@ Patches considered for including: - use int instead of char_ for index #10818 needs a test - Add "-n" option to xxd. #10599 needs a test - allow for nesting of timeout, sketch in #10595 +- Add setcmdline() #10869 Add 'splitscroll' #10682 Useful? Any trouble? Null Chilly says it's OK. suggestion: names instead of numbers for the option value @@ -3958,15 +3952,16 @@ Vim script language: can be the plugin name. Perhaps also have a way to remove everything that the package added? including autocommands. -7 Pre-parse or compile Vim scripts into a bytecode. +7 Pre-parse or compile Vim scripts into a bytecode, like :def functions. + Possibilities: 1. Put the bytecode with the original script, with an ":if - has('bytecode')" around it, so that it's only used with a Vim that - supports it. Update the code with a command, can be used in an - autocommand. + has('bytecode-1234')" around it, so that it's only used with a Vim that + supports the version. Update the code with a command, can be used in + an autocommand. 2. Use a ".vic" file (like Python use .pyc). Create it when writing a - .vim file. Problem: distribution. - 3. Use a cache directory for each user. How to recognize which cached - file belongs to a sourced script? + .vim file. Problem: distribution, non-writable directory, etc. + 3. Use a cache directory for each user. Disadvantage: cache lookup may + cost more time than bytecode wins. 7 Add argument to winwidth() to subtract the space taken by 'foldcolumn', signs and/or 'number'. 6 Add ++ and -- operators? They only work on variables (lvals), how to diff --git a/runtime/doc/vim9.txt b/runtime/doc/vim9.txt index 01412a0391..089cb8f8e5 100644 --- a/runtime/doc/vim9.txt +++ b/runtime/doc/vim9.txt @@ -913,6 +913,12 @@ Comparators ~ The 'ignorecase' option is not used for comparators that use strings. Thus "=~" works like "=~#". +"is" and "isnot" (|expr-is| and |expr-isnot|) when used on strings now return +false. In legacy script they just compare the strings, in |Vim9| script they +check identity, and strings are copied when used, thus two strings are never +the same (this might change some day if strings are not copied but reference +counted). + Abort after error ~ diff --git a/runtime/ftplugin/context.vim b/runtime/ftplugin/context.vim index 37f7240d7b..75d26cf649 100644 --- a/runtime/ftplugin/context.vim +++ b/runtime/ftplugin/context.vim @@ -1,117 +1,115 @@ -" Vim filetype plugin file -" Language: ConTeXt typesetting engine -" Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com> -" Former Maintainers: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2021 Oct 15 +vim9script + +# Vim filetype plugin file +# Language: ConTeXt typesetting engine +# Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com> +# Former Maintainers: Nikolai Weibull <now@bitwi.se> +# Latest Revision: 2022 Aug 12 if exists("b:did_ftplugin") finish endif -let b:did_ftplugin = 1 -let s:cpo_save = &cpo -set cpo&vim +import autoload '../autoload/context.vim' + +b:did_ftplugin = 1 if !exists('current_compiler') compiler context endif -let b:undo_ftplugin = "setl com< cms< def< inc< sua< fo< ofu<" - -setlocal comments=b:%D,b:%C,b:%M,:% commentstring=%\ %s formatoptions+=tjcroql2 -if get(b:, 'context_metapost', get(g:, 'context_metapost', 1)) - setlocal omnifunc=contextcomplete#Complete - let g:omni_syntax_group_include_context = 'mf\w\+,mp\w\+' - let g:omni_syntax_group_exclude_context = 'mfTodoComment' -endif +b:undo_ftplugin = "setl com< cms< def< inc< sua< fo< ofu<" -let &l:define='\\\%([egx]\|char\|mathchar\|count\|dimen\|muskip\|skip\|toks\)\=' - \ . 'def\|\\font\|\\\%(future\)\=let' - \ . '\|\\new\%(count\|dimen\|skip\|muskip\|box\|toks\|read\|write' - \ . '\|fam\|insert\|if\)' +setlocal comments=b:%D,b:%C,b:%M,:% +setlocal commentstring=%\ %s +setlocal formatoptions+=tjcroql2 +setlocal omnifunc=context.Complete +setlocal suffixesadd=.tex,.mkxl,.mkvi,.mkiv,.mkii -let &l:include = '^\s*\\\%(input\|component\|product\|project\|environment\)' +&l:define = '\\\%([egx]\|char\|mathchar\|count\|dimen\|muskip\|skip\|toks\)\=' +.. 'def\|\\font\|\\\%(future\)\=let' +.. '\|\\new\%(count\|dimen\|skip\|muskip\|box\|toks\|read\|write' +.. '\|fam\|insert\|if\)' |