mirror of
https://github.com/zoriya/vim.git
synced 2026-01-04 13:28:14 +00:00
Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
df36514a64 | ||
|
|
97a6c6a1fb | ||
|
|
5f8ed7408a | ||
|
|
551c1aed65 | ||
|
|
2bf6034e5c | ||
|
|
1bb0da25a6 | ||
|
|
4c295027a4 | ||
|
|
5f628a12e5 | ||
|
|
4a22897591 | ||
|
|
3d0e7a956a | ||
|
|
b6c2e9a010 | ||
|
|
4934ed34c3 | ||
|
|
aeed2a6359 | ||
|
|
227c58a486 | ||
|
|
03717bf6a2 | ||
|
|
b80d2fb0e7 | ||
|
|
b06b50dfa0 | ||
|
|
bb01a1ef3a |
4
.github/CODEOWNERS
vendored
4
.github/CODEOWNERS
vendored
@@ -78,6 +78,7 @@ runtime/ftplugin/css.vim @dkearns
|
||||
runtime/ftplugin/cucumber.vim @tpope
|
||||
runtime/ftplugin/eiffel.vim @dkearns
|
||||
runtime/ftplugin/eruby.vim @tpope @dkearns
|
||||
runtime/ftplugin/fpcmake.vim @dkearns
|
||||
runtime/ftplugin/freebasic.vim @dkearns
|
||||
runtime/ftplugin/git.vim @tpope
|
||||
runtime/ftplugin/gitcommit.vim @tpope
|
||||
@@ -98,6 +99,7 @@ runtime/ftplugin/matlab.vim @cecamp
|
||||
runtime/ftplugin/modula3.vim @dkearns
|
||||
runtime/ftplugin/nroff.vim @a-vrma
|
||||
runtime/ftplugin/nsis.vim @k-takata
|
||||
runtime/ftplugin/pascal.vim @dkearns
|
||||
runtime/ftplugin/pdf.vim @tpope
|
||||
runtime/ftplugin/ps1.vim @heaths
|
||||
runtime/ftplugin/ps1xml.vim @heaths
|
||||
@@ -157,6 +159,7 @@ runtime/syntax/dtd.vim @chrisbra
|
||||
runtime/syntax/elmfilt.vim @cecamp
|
||||
runtime/syntax/eruby.vim @tpope @dkearns
|
||||
runtime/syntax/exports.vim @cecamp
|
||||
runtime/syntax/fpcmake.vim @dkearns
|
||||
runtime/syntax/git.vim @tpope
|
||||
runtime/syntax/gitcommit.vim @tpope
|
||||
runtime/syntax/gitconfig.vim @tpope
|
||||
@@ -181,6 +184,7 @@ runtime/syntax/modula3.vim @dkearns
|
||||
runtime/syntax/netrw.vim @cecamp
|
||||
runtime/syntax/nroff.vim @jmarshall
|
||||
runtime/syntax/nsis.vim @k-takata
|
||||
runtime/syntax/pascal.vim @dkearns
|
||||
runtime/syntax/pdf.vim @tpope
|
||||
runtime/syntax/php.vim @TysonAndre
|
||||
runtime/syntax/privoxy.vim @dkearns
|
||||
|
||||
4
Filelist
4
Filelist
@@ -437,7 +437,6 @@ SRC_UNIX = \
|
||||
src/gui_gtk_x11.c \
|
||||
src/gui_gtk_res.xml \
|
||||
src/gui_motif.c \
|
||||
src/gui_xim.c \
|
||||
src/gui_xmdlg.c \
|
||||
src/gui_xmebw.c \
|
||||
src/gui_xmebw.h \
|
||||
@@ -461,7 +460,6 @@ SRC_UNIX = \
|
||||
src/proto/gui_gtk_x11.pro \
|
||||
src/proto/gui_gtk_gresources.pro \
|
||||
src/proto/gui_motif.pro \
|
||||
src/proto/gui_xim.pro \
|
||||
src/proto/gui_xmdlg.pro \
|
||||
src/proto/gui_x11.pro \
|
||||
src/proto/if_xcmdsrv.pro \
|
||||
@@ -481,6 +479,7 @@ SRC_UNIX = \
|
||||
|
||||
# source files for both DOS and Unix
|
||||
SRC_DOS_UNIX = \
|
||||
src/gui_xim.c \
|
||||
src/if_cscope.c \
|
||||
src/if_cscope.h \
|
||||
src/if_lua.c \
|
||||
@@ -493,6 +492,7 @@ SRC_DOS_UNIX = \
|
||||
src/if_py_both.h \
|
||||
src/if_ruby.c \
|
||||
src/if_tcl.c \
|
||||
src/proto/gui_xim.pro \
|
||||
src/proto/if_cscope.pro \
|
||||
src/proto/if_lua.pro \
|
||||
src/proto/if_mzsch.pro \
|
||||
|
||||
@@ -66,6 +66,9 @@ To build the installable .exe:
|
||||
|
||||
Install NSIS if you didn't do that already.
|
||||
Also install UPX, if you want a compressed file.
|
||||
Download and include the ShellExecAsUser.dll Unicode version which can be
|
||||
sourced from: https://nsis.sourceforge.io/ShellExecAsUser_plug-in
|
||||
|
||||
|
||||
Unpack the images:
|
||||
cd nsis
|
||||
|
||||
@@ -119,9 +119,9 @@ RequestExecutionLevel highest
|
||||
|
||||
!define MUI_COMPONENTSPAGE_SMALLDESC
|
||||
!define MUI_LICENSEPAGE_CHECKBOX
|
||||
!define MUI_FINISHPAGE_RUN "$0\gvim.exe"
|
||||
!define MUI_FINISHPAGE_RUN
|
||||
!define MUI_FINISHPAGE_RUN_FUNCTION LaunchApplication
|
||||
!define MUI_FINISHPAGE_RUN_TEXT $(str_show_readme)
|
||||
!define MUI_FINISHPAGE_RUN_PARAMETERS "-R $\"$0\README.txt$\""
|
||||
|
||||
# This adds '\Vim' to the user choice automagically. The actual value is
|
||||
# obtained below with CheckOldVim.
|
||||
@@ -300,6 +300,11 @@ Function CheckOldVim
|
||||
Exch $0 # put $0 on top of stack, restore $0 to original value
|
||||
FunctionEnd
|
||||
|
||||
Function LaunchApplication
|
||||
SetOutPath $0
|
||||
ShellExecAsUser::ShellExecAsUser "" "$0\gvim.exe" '-R "$0\README.txt"'
|
||||
FunctionEnd
|
||||
|
||||
##########################################################
|
||||
Section "$(str_section_old_ver)" id_section_old_ver
|
||||
SectionIn 1 2 3 RO
|
||||
|
||||
@@ -24,7 +24,7 @@ LangString ^UninstallCaption ${LANG_ENGLISH} \
|
||||
# "Destination Folder (Must end with $\"vim$\")"
|
||||
|
||||
LangString str_show_readme ${LANG_ENGLISH} \
|
||||
"Show README after installation finish"
|
||||
"Show README after installation finished"
|
||||
|
||||
# Install types:
|
||||
LangString str_type_typical ${LANG_ENGLISH} \
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
" Vim completion script
|
||||
" Language: All languages, uses existing syntax highlighting rules
|
||||
" Maintainer: David Fishburn <dfishburn dot vim at gmail dot com>
|
||||
" Version: 14.0
|
||||
" Last Change: 2020 Dec 30
|
||||
" Version: 15.0
|
||||
" Last Change: 2021 Apr 27
|
||||
" Usage: For detailed help, ":help ft-syntax-omni"
|
||||
|
||||
" History
|
||||
"
|
||||
" Version 15.0
|
||||
" - SyntaxComplete ignored all buffer specific overrides, always used global
|
||||
" https://github.com/vim/vim/issues/8153
|
||||
"
|
||||
" Version 14.0
|
||||
" - Fixed issue with single quotes and is_keyword
|
||||
" https://github.com/vim/vim/issues/7463
|
||||
@@ -42,7 +46,7 @@
|
||||
" let g:omni_syntax_use_single_byte = 1
|
||||
" - This by default will only allow single byte ASCII
|
||||
" characters to be added and an additional check to ensure
|
||||
" the charater is printable (see documentation for isprint).
|
||||
" the character is printable (see documentation for isprint).
|
||||
"
|
||||
" Version 9.0
|
||||
" - Add the check for cpo.
|
||||
@@ -90,7 +94,7 @@ endif
|
||||
if exists('g:loaded_syntax_completion')
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntax_completion = 130
|
||||
let g:loaded_syntax_completion = 150
|
||||
|
||||
" Turn on support for line continuations when creating the script
|
||||
let s:cpo_save = &cpo
|
||||
@@ -145,14 +149,10 @@ let s:prepended = ''
|
||||
" This function is used for the 'omnifunc' option.
|
||||
function! syntaxcomplete#Complete(findstart, base)
|
||||
|
||||
" Only display items in the completion window that are at least
|
||||
" this many characters in length
|
||||
if !exists('b:omni_syntax_ignorecase')
|
||||
if exists('g:omni_syntax_ignorecase')
|
||||
let b:omni_syntax_ignorecase = g:omni_syntax_ignorecase
|
||||
else
|
||||
let b:omni_syntax_ignorecase = &ignorecase
|
||||
endif
|
||||
" Allow user to override ignorecase per buffer
|
||||
let l:omni_syntax_ignorecase = g:omni_syntax_ignorecase
|
||||
if exists('b:omni_syntax_ignorecase')
|
||||
let l:omni_syntax_ignorecase = b:omni_syntax_ignorecase
|
||||
endif
|
||||
|
||||
if a:findstart
|
||||
@@ -183,7 +183,6 @@ function! syntaxcomplete#Complete(findstart, base)
|
||||
endif
|
||||
|
||||
" let base = s:prepended . a:base
|
||||
" let base = s:prepended
|
||||
let base = substitute(s:prepended, "'", "''", 'g')
|
||||
|
||||
let filetype = substitute(&filetype, '\.', '_', 'g')
|
||||
@@ -200,13 +199,13 @@ function! syntaxcomplete#Complete(findstart, base)
|
||||
|
||||
if base != ''
|
||||
" let compstr = join(compl_list, ' ')
|
||||
" let expr = (b:omni_syntax_ignorecase==0?'\C':'').'\<\%('.base.'\)\@!\w\+\s*'
|
||||
" let expr = (l:omni_syntax_ignorecase==0?'\C':'').'\<\%('.base.'\)\@!\w\+\s*'
|
||||
" let compstr = substitute(compstr, expr, '', 'g')
|
||||
" let compl_list = split(compstr, '\s\+')
|
||||
|
||||
" Filter the list based on the first few characters the user
|
||||
" entered
|
||||
let expr = 'v:val '.(g:omni_syntax_ignorecase==1?'=~?':'=~#')." '^".escape(base, '\\/.*$^~[]').".*'"
|
||||
let expr = 'v:val '.(l:omni_syntax_ignorecase==1?'=~?':'=~#')." '^".escape(base, '\\/.*$^~[]').".*'"
|
||||
let compl_list = filter(deepcopy(compl_list), expr)
|
||||
endif
|
||||
|
||||
@@ -227,6 +226,26 @@ function! syntaxcomplete#OmniSyntaxList(...)
|
||||
endif
|
||||
endfunc
|
||||
|
||||
function! syntaxcomplete#OmniSyntaxClearCache()
|
||||
let s:cache_name = []
|
||||
let s:cache_list = []
|
||||
endfunction
|
||||
|
||||
" To retrieve all syntax items regardless of syntax group:
|
||||
" echo OmniSyntaxList( [] )
|
||||
"
|
||||
" To retrieve only the syntax items for the sqlOperator syntax group:
|
||||
" echo OmniSyntaxList( ['sqlOperator'] )
|
||||
"
|
||||
" To retrieve all syntax items for both the sqlOperator and sqlType groups:
|
||||
" echo OmniSyntaxList( ['sqlOperator', 'sqlType'] )
|
||||
"
|
||||
" A regular expression can also be used:
|
||||
" echo OmniSyntaxList( ['sql\w\+'] )
|
||||
"
|
||||
" From within a plugin, you would typically assign the output to a List: >
|
||||
" let myKeywords = []
|
||||
" let myKeywords = OmniSyntaxList( ['sqlKeyword'] )
|
||||
function! OmniSyntaxList(...)
|
||||
let list_parms = []
|
||||
if a:0 > 0
|
||||
@@ -244,37 +263,25 @@ function! OmniSyntaxList(...)
|
||||
" let use_dictionary = a:1
|
||||
" endif
|
||||
|
||||
" Only display items in the completion window that are at least
|
||||
" this many characters in length
|
||||
if !exists('b:omni_syntax_use_iskeyword')
|
||||
if exists('g:omni_syntax_use_iskeyword')
|
||||
let b:omni_syntax_use_iskeyword = g:omni_syntax_use_iskeyword
|
||||
else
|
||||
let b:omni_syntax_use_iskeyword = 1
|
||||
endif
|
||||
endif
|
||||
|
||||
" Only display items in the completion window that are at least
|
||||
" this many characters in length
|
||||
if !exists('b:omni_syntax_minimum_length')
|
||||
if exists('g:omni_syntax_minimum_length')
|
||||
let b:omni_syntax_minimum_length = g:omni_syntax_minimum_length
|
||||
else
|
||||
let b:omni_syntax_minimum_length = 0
|
||||
endif
|
||||
endif
|
||||
|
||||
let saveL = @l
|
||||
let filetype = substitute(&filetype, '\.', '_', 'g')
|
||||
|
||||
if empty(list_parms)
|
||||
" Allow user to override per buffer
|
||||
if exists('g:omni_syntax_group_include_'.filetype)
|
||||
let l:omni_syntax_group_include_{filetype} = g:omni_syntax_group_include_{filetype}
|
||||
endif
|
||||
if exists('b:omni_syntax_group_include_'.filetype)
|
||||
let l:omni_syntax_group_include_{filetype} = b:omni_syntax_group_include_{filetype}
|
||||
endif
|
||||
|
||||
" Default the include group to include the requested syntax group
|
||||
let syntax_group_include_{filetype} = ''
|
||||
" Check if there are any overrides specified for this filetype
|
||||
if exists('g:omni_syntax_group_include_'.filetype)
|
||||
if exists('l:omni_syntax_group_include_'.filetype)
|
||||
let syntax_group_include_{filetype} =
|
||||
\ substitute( g:omni_syntax_group_include_{filetype},'\s\+','','g')
|
||||
let list_parms = split(g:omni_syntax_group_include_{filetype}, ',')
|
||||
\ substitute( l:omni_syntax_group_include_{filetype},'\s\+','','g')
|
||||
let list_parms = split(l:omni_syntax_group_include_{filetype}, ',')
|
||||
if syntax_group_include_{filetype} =~ '\w'
|
||||
let syntax_group_include_{filetype} =
|
||||
\ substitute( syntax_group_include_{filetype},
|
||||
@@ -329,11 +336,20 @@ function! OmniSyntaxList(...)
|
||||
else
|
||||
" Default the exclude group to nothing
|
||||
let syntax_group_exclude_{filetype} = ''
|
||||
" Check if there are any overrides specified for this filetype
|
||||
|
||||
" Allow user to override per buffer
|
||||
if exists('g:omni_syntax_group_exclude_'.filetype)
|
||||
let l:omni_syntax_group_exclude_{filetype} = g:omni_syntax_group_exclude_{filetype}
|
||||
endif
|
||||
if exists('b:omni_syntax_group_exclude_'.filetype)
|
||||
let l:omni_syntax_group_exclude_{filetype} = b:omni_syntax_group_exclude_{filetype}
|
||||
endif
|
||||
|
||||
" Check if there are any overrides specified for this filetype
|
||||
if exists('l:omni_syntax_group_exclude_'.filetype)
|
||||
let syntax_group_exclude_{filetype} =
|
||||
\ substitute( g:omni_syntax_group_exclude_{filetype},'\s\+','','g')
|
||||
let list_exclude_groups = split(g:omni_syntax_group_exclude_{filetype}, ',')
|
||||
\ substitute( l:omni_syntax_group_exclude_{filetype},'\s\+','','g')
|
||||
let list_exclude_groups = split(l:omni_syntax_group_exclude_{filetype}, ',')
|
||||
if syntax_group_exclude_{filetype} =~ '\w'
|
||||
let syntax_group_exclude_{filetype} =
|
||||
\ substitute( syntax_group_exclude_{filetype},
|
||||
@@ -529,6 +545,30 @@ endfunction
|
||||
|
||||
function! s:SyntaxCSyntaxGroupItems( group_name, syntax_full )
|
||||
|
||||
" Allow user to override iskeyword per buffer
|
||||
let l:omni_syntax_use_iskeyword = g:omni_syntax_use_iskeyword
|
||||
if exists('b:omni_syntax_use_iskeyword')
|
||||
let l:omni_syntax_use_iskeyword = b:omni_syntax_use_iskeyword
|
||||
endif
|
||||
|
||||
" Allow user to override iskeyword_numeric per buffer
|
||||
let l:omni_syntax_use_iskeyword_numeric = g:omni_syntax_use_iskeyword_numeric
|
||||
if exists('b:omni_syntax_use_iskeyword_numeric')
|
||||
let l:omni_syntax_use_iskeyword_numeric = b:omni_syntax_use_iskeyword_numeric
|
||||
endif
|
||||
|
||||
" Allow user to override iskeyword_numeric per buffer
|
||||
let l:omni_syntax_use_single_byte = g:omni_syntax_use_single_byte
|
||||
if exists('b:omni_syntax_use_single_byte')
|
||||
let l:omni_syntax_use_single_byte = b:omni_syntax_use_single_byte
|
||||
endif
|
||||
|
||||
" Allow user to override minimum_length per buffer
|
||||
let l:omni_syntax_minimum_length = g:omni_syntax_minimum_length
|
||||
if exists('b:omni_syntax_minimum_length')
|
||||
let l:omni_syntax_minimum_length = b:omni_syntax_minimum_length
|
||||
endif
|
||||
|
||||
let syn_list = ""
|
||||
|
||||
" From the full syntax listing, strip out the portion for the
|
||||
@@ -647,14 +687,23 @@ function! s:SyntaxCSyntaxGroupItems( group_name, syntax_full )
|
||||
\ syn_list, '\%(^\|\n\)\@<=\s*\(@\w\+\)'
|
||||
\ , "", 'g'
|
||||
\ )
|
||||
|
||||
if b:omni_syntax_use_iskeyword == 0
|
||||
|
||||
if l:omni_syntax_use_iskeyword == 0
|
||||
" There are a number of items which have non-word characters in
|
||||
" them, *'T_F1'*. vim.vim is one such file.
|
||||
" This will replace non-word characters with spaces.
|
||||
" setlocal filetype=forth
|
||||
" let g:omni_syntax_use_iskeyword = 1
|
||||
" let g:omni_syntax_use_iskeyword_numeric = 1
|
||||
" You will see entries like
|
||||
" #>>
|
||||
" (.local)
|
||||
" These were found doing a grep in vim82\syntax
|
||||
" grep iskeyword *
|
||||
" forth.vim:setlocal iskeyword=!,@,33-35,%,$,38-64,A-Z,91-96,a-z,123-126,128-255
|
||||
let syn_list = substitute( syn_list, '[^0-9A-Za-z_ ]', ' ', 'g' )
|
||||
else
|
||||
if g:omni_syntax_use_iskeyword_numeric == 1
|
||||
if l:omni_syntax_use_iskeyword_numeric == 1
|
||||
" iskeyword can contain value like this
|
||||
" 38,42,43,45,47-58,60-62,64-90,97-122,_,+,-,*,/,%,<,=,>,:,$,?,!,@-@,94
|
||||
" Numeric values convert to their ASCII equivalent using the
|
||||
@@ -674,7 +723,7 @@ function! s:SyntaxCSyntaxGroupItems( group_name, syntax_full )
|
||||
" cycle through each character within the range
|
||||
let [b:start, b:end] = split(item, '-')
|
||||
for range_item in range( b:start, b:end )
|
||||
if range_item <= 127 || g:omni_syntax_use_single_byte == 0
|
||||
if range_item <= 127 || l:omni_syntax_use_single_byte == 0
|
||||
if nr2char(range_item) =~ '\p'
|
||||
let accepted_chars = accepted_chars . nr2char(range_item)
|
||||
endif
|
||||
@@ -682,13 +731,13 @@ function! s:SyntaxCSyntaxGroupItems( group_name, syntax_full )
|
||||
endfor
|
||||
elseif item =~ '^\d\+$'
|
||||
" Only numeric, translate to a character
|
||||
if item < 127 || g:omni_syntax_use_single_byte == 0
|
||||
if item < 127 || l:omni_syntax_use_single_byte == 0
|
||||
if nr2char(item) =~ '\p'
|
||||
let accepted_chars = accepted_chars . nr2char(item)
|
||||
endif
|
||||
endif
|
||||
else
|
||||
if char2nr(item) < 127 || g:omni_syntax_use_single_byte == 0
|
||||
if char2nr(item) < 127 || l:omni_syntax_use_single_byte == 0
|
||||
if item =~ '\p'
|
||||
let accepted_chars = accepted_chars . item
|
||||
endif
|
||||
@@ -724,9 +773,9 @@ function! s:SyntaxCSyntaxGroupItems( group_name, syntax_full )
|
||||
endif
|
||||
endif
|
||||
|
||||
if b:omni_syntax_minimum_length > 0
|
||||
if l:omni_syntax_minimum_length > 0
|
||||
" If the user specified a minimum length, enforce it
|
||||
let syn_list = substitute(' '.syn_list.' ', ' \S\{,'.b:omni_syntax_minimum_length.'}\ze ', ' ', 'g')
|
||||
let syn_list = substitute(' '.syn_list.' ', ' \S\{,'.l:omni_syntax_minimum_length.'}\ze ', ' ', 'g')
|
||||
endif
|
||||
else
|
||||
let syn_list = ''
|
||||
@@ -756,5 +805,6 @@ function! OmniSyntaxShowChars(spec)
|
||||
endfor
|
||||
return join(map(result, 'nr2char(v:val)'), ', ')
|
||||
endfunction
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*autocmd.txt* For Vim version 8.2. Last change: 2021 Mar 13
|
||||
*autocmd.txt* For Vim version 8.2. Last change: 2021 Apr 25
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -1522,7 +1522,14 @@ option will not cause any commands to be executed.
|
||||
loaded buffer. The current buffer is done last.
|
||||
|
||||
Note that [fname] is used to select the autocommands,
|
||||
not the buffers to which they are applied.
|
||||
not the buffers to which they are applied. Example: >
|
||||
augroup mine
|
||||
autocmd!
|
||||
autocmd FileType * echo expand('<amatch>')
|
||||
augroup END
|
||||
doautoall mine FileType Loaded-Buffer
|
||||
< Sourcing this script, you'll see as many
|
||||
"Loaded-Buffer" echoed as there are loaded buffers.
|
||||
|
||||
Careful: Don't use this for autocommands that delete a
|
||||
buffer, change to another buffer or change the
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*eval.txt* For Vim version 8.2. Last change: 2021 Apr 07
|
||||
*eval.txt* For Vim version 8.2. Last change: 2021 Apr 24
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -1962,6 +1962,9 @@ v:fcs_choice What should happen after a |FileChangedShell| event was
|
||||
The default is empty. If another (invalid) value is used then
|
||||
Vim behaves like it is empty, there is no warning message.
|
||||
|
||||
*v:fname* *fname-variable*
|
||||
v:fname The file name set by 'includeexpr'. Empty otherwise.
|
||||
|
||||
*v:fname_in* *fname_in-variable*
|
||||
v:fname_in The name of the input file. Valid while evaluating:
|
||||
option used for ~
|
||||
@@ -5775,7 +5778,6 @@ getmousepos() *getmousepos()*
|
||||
|
||||
If the mouse is over a popup window then that window is used.
|
||||
|
||||
|
||||
When using |getchar()| the Vim variables |v:mouse_lnum|,
|
||||
|v:mouse_col| and |v:mouse_winid| also provide these values.
|
||||
|
||||
@@ -6721,6 +6723,7 @@ islocked({expr}) *islocked()* *E786*
|
||||
|
||||
< When {expr} is a variable that does not exist you get an error
|
||||
message. Use |exists()| to check for existence.
|
||||
In Vim9 script it does not work for local variables.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetName()->islocked()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*gui.txt* For Vim version 8.2. Last change: 2020 Sep 28
|
||||
*gui.txt* For Vim version 8.2. Last change: 2021 May 01
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -620,6 +620,11 @@ expression register: >
|
||||
|
||||
:amenu Insert.foobar "='foobar'<CR>P
|
||||
|
||||
The special text <Cmd> begins a "command menu", it executes the command
|
||||
directly without changing modes. Where you might use ":...<CR>" you can
|
||||
instead use "<Cmd>...<CR>". See |<Cmd>| for more info. Example: >
|
||||
anoremenu File.Next <Cmd>next<CR>
|
||||
|
||||
Note that the '<' and 'k' flags in 'cpoptions' also apply here (when
|
||||
included they make the <> form and raw key codes not being recognized).
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*index.txt* For Vim version 8.2. Last change: 2021 Mar 22
|
||||
*index.txt* For Vim version 8.2. Last change: 2021 Apr 24
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*map.txt* For Vim version 8.2. Last change: 2021 Mar 17
|
||||
*map.txt* For Vim version 8.2. Last change: 2021 Apr 23
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -244,9 +244,12 @@ have a look at |maparg()|.
|
||||
If the first argument to one of these commands is "<expr>" and it is used to
|
||||
define a new mapping or abbreviation, the argument is an expression. The
|
||||
expression is evaluated to obtain the {rhs} that is used. Example: >
|
||||
:inoremap <expr> . InsertDot()
|
||||
The result of the InsertDot() function will be inserted. It could check the
|
||||
:inoremap <expr> . <SID>InsertDot()
|
||||
The result of the s:InsertDot() function will be inserted. It could check the
|
||||
text before the cursor and start omni completion when some condition is met.
|
||||
Using a script-local function is preferred, to avoid polluting the global
|
||||
namespace. Use <SID> in the RHS so that the script that the mapping was
|
||||
defined in can be found.
|
||||
|
||||
For abbreviations |v:char| is set to the character that was typed to trigger
|
||||
the abbreviation. You can use this to decide how to expand the {lhs}. You
|
||||
@@ -261,7 +264,7 @@ input. Example: >
|
||||
call popup_create(... arguments ...)
|
||||
return "\<Ignore>"
|
||||
endfunc
|
||||
nnoremap <expr> <F3> <Sid>OpenPopup()
|
||||
nnoremap <expr> <F3> <SID>OpenPopup()
|
||||
|
||||
Also, keep in mind that the expression may be evaluated when looking for
|
||||
typeahead, before the previous command has been executed. For example: >
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*options.txt* For Vim version 8.2. Last change: 2021 Apr 17
|
||||
*options.txt* For Vim version 8.2. Last change: 2021 Apr 28
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -4564,7 +4564,8 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
Keywords are used in searching and recognizing with many commands:
|
||||
"w", "*", "[i", etc. It is also used for "\k" in a |pattern|. See
|
||||
'isfname' for a description of the format of this option. For '@'
|
||||
characters above 255 check the "word" character class.
|
||||
characters above 255 check the "word" character class (any character
|
||||
that is not white space or punctuation).
|
||||
For C programs you could use "a-z,A-Z,48-57,_,.,-,>".
|
||||
For a help file it is set to all non-blank printable characters except
|
||||
'*', '"' and '|' (so that CTRL-] on a command finds the help for that
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*quickfix.txt* For Vim version 8.2. Last change: 2021 Feb 05
|
||||
*quickfix.txt* For Vim version 8.2. Last change: 2021 Apr 30
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -1008,13 +1008,11 @@ commands can be combined to create a NewGrep command: >
|
||||
5.1 using Vim's internal grep
|
||||
|
||||
*:vim* *:vimgrep* *E682* *E683*
|
||||
:vim[grep][!] /{pattern}/[g][j] {file} ...
|
||||
:vim[grep][!] /{pattern}/[g][j][f] {file} ...
|
||||
Search for {pattern} in the files {file} ... and set
|
||||
the error list to the matches. Files matching
|
||||
'wildignore' are ignored; files in 'suffixes' are
|
||||
searched last.
|
||||
Without the 'g' flag each line is added only once.
|
||||
With 'g' every match is added.
|
||||
|
||||
{pattern} is a Vim search pattern. Instead of
|
||||
enclosing it in / any non-ID character (see
|
||||
@@ -1026,6 +1024,22 @@ commands can be combined to create a NewGrep command: >
|
||||
If {pattern} is empty (e.g. // is specified), the last
|
||||
used search pattern is used. |last-pattern|
|
||||
|
||||
Flags:
|
||||
'g' Without the 'g' flag each line is added only
|
||||
once. With 'g' every match is added.
|
||||
|
||||
'j' Without the 'j' flag Vim jumps to the first
|
||||
match. With 'j' only the quickfix list is
|
||||
updated. With the [!] any changes in the current
|
||||
buffer are abandoned.
|
||||
|
||||
'f' When the 'f' flag is specified, fuzzy string
|
||||
matching is used to find matching lines. In this
|
||||
case, {pattern} is treated as a literal string
|
||||
instead of a regular expression. See
|
||||
|matchfuzzy()| for more info about fuzzy
|
||||
matching.
|
||||
|
||||
|QuickFixCmdPre| and |QuickFixCmdPost| are triggered.
|
||||
A file that is opened for matching may use a buffer
|
||||
number, but it is reused if possible to avoid
|
||||
@@ -1038,11 +1052,6 @@ commands can be combined to create a NewGrep command: >
|
||||
Useful if you only want to check if there is a match
|
||||
and quit quickly when it's found.
|
||||
|
||||
Without the 'j' flag Vim jumps to the first match.
|
||||
With 'j' only the quickfix list is updated.
|
||||
With the [!] any changes in the current buffer are
|
||||
abandoned.
|
||||
|
||||
Every second or so the searched file name is displayed
|
||||
to give you an idea of the progress made.
|
||||
Examples: >
|
||||
@@ -1059,20 +1068,20 @@ commands can be combined to create a NewGrep command: >
|
||||
:vimgrep Error *.c
|
||||
<
|
||||
*:lv* *:lvimgrep*
|
||||
:lv[imgrep][!] /{pattern}/[g][j] {file} ...
|
||||
:lv[imgrep][!] /{pattern}/[g][j][f] {file} ...
|
||||
:lv[imgrep][!] {pattern} {file} ...
|
||||
Same as ":vimgrep", except the location list for the
|
||||
current window is used instead of the quickfix list.
|
||||
|
||||
*:vimgrepa* *:vimgrepadd*
|
||||
:vimgrepa[dd][!] /{pattern}/[g][j] {file} ...
|
||||
:vimgrepa[dd][!] /{pattern}/[g][j][f] {file} ...
|
||||
:vimgrepa[dd][!] {pattern} {file} ...
|
||||
Just like ":vimgrep", but instead of making a new list
|
||||
of errors the matches are appended to the current
|
||||
list.
|
||||
|
||||
*:lvimgrepa* *:lvimgrepadd*
|
||||
:lvimgrepa[dd][!] /{pattern}/[g][j] {file} ...
|
||||
:lvimgrepa[dd][!] /{pattern}/[g][j][f] {file} ...
|
||||
:lvimgrepa[dd][!] {pattern} {file} ...
|
||||
Same as ":vimgrepadd", except the location list for
|
||||
the current window is used instead of the quickfix
|
||||
|
||||
@@ -2630,6 +2630,8 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
|
||||
:left change.txt /*:left*
|
||||
:lefta windows.txt /*:lefta*
|
||||
:leftabove windows.txt /*:leftabove*
|
||||
:leg vim9.txt /*:leg*
|
||||
:legacy vim9.txt /*:legacy*
|
||||
:let eval.txt /*:let*
|
||||
:let%= eval.txt /*:let%=*
|
||||
:let+= eval.txt /*:let+=*
|
||||
@@ -6439,6 +6441,7 @@ floating-point-format eval.txt /*floating-point-format*
|
||||
floating-point-precision eval.txt /*floating-point-precision*
|
||||
floor() eval.txt /*floor()*
|
||||
fmod() eval.txt /*fmod()*
|
||||
fname-variable eval.txt /*fname-variable*
|
||||
fname_diff-variable eval.txt /*fname_diff-variable*
|
||||
fname_in-variable eval.txt /*fname_in-variable*
|
||||
fname_new-variable eval.txt /*fname_new-variable*
|
||||
@@ -9875,6 +9878,7 @@ v:exiting eval.txt /*v:exiting*
|
||||
v:false eval.txt /*v:false*
|
||||
v:fcs_choice eval.txt /*v:fcs_choice*
|
||||
v:fcs_reason eval.txt /*v:fcs_reason*
|
||||
v:fname eval.txt /*v:fname*
|
||||
v:fname_diff eval.txt /*v:fname_diff*
|
||||
v:fname_in eval.txt /*v:fname_in*
|
||||
v:fname_new eval.txt /*v:fname_new*
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*todo.txt* For Vim version 8.2. Last change: 2021 Apr 21
|
||||
*todo.txt* For Vim version 8.2. Last change: 2021 Apr 29
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -39,13 +39,6 @@ browser use: https://github.com/vim/vim/issues/1234
|
||||
-------------------- Known bugs and current work -----------------------
|
||||
|
||||
Vim9 - Make everything work:
|
||||
- Compile builtin functions that access local variables:
|
||||
islocked()
|
||||
- When evaluating constants for script variables, some functions could work:
|
||||
has('asdf'), len('string')
|
||||
eval_variable(). Should pass the ".xxx" that follows and return that.
|
||||
- Make "++nr" work. "++g:count" doesn't work, thinks it is a range.
|
||||
- Reload: How to make sure type of script function hasn't changed?
|
||||
- expandcmd() with `=expr` in filename uses legacy expression.
|
||||
- eval_expr() in ex_cexpr()
|
||||
- eval_expr() call in dbg_parsearg() and debuggy_find()
|
||||
@@ -64,6 +57,17 @@ Vim9 - Make everything work:
|
||||
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
|
||||
- Test more expressions in legacy and Vim9 script, using
|
||||
CheckLegacyAndVim9Success()
|
||||
- Test try/catch and throw better, also nested.
|
||||
Test that return inside try/finally jumps to finally and then returns.
|
||||
- Test that a function defined inside a :def function is local to that
|
||||
function, g: functions can be defined and script-local functions cannot be
|
||||
defined.
|
||||
- Make debugging work - at least per function. Need to recompile a function
|
||||
to step through it line-by-line? Evaluate the stack and variables on the
|
||||
stack?
|
||||
- Reserve command for future use: :type, :class, :enum
|
||||
|
||||
Once Vim9 is stable:
|
||||
- Change the help to prefer Vim9 syntax where appropriate
|
||||
@@ -73,34 +77,17 @@ Once Vim9 is stable:
|
||||
- Use Vim9 for runtime files.
|
||||
PR #7497 for autoload/ccomplete.vim
|
||||
|
||||
Also for Vim9:
|
||||
Further Vim9 improvements, possibly after launch:
|
||||
- better implementation for partial and tests for that.
|
||||
- Make "g:imported = Export.exported" work in Vim9 script.
|
||||
- Make Foo.Bar() work to call the dict function. (#5676)
|
||||
- Error in any command in "vim9script" aborts sourcing.
|
||||
- Find a way to test expressions in legacy and Vim9 script without duplication
|
||||
- Test try/catch and throw better, also nested.
|
||||
Test that return inside try/finally jumps to finally and then returns.
|
||||
- Test that a function defined inside a :def function is local to that
|
||||
function, g: functions can be defined and script-local functions cannot be
|
||||
defined.
|
||||
- compile options that are an expression, e.g. "expr:" in 'spellsuggest',
|
||||
- Compile options that are an expression, e.g. "expr:" in 'spellsuggest',
|
||||
'foldexpr', 'foldtext', 'printexpr', 'diffexpr', 'patchexpr', 'charconvert',
|
||||
'balloonexpr', 'includeexpr', 'indentexpr', 'formatexpr'.
|
||||
Give an error if compilation fails. (#7625)
|
||||
Use the location where the option was set for deciding whether it's to be
|
||||
evaluated in Vim9 script context.
|
||||
- implement :type; import type declaration.
|
||||
- implement enum; import enum.
|
||||
- implement :type, import type declaration.
|
||||
- implement enum, import enum.
|
||||
- Future work: See |vim9-classes|
|
||||
Define the keywords and commands to make sure it will be backwards
|
||||
compatible.
|
||||
- Make debugging work - at least per function. Need to recompile a function
|
||||
to step through it line-by-line? Evaluate the stack and variables on the
|
||||
stack?
|
||||
- List commands when 'verbose' is set or :verbose is used.
|
||||
|
||||
Further Vim9 improvements, possibly after launch:
|
||||
- For range: make table of first ASCII character with flag to quickly check if
|
||||
it can be a Vim9 command. E.g. "+" can, but "." can't.
|
||||
- compile get_lambda_tv() in popup_add_timeout()
|
||||
@@ -108,6 +95,9 @@ Further Vim9 improvements, possibly after launch:
|
||||
- Make accessing varargs faster: arg[expr]
|
||||
EVAL expr
|
||||
LOADVARARG (varargs idx)
|
||||
- When evaluating constants for script variables, some functions could work:
|
||||
has(featureName), len(someString)
|
||||
- Implement as part of an expression: ++expr, --expr, expr++, expr--.
|
||||
|
||||
|
||||
Popup windows:
|
||||
@@ -1404,9 +1394,6 @@ Patch to make tests pass with EBCDIC. (Owen Leibman, 2016 Apr 10)
|
||||
Add ":read :command", to insert the output of an Ex command?
|
||||
Can already do it with ":$put =execute('command')".
|
||||
|
||||
When repeating the 'confirm' dialog one needs to press Enter. (ds26gte, 2016
|
||||
Apr 17) #762
|
||||
|
||||
exists(":tearoff") does not tell you if the command is implemented. (Tony
|
||||
Mechelynck) Perhaps use exists("::tearoff") to check?
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*usr_02.txt* For Vim version 8.2. Last change: 2019 Nov 21
|
||||
*usr_02.txt* For Vim version 8.2. Last change: 2021 Apr 24
|
||||
|
||||
VIM USER MANUAL - by Bram Moolenaar
|
||||
|
||||
@@ -532,7 +532,7 @@ Summary: *help-summary* >
|
||||
< for the corresponding flag of the 'cpoptions' settings, substitute <letter>
|
||||
by a specific flag, e.g.: >
|
||||
:help cpo-;
|
||||
< And for the guioption flags: >
|
||||
< And for the 'guioptions' flags: >
|
||||
:help go-<letter>
|
||||
|
||||
4) Normal mode commands do not have a prefix. To go to the help page for the
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*vim9.txt* For Vim version 8.2. Last change: 2021 Apr 11
|
||||
*vim9.txt* For Vim version 8.2. Last change: 2021 Apr 28
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -157,6 +157,11 @@ Compilation is done when any of these is encountered:
|
||||
*E1091*
|
||||
If compilation fails it is not tried again on the next call, instead this
|
||||
error is given: "E1091: Function is not compiled: {name}".
|
||||
Compilation will fail when encountering a user command that has not been
|
||||
created yet. In this case you can call `execute()` to invoke it at runtime. >
|
||||
def MyFunc()
|
||||
execute('DefinedLater')
|
||||
enddef
|
||||
|
||||
`:def` has no options like `:function` does: "range", "abort", "dict" or
|
||||
"closure". A `:def` function always aborts on an error (unless `:silent!` was
|
||||
@@ -605,6 +610,44 @@ Notes:
|
||||
echo [1, 2]
|
||||
[3, 4]
|
||||
|
||||
|
||||
White space ~
|
||||
|
||||
Vim9 script enforces proper use of white space. This is no longer allowed: >
|
||||
var name=234 # Error!
|
||||
var name= 234 # Error!
|
||||
var name =234 # Error!
|
||||
There must be white space before and after the "=": >
|
||||
var name = 234 # OK
|
||||
White space must also be put before the # that starts a comment after a
|
||||
command: >
|
||||
var name = 234# Error!
|
||||
var name = 234 # OK
|
||||
|
||||
White space is required around most operators.
|
||||
|
||||
White space is required in a sublist (list slice) around the ":", except at
|
||||
the start and end: >
|
||||
otherlist = mylist[v : count] # v:count has a different meaning
|
||||
otherlist = mylist[:] # make a copy of the List
|
||||
otherlist = mylist[v :]
|
||||
otherlist = mylist[: v]
|
||||
|
||||
White space is not allowed:
|
||||
- Between a function name and the "(": >
|
||||
Func (arg) # Error!
|
||||
Func
|
||||
\ (arg) # Error!
|
||||
Func
|
||||
(arg) # Error!
|
||||
Func(arg) # OK
|
||||
Func(
|
||||
arg) # OK
|
||||
Func(
|
||||
arg # OK
|
||||
)
|
||||
|
||||
|
||||
No curly braces expansion ~
|
||||
|
||||
|curly-braces-names| cannot be used.
|
||||
@@ -656,6 +699,17 @@ Comparators ~
|
||||
The 'ignorecase' option is not used for comparators that use strings.
|
||||
|
||||
|
||||
Abort after error ~
|
||||
|
||||
In legacy script, when an error is encountered, Vim continues to execute
|
||||
following lines. This can lead to a long sequence of errors and need to type
|
||||
CTRL-C to stop it. In Vim9 script execution of commands stops at the first
|
||||
error. Example: >
|
||||
vim9script
|
||||
var x = does-not-exist
|
||||
echo 'not executed'
|
||||
|
||||
|
||||
For loop ~
|
||||
|
||||
Legacy Vim script has some tricks to make a for loop over a list handle
|
||||
@@ -679,43 +733,6 @@ Generally, you should not change the list that is iterated over. Make a copy
|
||||
first if needed.
|
||||
|
||||
|
||||
White space ~
|
||||
|
||||
Vim9 script enforces proper use of white space. This is no longer allowed: >
|
||||
var name=234 # Error!
|
||||
var name= 234 # Error!
|
||||
var name =234 # Error!
|
||||
There must be white space before and after the "=": >
|
||||
var name = 234 # OK
|
||||
White space must also be put before the # that starts a comment after a
|
||||
command: >
|
||||
var name = 234# Error!
|
||||
var name = 234 # OK
|
||||
|
||||
White space is required around most operators.
|
||||
|
||||
White space is required in a sublist (list slice) around the ":", except at
|
||||
the start and end: >
|
||||
otherlist = mylist[v : count] # v:count has a different meaning
|
||||
otherlist = mylist[:] # make a copy of the List
|
||||
otherlist = mylist[v :]
|
||||
otherlist = mylist[: v]
|
||||
|
||||
White space is not allowed:
|
||||
- Between a function name and the "(": >
|
||||
Func (arg) # Error!
|
||||
Func
|
||||
\ (arg) # Error!
|
||||
Func
|
||||
(arg) # Error!
|
||||
Func(arg) # OK
|
||||
Func(
|
||||
arg) # OK
|
||||
Func(
|
||||
arg # OK
|
||||
)
|
||||
|
||||
|
||||
Conditions and expressions ~
|
||||
|
||||
Conditions and expressions are mostly working like they do in other languages.
|
||||
|
||||
25
runtime/ftplugin/fpcmake.vim
Normal file
25
runtime/ftplugin/fpcmake.vim
Normal file
@@ -0,0 +1,25 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: Free Pascal Makefile Generator
|
||||
" Maintainer: Doug Kearns <dougkearns@gmail.com>
|
||||
" Last Change: 2021 Apr 23
|
||||
|
||||
if exists("b:did_ftplugin")
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
runtime! ftplugin/make.vim
|
||||
|
||||
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
|
||||
let b:browsefilter = "Free Pascal Makefile Definition Files (*.fpc)\t*.fpc\n" ..
|
||||
\ "All Files (*.*)\t*.*\n"
|
||||
endif
|
||||
|
||||
let b:undo_ftplugin = b:undo_ftplugin .. " | unlet! b:browsefilter"
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: nowrap sw=2 sts=2 ts=8 noet:
|
||||
@@ -1,20 +1,50 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: pascal
|
||||
" Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
|
||||
" Last Changed: 11 Apr 2011
|
||||
" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
|
||||
" Language: Pascal
|
||||
" Maintainer: Doug Kearns <dougkearns@gmail.com>
|
||||
" Previous Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
|
||||
" Last Change: 2021 Apr 23
|
||||
|
||||
if exists("b:did_ftplugin") | finish | endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
if exists("loaded_matchit")
|
||||
let b:match_ignorecase = 1 " (pascal is case-insensitive)
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
let b:match_words = '\<\%(begin\|case\|record\|object\|try\)\>'
|
||||
let b:match_words .= ':\<^\s*\%(except\|finally\)\>:\<end\>'
|
||||
let b:match_words .= ',\<repeat\>:\<until\>'
|
||||
let b:match_words .= ',\<if\>:\<else\>'
|
||||
set comments=s:(*,m:\ ,e:*),s:{,m:\ ,e:}
|
||||
set commentstring={%s}
|
||||
|
||||
if exists("pascal_delphi")
|
||||
set comments+=:///
|
||||
endif
|
||||
|
||||
" Undo the stuff we changed.
|
||||
let b:undo_ftplugin = "unlet! b:match_words"
|
||||
if !exists("pascal_traditional")
|
||||
set commentstring=//\ %s
|
||||
set comments+=://
|
||||
endif
|
||||
|
||||
setlocal formatoptions-=t formatoptions+=croql
|
||||
|
||||
if exists("loaded_matchit")
|
||||
let b:match_ignorecase = 1 " (Pascal is case-insensitive)
|
||||
|
||||
let b:match_words = '\<\%(asm\|begin\|case\|\%(\%(=\|packed\)\s*\)\@<=\%(class\|object\)\|\%(=\s*\)\@<=interface\|record\|try\)\>'
|
||||
let b:match_words .= ':\%(^\s*\)\@<=\%(except\|finally\|else\|otherwise\)\>'
|
||||
let b:match_words .= ':\<end\>\.\@!'
|
||||
|
||||
let b:match_words .= ',\<repeat\>:\<until\>'
|
||||
" let b:match_words .= ',\<if\>:\<else\>' " FIXME - else clashing with middle else. It seems like a debatable use anyway.
|
||||
let b:match_words .= ',\<unit\>:\<\%(\%(^\s*\)\@<=interface\|implementation\|initialization\|finalization\)\>:\<end\.'
|
||||
endif
|
||||
|
||||
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
|
||||
let b:browsefilter = "Pascal Source Files (*.pas *.pp *.inc)\t*.pas;*.pp;*.inc\n" .
|
||||
\ "All Files (*.*)\t*.*\n"
|
||||
endif
|
||||
|
||||
let b:undo_ftplugin = "setl fo< cms< com< " ..
|
||||
\ "| unlet! b:browsefilter b:match_words b:match_ignorecase"
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: nowrap sw=2 sts=2 ts=8 noet:
|
||||
|
||||
@@ -20,8 +20,8 @@ let s:comment_rx = '^\s*#'
|
||||
let s:rule_rx = '^[^ \t#:][^#:]*:\{1,2}\%([^=:]\|$\)'
|
||||
let s:continued_rule_rx = '^[^#:]*:\{1,2}\%([^=:]\|$\)'
|
||||
let s:continuation_rx = '\\$'
|
||||
let s:assignment_rx = '^\s*\h\w*\s*[+?]\==\s*\zs.*\\$'
|
||||
let s:folded_assignment_rx = '^\s*\h\w*\s*[+?]\=='
|
||||
let s:assignment_rx = '^\s*\h\w*\s*[+:?]\==\s*\zs.*\\$'
|
||||
let s:folded_assignment_rx = '^\s*\h\w*\s*[+:?]\=='
|
||||
" TODO: This needs to be a lot more restrictive in what it matches.
|
||||
let s:just_inserted_rule_rx = '^\s*[^#:]\+:\{1,2}$'
|
||||
let s:conditional_directive_rx = '^ *\%(ifn\=\%(eq\|def\)\|else\)\>'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
" Vim syntax file
|
||||
" Language: generic configure file
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last Change: 2005 Jun 20
|
||||
" Last Change: 2021 May 01
|
||||
|
||||
" Quit when a (custom) syntax file was already loaded
|
||||
if exists("b:current_syntax")
|
||||
@@ -10,8 +10,8 @@ endif
|
||||
|
||||
syn keyword confTodo contained TODO FIXME XXX
|
||||
" Avoid matching "text#text", used in /etc/disktab and /etc/gettytab
|
||||
syn match confComment "^#.*" contains=confTodo
|
||||
syn match confComment "\s#.*"ms=s+1 contains=confTodo
|
||||
syn match confComment "^#.*" contains=confTodo,@Spell
|
||||
syn match confComment "\s#.*"ms=s+1 contains=confTodo,@Spell
|
||||
syn region confString start=+"+ skip=+\\\\\|\\"+ end=+"+ oneline
|
||||
syn region confString start=+'+ skip=+\\\\\|\\'+ end=+'+ oneline
|
||||
|
||||
|
||||
58
runtime/syntax/fpcmake.vim
Normal file
58
runtime/syntax/fpcmake.vim
Normal file
@@ -0,0 +1,58 @@
|
||||
" Vim syntax file
|
||||
" Language: Free Pascal Makefile Definition Files
|
||||
" Maintainer: Doug Kearns <dougkearns@gmail.com>
|
||||
" Last Change: 2021 Apr 23
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
runtime! syntax/make.vim
|
||||
|
||||
" NOTE: using start-of-line anchored syn-match groups is simpler than other
|
||||
" alternatives when interacting with the sourced make.vim syntax groups
|
||||
|
||||
" Sections
|
||||
syn region fpcmakeSection matchgroup=fpcmakeSectionDelimiter start="^\s*\[" end="]" contains=fpcmakeSectionName
|
||||
|
||||
syn keyword fpcmakeSectionName contained clean compiler default dist install
|
||||
syn keyword fpcmakeSectionName contained lib package prerules require rules
|
||||
syn keyword fpcmakeSectionName contained shared target
|
||||
|
||||
" [clean]
|
||||
syn match fpcmakeRule "^\s*\(units\|files\)\>"
|
||||
" [compiler]
|
||||
syn match fpcmakeRule "^\s*\(options\|version\|unitdir\|librarydir\|objectdir\)\>"
|
||||
syn match fpcmakeRule "^\s*\(targetdir\|sourcedir\|unittargetdir\|includedir\)\>"
|
||||
" [default]
|
||||
syn match fpcmakeRule "^\s*\(cpu\|dir\|fpcdir\|rule\|target\)\>"
|
||||
" [dist]
|
||||
syn match fpcmakeRule "^\s*\(destdir\|zipname\|ziptarget\)\>"
|
||||
" [install]
|
||||
syn match fpcmakeRule "^\s*\(basedir\|datadir\|fpcpackage\|files\|prefix\)\>"
|
||||
syn match fpcmakeRule "^\s*\(units\)\>"
|
||||
" [package]
|
||||
syn match fpcmakeRule "^\s*\(name\|version\|main\)\>"
|
||||
" [requires]
|
||||
syn match fpcmakeRule "^\s*\(fpcmake\|packages\|libc\|nortl\|unitdir\)\>"
|
||||
syn match fpcmakeRule "^\s*\(packagedir\|tools\)\>"
|
||||
" [shared]
|
||||
syn match fpcmakeRule "^\s*\(build\|libname\|libversion\|libunits\)\>"
|
||||
" [target]
|
||||
syn match fpcmakeRule "^\s*\(dirs\|exampledirs\|examples\|loaders\|programs\)\>"
|
||||
syn match fpcmakeRule "^\s*\(rsts\|units\)\>"
|
||||
|
||||
" Comments
|
||||
syn keyword fpcmakeTodo TODO FIXME XXX contained
|
||||
syn match fpcmakeComment "#.*" contains=fpcmakeTodo,@Spell
|
||||
|
||||
" Default highlighting
|
||||
hi def link fpcmakeSectionDelimiter Delimiter
|
||||
hi def link fpcmakeSectionName Type
|
||||
hi def link fpcmakeComment Comment
|
||||
hi def link fpcmakeTodo Todo
|
||||
hi def link fpcmakeRule Identifier
|
||||
|
||||
let b:current_syntax = "fpcmake"
|
||||
|
||||
" vim: nowrap sw=2 sts=2 ts=8 noet:
|
||||
@@ -1,16 +1,16 @@
|
||||
" Vim syntax file
|
||||
" Language: Pascal
|
||||
" Version: 2.8
|
||||
" Last Change: 2004/10/17 17:47:30
|
||||
" Maintainer: Xavier Crégut <xavier.cregut@enseeiht.fr>
|
||||
" Previous Maintainer: Mario Eusebio <bio@dq.fct.unl.pt>
|
||||
" Language: Pascal
|
||||
" Maintainer: Doug Kearns <dougkearns@gmail.com>
|
||||
" Previous Maintainers: Xavier Crégut <xavier.cregut@enseeiht.fr>
|
||||
" Mario Eusebio <bio@dq.fct.unl.pt>
|
||||
" Last Change: 2021 Apr 23
|
||||
|
||||
" Contributors: Tim Chase <tchase@csc.com>,
|
||||
" Stas Grabois <stsi@vtrails.com>,
|
||||
" Mazen NEIFER <mazen.neifer.2001@supaero.fr>,
|
||||
" Klaus Hast <Klaus.Hast@arcor.net>,
|
||||
" Austin Ziegler <austin@halostatue.ca>,
|
||||
" Markus Koenig <markus@stber-koenig.de>
|
||||
" Stas Grabois <stsi@vtrails.com>,
|
||||
" Mazen NEIFER <mazen.neifer.2001@supaero.fr>,
|
||||
" Klaus Hast <Klaus.Hast@arcor.net>,
|
||||
" Austin Ziegler <austin@halostatue.ca>,
|
||||
" Markus Koenig <markus@stber-koenig.de>
|
||||
|
||||
" quit when a syntax file was already loaded
|
||||
if exists("b:current_syntax")
|
||||
@@ -25,10 +25,10 @@ syn keyword pascalBoolean true false
|
||||
syn keyword pascalConditional if else then
|
||||
syn keyword pascalConstant nil maxint
|
||||
syn keyword pascalLabel case goto label
|
||||
syn keyword pascalOperator and div downto in mod not of or packed with
|
||||
syn keyword pascalOperator and div downto in mod not of or packed
|
||||
syn keyword pascalRepeat do for do repeat while to until
|
||||
syn keyword pascalStatement procedure function
|
||||
syn keyword pascalStatement program begin end const var type
|
||||
syn keyword pascalStatement program begin end const var type with
|
||||
syn keyword pascalStruct record
|
||||
syn keyword pascalType array boolean char integer file pointer real set
|
||||
syn keyword pascalType string text variant
|
||||
@@ -40,12 +40,12 @@ syn keyword pascalTodo contained TODO FIXME XXX DEBUG NOTE
|
||||
" 20010723az: When wanted, highlight the trailing whitespace -- this is
|
||||
" based on c_space_errors; to enable, use "pascal_space_errors".
|
||||
if exists("pascal_space_errors")
|
||||
if !exists("pascal_no_trail_space_error")
|
||||
syn match pascalSpaceError "\s\+$"
|
||||
endif
|
||||
if !exists("pascal_no_tab_space_error")
|
||||
syn match pascalSpaceError " \+\t"me=e-1
|
||||
endif
|
||||
if !exists("pascal_no_trail_space_error")
|
||||
syn match pascalSpaceError "\s\+$"
|
||||
endif
|
||||
if !exists("pascal_no_tab_space_error")
|
||||
syn match pascalSpaceError " \+\t"me=e-1
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
@@ -98,9 +98,24 @@ if exists("pascal_symbol_operator")
|
||||
endif
|
||||
|
||||
syn match pascalNumber "-\=\<\d\+\>"
|
||||
if !exists("pascal_traditional")
|
||||
syn match pascalHexNumber "\$\x\+\>"
|
||||
endif
|
||||
if exists("pascal_fpc")
|
||||
syn match pascalOctNumber "&\o\+\>"
|
||||
syn match pascalBinNumber "%[01]\+\>"
|
||||
endif
|
||||
if exists("pascal_gpc")
|
||||
syn match pascalExtendedNumber "\%([2-9]\|[12]\d\|3[0-6]\)#[[:alnum:]]\+\>"
|
||||
endif
|
||||
|
||||
syn match pascalFloat "-\=\<\d\+\.\d\+\>"
|
||||
syn match pascalFloat "-\=\<\d\+\.\d\+[eE]-\=\d\+\>"
|
||||
syn match pascalHexNumber "\$[0-9a-fA-F]\+\>"
|
||||
|
||||
if !exists("pascal_traditional")
|
||||
" allow leading zeros
|
||||
syn match pascalControlCharacter "#\%([01]\=\d\=\d\|2[0-4]\d\|25[0-5]\)\>"
|
||||
endif
|
||||
|
||||
if exists("pascal_no_tabs")
|
||||
syn match pascalShowTab "\t"
|
||||
@@ -142,7 +157,7 @@ if !exists("pascal_traditional")
|
||||
syn keyword pascalStatement interface unit uses
|
||||
syn keyword pascalModifier absolute assembler external far forward inline
|
||||
syn keyword pascalModifier interrupt near virtual
|
||||
syn keyword pascalAcces private public
|
||||
syn keyword pascalAccess private public strict
|
||||
syn keyword pascalStruct object
|
||||
syn keyword pascalOperator shl shr xor
|
||||
|
||||
@@ -157,6 +172,7 @@ if !exists("pascal_traditional")
|
||||
syn keyword pascalType Single Double Extended Comp
|
||||
syn keyword pascalType PChar
|
||||
|
||||
syn keyword pascalPredefined self
|
||||
|
||||
if !exists ("pascal_fpc")
|
||||
syn keyword pascalPredefined Result
|
||||
@@ -166,11 +182,11 @@ if !exists("pascal_traditional")
|
||||
syn region pascalComment start="//" end="$" contains=pascalTodo,pascalSpaceError
|
||||
syn keyword pascalStatement fail otherwise operator
|
||||
syn keyword pascalDirective popstack
|
||||
syn keyword pascalPredefined self
|
||||
syn keyword pascalType ShortString AnsiString WideString
|
||||
endif
|
||||
|
||||
if exists("pascal_gpc")
|
||||
syn region pascalComment start="//" end="$" contains=pascalTodo,pascalSpaceError
|
||||
syn keyword pascalType SmallInt
|
||||
syn keyword pascalType AnsiChar
|
||||
syn keyword pascalType PAnsiChar
|
||||
@@ -178,6 +194,8 @@ if !exists("pascal_traditional")
|
||||
|
||||
if exists("pascal_delphi")
|
||||
syn region pascalComment start="//" end="$" contains=pascalTodo,pascalSpaceError
|
||||
syn region pascalDocumentation start="///" end="$" contains=pascalTodo,pascalSpaceError
|
||||
syn region pascalDocumentation start="{!" end="}" contains=pascalTodo,pascalSpaceError
|
||||
syn keyword pascalType SmallInt Int64
|
||||
syn keyword pascalType Real48 Currency
|
||||
syn keyword pascalType AnsiChar WideChar
|
||||
@@ -192,11 +210,11 @@ if !exists("pascal_traditional")
|
||||
syn keyword pascalStatement initialization finalization uses exports
|
||||
syn keyword pascalStatement property out resourcestring threadvar
|
||||
syn keyword pascalModifier contains
|
||||
syn keyword pascalModifier overridden reintroduce abstract
|
||||
syn keyword pascalModifier overridden reintroduce abstract sealed
|
||||
syn keyword pascalModifier override export dynamic name message
|
||||
syn keyword pascalModifier dispid index stored default nodefault readonly
|
||||
syn keyword pascalModifier writeonly implements overload requires resident
|
||||
syn keyword pascalAcces protected published automated
|
||||
syn keyword pascalAccess protected published automated
|
||||
syn keyword pascalDirective register pascal cvar cdecl stdcall safecall
|
||||
syn keyword pascalOperator as is
|
||||
endif
|
||||
@@ -319,37 +337,43 @@ endif
|
||||
" Define the default highlighting.
|
||||
" Only when an item doesn't have highlighting yet
|
||||
|
||||
hi def link pascalAcces pascalStatement
|
||||
hi def link pascalAccess pascalStatement
|
||||
hi def link pascalBoolean Boolean
|
||||
hi def link pascalComment Comment
|
||||
hi def link pascalConditional Conditional
|
||||
hi def link pascalDocumentation Comment
|
||||
hi def link pascalConditional Conditional
|
||||
hi def link pascalConstant Constant
|
||||
hi def link pascalDelimiter Identifier
|
||||
hi def link pascalDirective pascalStatement
|
||||
hi def link pascalException Exception
|
||||
hi def link pascalFloat Float
|
||||
hi def link pascalControlCharacter Character
|
||||
hi def link pascalDelimiter Identifier
|
||||
hi def link pascalDirective pascalStatement
|
||||
hi def link pascalException Exception
|
||||
hi def link pascalFloat Float
|
||||
hi def link pascalFunction Function
|
||||
hi def link pascalLabel Label
|
||||
hi def link pascalLabel Label
|
||||
hi def link pascalMatrixDelimiter Identifier
|
||||
hi def link pascalModifier Type
|
||||
hi def link pascalNumber Number
|
||||
hi def link pascalExtendedNumber Number
|
||||
hi def link pascalBinNumber pascalNumber
|
||||
hi def link pascalHexNumber pascalNumber
|
||||
hi def link pascalOctNumber pascalNumber
|
||||
hi def link pascalOperator Operator
|
||||
hi def link pascalPredefined pascalStatement
|
||||
hi def link pascalPredefined pascalStatement
|
||||
hi def link pascalPreProc PreProc
|
||||
hi def link pascalRepeat Repeat
|
||||
hi def link pascalSpaceError Error
|
||||
hi def link pascalStatement Statement
|
||||
hi def link pascalSpaceError Error
|
||||
hi def link pascalStatement Statement
|
||||
hi def link pascalString String
|
||||
hi def link pascalStringEscape Special
|
||||
hi def link pascalStringEscape Special
|
||||
hi def link pascalStringEscapeGPC Special
|
||||
hi def link pascalStringError Error
|
||||
hi def link pascalStringError Error
|
||||
hi def link pascalStruct pascalStatement
|
||||
hi def link pascalSymbolOperator pascalOperator
|
||||
hi def link pascalTodo Todo
|
||||
hi def link pascalType Type
|
||||
hi def link pascalUnclassified pascalStatement
|
||||
hi def link pascalTodo Todo
|
||||
hi def link pascalType Type
|
||||
hi def link pascalUnclassified pascalStatement
|
||||
" hi def link pascalAsm Assembler
|
||||
hi def link pascalError Error
|
||||
hi def link pascalError Error
|
||||
hi def link pascalAsmKey pascalStatement
|
||||
hi def link pascalShowTab Error
|
||||
|
||||
@@ -357,4 +381,4 @@ hi def link pascalShowTab Error
|
||||
|
||||
let b:current_syntax = "pascal"
|
||||
|
||||
" vim: ts=8 sw=2
|
||||
" vim: nowrap sw=2 sts=2 ts=8 noet:
|
||||
|
||||
17
src/eval.c
17
src/eval.c
@@ -393,7 +393,7 @@ skip_expr(char_u **pp, evalarg_T *evalarg)
|
||||
}
|
||||
|
||||
/*
|
||||
* Skip over an expression at "*pp".
|
||||
* Skip over an expression at "*arg".
|
||||
* If in Vim9 script and line breaks are encountered, the lines are
|
||||
* concatenated. "evalarg->eval_tofree" will be set accordingly.
|
||||
* "arg" is advanced to just after the expression.
|
||||
@@ -451,7 +451,7 @@ skip_expr_concatenate(
|
||||
|
||||
// Line breaks encountered, concatenate all the lines.
|
||||
*((char_u **)gap->ga_data) = *start;
|
||||
p = ga_concat_strings(gap, "");
|
||||
p = ga_concat_strings(gap, " ");
|
||||
|
||||
// free the lines only when using getsourceline()
|
||||
if (evalarg->eval_cookie != NULL)
|
||||
@@ -2059,6 +2059,7 @@ eval_func(
|
||||
/*
|
||||
* Get the next line source line without advancing. But do skip over comment
|
||||
* lines.
|
||||
* Only called for Vim9 script.
|
||||
*/
|
||||
static char_u *
|
||||
getline_peek_skip_comments(evalarg_T *evalarg)
|
||||
@@ -2116,6 +2117,7 @@ eval_next_non_blank(char_u *arg, evalarg_T *evalarg, int *getnext)
|
||||
|
||||
/*
|
||||
* To be called after eval_next_non_blank() sets "getnext" to TRUE.
|
||||
* Only called for Vim9 script.
|
||||
*/
|
||||
char_u *
|
||||
eval_next_line(evalarg_T *evalarg)
|
||||
@@ -2131,7 +2133,16 @@ eval_next_line(evalarg_T *evalarg)
|
||||
++evalarg->eval_break_count;
|
||||
if (gap->ga_itemsize > 0 && ga_grow(gap, 1) == OK)
|
||||
{
|
||||
// Going to concatenate the lines after parsing.
|
||||
char_u *p = skipwhite(line);
|
||||
|
||||
// Going to concatenate the lines after parsing. For an empty or
|
||||
// comment line use an empty string.
|
||||
if (*p == NUL || vim9_comment_start(p))
|
||||
{
|
||||
vim_free(line);
|
||||
line = vim_strsave((char_u *)"");
|
||||
}
|
||||
|
||||
((char_u **)gap->ga_data)[gap->ga_len] = line;
|
||||
++gap->ga_len;
|
||||
}
|
||||
|
||||
@@ -5288,14 +5288,16 @@ skip_vimgrep_pat(char_u *p, char_u **s, int *flags)
|
||||
++p;
|
||||
|
||||
// Find the flags
|
||||
while (*p == 'g' || *p == 'j')
|
||||
while (*p == 'g' || *p == 'j' || *p == 'f')
|
||||
{
|
||||
if (flags != NULL)
|
||||
{
|
||||
if (*p == 'g')
|
||||
*flags |= VGR_GLOBAL;
|
||||
else
|
||||
else if (*p == 'j')
|
||||
*flags |= VGR_NOJUMP;
|
||||
else
|
||||
*flags |= VGR_FUZZY;
|
||||
}
|
||||
++p;
|
||||
}
|
||||
|
||||
@@ -1175,7 +1175,8 @@ do_cmdline(
|
||||
*/
|
||||
while (!((got_int
|
||||
#ifdef FEAT_EVAL
|
||||
|| (did_emsg && force_abort) || did_throw
|
||||
|| (did_emsg && (force_abort || in_vim9script()))
|
||||
|| did_throw
|
||||
#endif
|
||||
)
|
||||
#ifdef FEAT_EVAL
|
||||
@@ -1209,8 +1210,10 @@ do_cmdline(
|
||||
/*
|
||||
* If a sourced file or executed function ran to its end, report the
|
||||
* unclosed conditional.
|
||||
* In Vim9 script do not give a second error, executing aborts after
|
||||
* the first one.
|
||||
*/
|
||||
if (!got_int && !did_throw
|
||||
if (!got_int && !did_throw && !(did_emsg && in_vim9script())
|
||||
&& ((getline_equal(fgetline, cookie, getsourceline)
|
||||
&& !source_finished(fgetline, cookie))
|
||||
|| (getline_equal(fgetline, cookie, get_func_line)
|
||||
|
||||
@@ -3733,7 +3733,7 @@ vim_rename(char_u *from, char_u *to)
|
||||
return 0;
|
||||
// Strange, the second step failed. Try moving the
|
||||
// file back and return failure.
|
||||
mch_rename(tempname, (char *)from);
|
||||
(void)mch_rename(tempname, (char *)from);
|
||||
return -1;
|
||||
}
|
||||
// If it fails for one temp name it will most likely fail
|
||||
|
||||
@@ -1311,6 +1311,7 @@ EXTERN int wild_menu_showing INIT(= 0);
|
||||
#ifdef MSWIN
|
||||
EXTERN char_u toupper_tab[256]; // table for toupper()
|
||||
EXTERN char_u tolower_tab[256]; // table for tolower()
|
||||
EXTERN int found_register_arg INIT(= FALSE);
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_LINEBREAK
|
||||
|
||||
15
src/main.c
15
src/main.c
@@ -161,6 +161,21 @@ main
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#ifdef MSWIN
|
||||
// Need to find "-register" and "-unregister" before loading any libraries.
|
||||
for (i = 1; i < argc; ++i)
|
||||
if ((STRICMP(argv[i] + 1, "register") == 0
|
||||
|| STRICMP(argv[i] + 1, "unregister") == 0)
|
||||
&& (argv[i][0] == '-' || argv[i][0] == '/'))
|
||||
{
|
||||
found_register_arg = TRUE;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Various initialisations shared with tests.
|
||||
*/
|
||||
common_init(¶ms);
|
||||
|
||||
#ifdef VIMDLL
|
||||
|
||||
15
src/map.c
15
src/map.c
@@ -1540,10 +1540,23 @@ check_abbr(
|
||||
tb[j++] = Ctrl_V; // special char needs CTRL-V
|
||||
if (has_mbyte)
|
||||
{
|
||||
int newlen;
|
||||
char_u *escaped;
|
||||
|
||||
// if ABBR_OFF has been added, remove it here
|
||||
if (c >= ABBR_OFF)
|
||||
c -= ABBR_OFF;
|
||||
j += (*mb_char2bytes)(c, tb + j);
|
||||
newlen = (*mb_char2bytes)(c, tb + j);
|
||||
tb[j + newlen] = NUL;
|
||||
// Need to escape K_SPECIAL.
|
||||
escaped = vim_strsave_escape_csi(tb + j);
|
||||
if (escaped != NULL)
|
||||
{
|
||||
newlen = (int)STRLEN(escaped);
|
||||
mch_memmove(tb + j, escaped, newlen);
|
||||
j += newlen;
|
||||
vim_free(escaped);
|
||||
}
|
||||
}
|
||||
else
|
||||
tb[j++] = c;
|
||||
|
||||
@@ -529,6 +529,10 @@ vimLoadLib(char *name)
|
||||
{
|
||||
HINSTANCE dll = NULL;
|
||||
|
||||
// No need to load any library when registering OLE.
|
||||
if (found_register_arg)
|
||||
return dll;
|
||||
|
||||
// NOTE: Do not use mch_dirname() and mch_chdir() here, they may call
|
||||
// vimLoadLib() recursively, which causes a stack overflow.
|
||||
if (exe_path == NULL)
|
||||
|
||||
@@ -925,6 +925,8 @@ pum_set_selected(int n, int repeat UNUSED)
|
||||
|| (curtab != curtab_save
|
||||
&& valid_tabpage(curtab_save)))
|
||||
{
|
||||
int save_redr_status;
|
||||
|
||||
if (curtab != curtab_save && valid_tabpage(curtab_save))
|
||||
goto_tabpage_tp(curtab_save, FALSE, FALSE);
|
||||
|
||||
@@ -953,13 +955,20 @@ pum_set_selected(int n, int repeat UNUSED)
|
||||
// Update the screen before drawing the popup menu.
|
||||
// Enable updating the status lines.
|
||||
pum_pretend_not_visible = TRUE;
|
||||
|
||||
// But don't draw text at the new popup menu position,
|
||||
// it causes flicker. When resizing we need to draw
|
||||
// anyway, the position may change later.
|
||||
// Also do not redraw the status line of the original
|
||||
// current window here, to avoid it gets drawn with
|
||||
// StatusLineNC for a moment and cause flicker.
|
||||
pum_will_redraw = !resized;
|
||||
save_redr_status = curwin_save->w_redr_status;
|
||||
curwin_save->w_redr_status = FALSE;
|
||||
update_screen(0);
|
||||
pum_pretend_not_visible = FALSE;
|
||||
pum_will_redraw = FALSE;
|
||||
curwin_save->w_redr_status = save_redr_status;
|
||||
|
||||
if (!resized && win_valid(curwin_save))
|
||||
{
|
||||
|
||||
@@ -36,6 +36,7 @@ void find_pattern_in_path(char_u *ptr, int dir, int len, int whole, int skip_com
|
||||
spat_T *get_spat(int idx);
|
||||
int get_spat_last_idx(void);
|
||||
void f_searchcount(typval_T *argvars, typval_T *rettv);
|
||||
int fuzzy_match(char_u *str, char_u *pat_arg, int matchseq, int *outScore, int_u *matches, int maxMatches);
|
||||
void f_matchfuzzy(typval_T *argvars, typval_T *rettv);
|
||||
void f_matchfuzzypos(typval_T *argvars, typval_T *rettv);
|
||||
/* vim: set ft=c : */
|
||||
|
||||
113
src/quickfix.c
113
src/quickfix.c
@@ -5912,6 +5912,7 @@ vgr_match_buflines(
|
||||
qf_list_T *qfl,
|
||||
char_u *fname,
|
||||
buf_T *buf,
|
||||
char_u *spat,
|
||||
regmmatch_T *regmatch,
|
||||
long *tomatch,
|
||||
int duplicate_name,
|
||||
@@ -5920,45 +5921,91 @@ vgr_match_buflines(
|
||||
int found_match = FALSE;
|
||||
long lnum;
|
||||
colnr_T col;
|
||||
int pat_len = (int)STRLEN(spat);
|
||||
|
||||
for (lnum = 1; lnum <= buf->b_ml.ml_line_count && *tomatch > 0; ++lnum)
|
||||
{
|
||||
col = 0;
|
||||
while (vim_regexec_multi(regmatch, curwin, buf, lnum,
|
||||
col, NULL, NULL) > 0)
|
||||
if (!(flags & VGR_FUZZY))
|
||||
{
|
||||
// Pass the buffer number so that it gets used even for a
|
||||
// dummy buffer, unless duplicate_name is set, then the
|
||||
// buffer will be wiped out below.
|
||||
if (qf_add_entry(qfl,
|
||||
NULL, // dir
|
||||
fname,
|
||||
NULL,
|
||||
duplicate_name ? 0 : buf->b_fnum,
|
||||
ml_get_buf(buf,
|
||||
regmatch->startpos[0].lnum + lnum, FALSE),
|
||||
regmatch->startpos[0].lnum + lnum,
|
||||
regmatch->startpos[0].col + 1,
|
||||
FALSE, // vis_col
|
||||
NULL, // search pattern
|
||||
0, // nr
|
||||
0, // type
|
||||
TRUE // valid
|
||||
) == QF_FAIL)
|
||||
// Regular expression match
|
||||
while (vim_regexec_multi(regmatch, curwin, buf, lnum,
|
||||
col, NULL, NULL) > 0)
|
||||
{
|
||||
got_int = TRUE;
|
||||
break;
|
||||
// Pass the buffer number so that it gets used even for a
|
||||
// dummy buffer, unless duplicate_name is set, then the
|
||||
// buffer will be wiped out below.
|
||||
if (qf_add_entry(qfl,
|
||||
NULL, // dir
|
||||
fname,
|
||||
NULL,
|
||||
duplicate_name ? 0 : buf->b_fnum,
|
||||
ml_get_buf(buf,
|
||||
regmatch->startpos[0].lnum + lnum, FALSE),
|
||||
regmatch->startpos[0].lnum + lnum,
|
||||
regmatch->startpos[0].col + 1,
|
||||
FALSE, // vis_col
|
||||
NULL, // search pattern
|
||||
0, // nr
|
||||
0, // type
|
||||
TRUE // valid
|
||||
) == QF_FAIL)
|
||||
{
|
||||
got_int = TRUE;
|
||||
break;
|
||||
}
|
||||
found_match = TRUE;
|
||||
if (--*tomatch == 0)
|
||||
break;
|
||||
if ((flags & VGR_GLOBAL) == 0
|
||||
|| regmatch->endpos[0].lnum > 0)
|
||||
break;
|
||||
col = regmatch->endpos[0].col
|
||||
+ (col == regmatch->endpos[0].col);
|
||||
if (col > (colnr_T)STRLEN(ml_get_buf(buf, lnum, FALSE)))
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
char_u *str = ml_get_buf(buf, lnum, FALSE);
|
||||
int score;
|
||||
int_u matches[MAX_FUZZY_MATCHES];
|
||||
int_u sz = sizeof(matches) / sizeof(matches[0]);
|
||||
|
||||
// Fuzzy string match
|
||||
while (fuzzy_match(str + col, spat, FALSE, &score, matches, sz) > 0)
|
||||
{
|
||||
// Pass the buffer number so that it gets used even for a
|
||||
// dummy buffer, unless duplicate_name is set, then the
|
||||
// buffer will be wiped out below.
|
||||
if (qf_add_entry(qfl,
|
||||
NULL, // dir
|
||||
fname,
|
||||
NULL,
|
||||
duplicate_name ? 0 : buf->b_fnum,
|
||||
str,
|
||||
lnum,
|
||||
matches[0] + col + 1,
|
||||
FALSE, // vis_col
|
||||
NULL, // search pattern
|
||||
0, // nr
|
||||
0, // type
|
||||
TRUE // valid
|
||||
) == QF_FAIL)
|
||||
{
|
||||
got_int = TRUE;
|
||||
break;
|
||||
}
|
||||
found_match = TRUE;
|
||||
if (--*tomatch == 0)
|
||||
break;
|
||||
if ((flags & VGR_GLOBAL) == 0)
|
||||
break;
|
||||
col = matches[pat_len - 1] + col + 1;
|
||||
if (col > (colnr_T)STRLEN(str))
|
||||
break;
|
||||
}
|
||||
found_match = TRUE;
|
||||
if (--*tomatch == 0)
|
||||
break;
|
||||
if ((flags & VGR_GLOBAL) == 0
|
||||
|| regmatch->endpos[0].lnum > 0)
|
||||
break;
|
||||
col = regmatch->endpos[0].col
|
||||
+ (col == regmatch->endpos[0].col);
|
||||
if (col > (colnr_T)STRLEN(ml_get_buf(buf, lnum, FALSE)))
|
||||
break;
|
||||
}
|
||||
line_breakcheck();
|
||||
if (got_int)
|
||||
@@ -6163,7 +6210,7 @@ vgr_process_files(
|
||||
// Try for a match in all lines of the buffer.
|
||||
// For ":1vimgrep" look for first match only.
|
||||
found_match = vgr_match_buflines(qf_get_curlist(qi),
|
||||
fname, buf, &cmd_args->regmatch,
|
||||
fname, buf, cmd_args->spat, &cmd_args->regmatch,
|
||||
&cmd_args->tomatch, duplicate_name, cmd_args->flags);
|
||||
|
||||
if (using_dummy)
|
||||
|
||||
@@ -4764,7 +4764,7 @@ regtry(
|
||||
|
||||
/*
|
||||
* Match a regexp against a string ("line" points to the string) or multiple
|
||||
* lines ("line" is NULL, use reg_getline()).
|
||||
* lines (if "line" is NULL, use reg_getline()).
|
||||
* Returns 0 for failure, number of lines contained in the match otherwise.
|
||||
*/
|
||||
static long
|
||||
|
||||
@@ -7287,7 +7287,7 @@ nfa_regtry(
|
||||
|
||||
/*
|
||||
* Match a regexp against a string ("line" points to the string) or multiple
|
||||
* lines ("line" is NULL, use reg_getline()).
|
||||
* lines (if "line" is NULL, use reg_getline()).
|
||||
*
|
||||
* Returns <= 0 for failure, number of lines contained in the match otherwise.
|
||||
*/
|
||||
|
||||
38
src/search.c
38
src/search.c
@@ -4285,10 +4285,6 @@ typedef struct
|
||||
#define SCORE_NONE -9999
|
||||
|
||||
#define FUZZY_MATCH_RECURSION_LIMIT 10
|
||||
// Maximum number of characters that can be fuzzy matched
|
||||
#define MAXMATCHES 256
|
||||
|
||||
typedef int_u matchidx_T;
|
||||
|
||||
/*
|
||||
* Compute a score for a fuzzy matched string. The matching character locations
|
||||
@@ -4298,7 +4294,7 @@ typedef int_u matchidx_T;
|
||||
fuzzy_match_compute_score(
|
||||
char_u *str,
|
||||
int strSz,
|
||||
matchidx_T *matches,
|
||||
int_u *matches,
|
||||
int numMatches)
|
||||
{
|
||||
int score;
|
||||
@@ -4306,7 +4302,7 @@ fuzzy_match_compute_score(
|
||||
int unmatched;
|
||||
int i;
|
||||
char_u *p = str;
|
||||
matchidx_T sidx = 0;
|
||||
int_u sidx = 0;
|
||||
|
||||
// Initialize score
|
||||
score = 100;
|
||||
@@ -4324,11 +4320,11 @@ fuzzy_match_compute_score(
|
||||
// Apply ordering bonuses
|
||||
for (i = 0; i < numMatches; ++i)
|
||||
{
|
||||
matchidx_T currIdx = matches[i];
|
||||
int_u currIdx = matches[i];
|
||||
|
||||
if (i > 0)
|
||||
{
|
||||
matchidx_T prevIdx = matches[i - 1];
|
||||
int_u prevIdx = matches[i - 1];
|
||||
|
||||
// Sequential
|
||||
if (currIdx == (prevIdx + 1))
|
||||
@@ -4386,19 +4382,19 @@ fuzzy_match_compute_score(
|
||||
fuzzy_match_recursive(
|
||||
char_u *fuzpat,
|
||||
char_u *str,
|
||||
matchidx_T strIdx,
|
||||
int_u strIdx,
|
||||
int *outScore,
|
||||
char_u *strBegin,
|
||||
int strLen,
|
||||
matchidx_T *srcMatches,
|
||||
matchidx_T *matches,
|
||||
int_u *srcMatches,
|
||||
int_u *matches,
|
||||
int maxMatches,
|
||||
int nextMatch,
|
||||
int *recursionCount)
|
||||
{
|
||||
// Recursion params
|
||||
int recursiveMatch = FALSE;
|
||||
matchidx_T bestRecursiveMatches[MAXMATCHES];
|
||||
int_u bestRecursiveMatches[MAX_FUZZY_MATCHES];
|
||||
int bestRecursiveScore = 0;
|
||||
int first_match;
|
||||
int matched;
|
||||
@@ -4409,7 +4405,7 @@ fuzzy_match_recursive(
|
||||
return 0;
|
||||
|
||||
// Detect end of strings
|
||||
if (*fuzpat == '\0' || *str == '\0')
|
||||
if (*fuzpat == NUL || *str == NUL)
|
||||
return 0;
|
||||
|
||||
// Loop through fuzpat and str looking for a match
|
||||
@@ -4425,7 +4421,7 @@ fuzzy_match_recursive(
|
||||
// Found match
|
||||
if (vim_tolower(c1) == vim_tolower(c2))
|
||||
{
|
||||
matchidx_T recursiveMatches[MAXMATCHES];
|
||||
int_u recursiveMatches[MAX_FUZZY_MATCHES];
|
||||
int recursiveScore = 0;
|
||||
char_u *next_char;
|
||||
|
||||
@@ -4455,7 +4451,7 @@ fuzzy_match_recursive(
|
||||
if (!recursiveMatch || recursiveScore > bestRecursiveScore)
|
||||
{
|
||||
memcpy(bestRecursiveMatches, recursiveMatches,
|
||||
MAXMATCHES * sizeof(recursiveMatches[0]));
|
||||
MAX_FUZZY_MATCHES * sizeof(recursiveMatches[0]));
|
||||
bestRecursiveScore = recursiveScore;
|
||||
}
|
||||
recursiveMatch = TRUE;
|
||||
@@ -4506,19 +4502,19 @@ fuzzy_match_recursive(
|
||||
* normalized and varies with pattern.
|
||||
* Recursion is limited internally (default=10) to prevent degenerate cases
|
||||
* (pat_arg="aaaaaa" str="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").
|
||||
* Uses char_u for match indices. Therefore patterns are limited to MAXMATCHES
|
||||
* characters.
|
||||
* Uses char_u for match indices. Therefore patterns are limited to
|
||||
* MAX_FUZZY_MATCHES characters.
|
||||
*
|
||||
* Returns TRUE if 'pat_arg' matches 'str'. Also returns the match score in
|
||||
* 'outScore' and the matching character positions in 'matches'.
|
||||
*/
|
||||
static int
|
||||
int
|
||||
fuzzy_match(
|
||||
char_u *str,
|
||||
char_u *pat_arg,
|
||||
int matchseq,
|
||||
int *outScore,
|
||||
matchidx_T *matches,
|
||||
int_u *matches,
|
||||
int maxMatches)
|
||||
{
|
||||
int recursionCount = 0;
|
||||
@@ -4630,7 +4626,7 @@ fuzzy_match_in_list(
|
||||
listitem_T *li;
|
||||
long i = 0;
|
||||
int found_match = FALSE;
|
||||
matchidx_T matches[MAXMATCHES];
|
||||
int_u matches[MAX_FUZZY_MATCHES];
|
||||
|
||||
len = list_len(items);
|
||||
if (len == 0)
|
||||
@@ -4847,7 +4843,7 @@ do_fuzzymatch(typval_T *argvars, typval_T *rettv, int retmatchpos)
|
||||
return;
|
||||
}
|
||||
}
|
||||
if ((di = dict_find(d, (char_u *)"matchseq", -1)) != NULL)
|
||||
if (dict_find(d, (char_u *)"matchseq", -1) != NULL)
|
||||
matchseq = TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -456,11 +456,19 @@ put_view(
|
||||
|
||||
// Restore the cursor line in the file and relatively in the
|
||||
// window. Don't use "G", it changes the jumplist.
|
||||
if (fprintf(fd, "let s:l = %ld - ((%ld * winheight(0) + %ld) / %ld)",
|
||||
if (wp->w_height <= 0)
|
||||
{
|
||||
if (fprintf(fd, "let s:l = %ld", (long)wp->w_cursor.lnum) < 0)
|
||||
return FAIL;
|
||||
}
|
||||
else if (fprintf(fd,
|
||||
"let s:l = %ld - ((%ld * winheight(0) + %ld) / %ld)",
|
||||
(long)wp->w_cursor.lnum,
|
||||
(long)(wp->w_cursor.lnum - wp->w_topline),
|
||||
(long)wp->w_height / 2, (long)wp->w_height) < 0
|
||||
|| put_eol(fd) == FAIL
|
||||
(long)wp->w_height / 2, (long)wp->w_height) < 0)
|
||||
return FAIL;
|
||||
|
||||
if (put_eol(fd) == FAIL
|
||||
|| put_line(fd, "if s:l < 1 | let s:l = 1 | endif") == FAIL
|
||||
|| put_line(fd, "keepjumps exe s:l") == FAIL
|
||||
|| put_line(fd, "normal! zt") == FAIL
|
||||
|
||||
@@ -473,6 +473,7 @@ term_start(
|
||||
ga_init2(&term->tl_scrollback_postponed, sizeof(sb_line_T), 300);
|
||||
ga_init2(&term->tl_osc_buf, sizeof(char), 300);
|
||||
|
||||
setpcmark();
|
||||
CLEAR_FIELD(split_ea);
|
||||
if (opt->jo_curwin)
|
||||
{
|
||||
|
||||
@@ -21,6 +21,8 @@ func PythonProg()
|
||||
let s:python = 'python'
|
||||
elseif has('win32')
|
||||
" Use Python Launcher for Windows (py.exe) if available.
|
||||
" NOTE: if you get a "Python was not found" error, disable the Python
|
||||
" shortcuts in "Windows menu / Settings / Manage App Execution Aliases".
|
||||
if executable('py.exe')
|
||||
let s:python = 'py.exe'
|
||||
elseif executable('python.exe')
|
||||
|
||||
@@ -319,6 +319,61 @@ func Test_confirm_q_wq()
|
||||
call delete('Xfoo')
|
||||
endfunc
|
||||
|
||||
func Test_confirm_write_ro()
|
||||
CheckNotGui
|
||||
CheckRunVimInTerminal
|
||||
|
||||
call writefile(['foo'], 'Xconfirm_write_ro')
|
||||
let lines =<< trim END
|
||||
set nobackup ff=unix cmdheight=2
|
||||
edit Xconfirm_write_ro
|
||||
norm Abar
|
||||
END
|
||||
call writefile(lines, 'Xscript')
|
||||
let buf = RunVimInTerminal('-S Xscript', {'rows': 20})
|
||||
|
||||
" Try to write with 'ro' option.
|
||||
call term_sendkeys(buf, ":set ro | confirm w\n")
|
||||
call WaitForAssert({-> assert_match("^'readonly' option is set for \"Xconfirm_write_ro\"\. *$",
|
||||
\ term_getline(buf, 18))}, 1000)
|
||||
call WaitForAssert({-> assert_match('^Do you wish to write anyway? *$',
|
||||
\ term_getline(buf, 19))}, 1000)
|
||||
call WaitForAssert({-> assert_match('^(Y)es, \[N\]o: *$', term_getline(buf, 20))}, 1000)
|
||||
call term_sendkeys(buf, 'N')
|
||||
call WaitForAssert({-> assert_match('^ *$', term_getline(buf, 19))}, 1000)
|
||||
call WaitForAssert({-> assert_match('.* All$', term_getline(buf, 20))}, 1000)
|
||||
call assert_equal(['foo'], readfile('Xconfirm_write_ro'))
|
||||
|
||||
call term_sendkeys(buf, ":confirm w\n")
|
||||
call WaitForAssert({-> assert_match("^'readonly' option is set for \"Xconfirm_write_ro\"\. *$",
|
||||
\ term_getline(buf, 18))}, 1000)
|
||||
call WaitForAssert({-> assert_match('^Do you wish to write anyway? *$',
|
||||
\ term_getline(buf, 19))}, 1000)
|
||||
call WaitForAssert({-> assert_match('^(Y)es, \[N\]o: *$', term_getline(buf, 20))}, 1000)
|
||||
call term_sendkeys(buf, 'Y')
|
||||
call WaitForAssert({-> assert_match('^"Xconfirm_write_ro" 1L, 7B written$',
|
||||
\ term_getline(buf, 19))}, 1000)
|
||||
call assert_equal(['foobar'], readfile('Xconfirm_write_ro'))
|
||||
|
||||
" Try to write with read-only file permissions.
|
||||
call setfperm('Xconfirm_write_ro', 'r--r--r--')
|
||||
call term_sendkeys(buf, ":set noro | undo | confirm w\n")
|
||||
call WaitForAssert({-> assert_match("^File permissions of \"Xconfirm_write_ro\" are read-only\. *$",
|
||||
\ term_getline(buf, 17))}, 1000)
|
||||
call WaitForAssert({-> assert_match('^It may still be possible to write it\. *$',
|
||||
\ term_getline(buf, 18))}, 1000)
|
||||
call WaitForAssert({-> assert_match('^Do you wish to try? *$', term_getline(buf, 19))}, 1000)
|
||||
call WaitForAssert({-> assert_match('^(Y)es, \[N\]o: *$', term_getline(buf, 20))}, 1000)
|
||||
call term_sendkeys(buf, 'Y')
|
||||
call WaitForAssert({-> assert_match('^"Xconfirm_write_ro" 1L, 4B written$',
|
||||
\ term_getline(buf, 19))}, 1000)
|
||||
call assert_equal(['foo'], readfile('Xconfirm_write_ro'))
|
||||
|
||||
call StopVimInTerminal(buf)
|
||||
call delete('Xscript')
|
||||
call delete('Xconfirm_write_ro')
|
||||
endfunc
|
||||
|
||||
" Test for the :print command
|
||||
func Test_print_cmd()
|
||||
call assert_fails('print', 'E749:')
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
" Test for :execute, :while and :if
|
||||
" Test for :execute, :while, :for and :if
|
||||
|
||||
function Test_exec_while_if()
|
||||
func Test_exec_while_if()
|
||||
new
|
||||
|
||||
let i = 0
|
||||
@@ -50,6 +50,6 @@ function Test_exec_while_if()
|
||||
\ "7x999999999888888887777777666666555554444333221",
|
||||
\ "8",
|
||||
\ "9x"], getline(1, 10))
|
||||
endfunction
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
||||
@@ -55,7 +55,12 @@ func Test_function_lists()
|
||||
" Verify that the ":help functions" list is complete and in ASCII order.
|
||||
|
||||
enew!
|
||||
read ../../runtime/doc/eval.txt
|
||||
if filereadable('../../doc/eval.txt')
|
||||
" unpacked MS-Windows zip archive
|
||||
read ../../doc/eval.txt
|
||||
else
|
||||
read ../../runtime/doc/eval.txt
|
||||
endif
|
||||
call search('\*functions\*$')
|
||||
call search('^USAGE')
|
||||
1,.d
|
||||
@@ -75,7 +80,12 @@ func Test_function_lists()
|
||||
" Verify that the ":help function-list" list is complete.
|
||||
|
||||
enew!
|
||||
read ../../runtime/doc/usr_41.txt
|
||||
if filereadable('../../doc/usr_41.txt')
|
||||
" unpacked MS-Windows zip archive
|
||||
read ../../doc/usr_41.txt
|
||||
else
|
||||
read ../../runtime/doc/usr_41.txt
|
||||
endif
|
||||
call search('\*function-list\*$')
|
||||
1,.d
|
||||
call search('^==*$')
|
||||
|
||||
@@ -1402,4 +1402,13 @@ func Test_script_local_remap()
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
func Test_abbreviate_multi_byte()
|
||||
new
|
||||
iabbrev foo bar
|
||||
call feedkeys("ifoo…\<Esc>", 'xt')
|
||||
call assert_equal("bar…", getline(1))
|
||||
iunabbrev foo
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
||||
@@ -179,6 +179,20 @@ func Test_mksession_large_winheight()
|
||||
call delete('Xtest_mks_winheight.out')
|
||||
endfunc
|
||||
|
||||
func Test_mksession_zero_winheight()
|
||||
set winminheight=0
|
||||
edit SomeFile
|
||||
split
|
||||
wincmd _
|
||||
mksession! Xtest_mks_zero
|
||||
set winminheight&
|
||||
let text = readfile('Xtest_mks_zero')->join()
|
||||
call delete('Xtest_mks_zero')
|
||||
close
|
||||
" check there is no divide by zero
|
||||
call assert_notmatch('/ 0[^0-9]', text)
|
||||
endfunc
|
||||
|
||||
func Test_mksession_rtp()
|
||||
" TODO: fix problem with backslashes on Win32
|
||||
CheckNotMSWindows
|
||||
|
||||
@@ -32,7 +32,7 @@ func s:setup_commands(cchar)
|
||||
command! -count -nargs=* -bang Xnfile <mods><count>cnfile<bang> <args>
|
||||
command! -nargs=* -bang Xpfile <mods>cpfile<bang> <args>
|
||||
command! -nargs=* Xexpr <mods>cexpr <args>
|
||||
command! -count -nargs=* Xvimgrep <mods> <count>vimgrep <args>
|
||||
command! -count=999 -nargs=* Xvimgrep <mods> <count>vimgrep <args>
|
||||
command! -nargs=* Xvimgrepadd <mods> vimgrepadd <args>
|
||||
command! -nargs=* Xgrep <mods> grep <args>
|
||||
command! -nargs=* Xgrepadd <mods> grepadd <args>
|
||||
@@ -69,7 +69,7 @@ func s:setup_commands(cchar)
|
||||
command! -count -nargs=* -bang Xnfile <mods><count>lnfile<bang> <args>
|
||||
command! -nargs=* -bang Xpfile <mods>lpfile<bang> <args>
|
||||
command! -nargs=* Xexpr <mods>lexpr <args>
|
||||
command! -count -nargs=* Xvimgrep <mods> <count>lvimgrep <args>
|
||||
command! -count=999 -nargs=* Xvimgrep <mods> <count>lvimgrep <args>
|
||||
command! -nargs=* Xvimgrepadd <mods> lvimgrepadd <args>
|
||||
command! -nargs=* Xgrep <mods> lgrep <args>
|
||||
command! -nargs=* Xgrepadd <mods> lgrepadd <args>
|
||||
@@ -5372,4 +5372,50 @@ func Test_vimgrep_noswapfile()
|
||||
set swapfile
|
||||
endfunc
|
||||
|
||||
" Test for the :vimgrep 'f' flag (fuzzy match)
|
||||
func Xvimgrep_fuzzy_match(cchar)
|
||||
call s:setup_commands(a:cchar)
|
||||
|
||||
Xvimgrep /three one/f Xfile*
|
||||
let l = g:Xgetlist()
|
||||
call assert_equal(2, len(l))
|
||||
call assert_equal(['Xfile1', 1, 9, 'one two three'],
|
||||
\ [bufname(l[0].bufnr), l[0].lnum, l[0].col, l[0].text])
|
||||
call assert_equal(['Xfile2', 2, 1, 'three one two'],
|
||||
\ [bufname(l[1].bufnr), l[1].lnum, l[1].col, l[1].text])
|
||||
|
||||
Xvimgrep /the/f Xfile*
|
||||
let l = g:Xgetlist()
|
||||
call assert_equal(3, len(l))
|
||||
call assert_equal(['Xfile1', 1, 9, 'one two three'],
|
||||
\ [bufname(l[0].bufnr), l[0].lnum, l[0].col, l[0].text])
|
||||
call assert_equal(['Xfile2', 2, 1, 'three one two'],
|
||||
\ [bufname(l[1].bufnr), l[1].lnum, l[1].col, l[1].text])
|
||||
call assert_equal(['Xfile2', 4, 4, 'aaathreeaaa'],
|
||||
\ [bufname(l[2].bufnr), l[2].lnum, l[2].col, l[2].text])
|
||||
|
||||
Xvimgrep /aaa/fg Xfile*
|
||||
let l = g:Xgetlist()
|
||||
call assert_equal(4, len(l))
|
||||
call assert_equal(['Xfile1', 2, 1, 'aaaaaa'],
|
||||
\ [bufname(l[0].bufnr), l[0].lnum, l[0].col, l[0].text])
|
||||
call assert_equal(['Xfile1', 2, 4, 'aaaaaa'],
|
||||
\ [bufname(l[1].bufnr), l[1].lnum, l[1].col, l[1].text])
|
||||
call assert_equal(['Xfile2', 4, 1, 'aaathreeaaa'],
|
||||
\ [bufname(l[2].bufnr), l[2].lnum, l[2].col, l[2].text])
|
||||
call assert_equal(['Xfile2', 4, 9, 'aaathreeaaa'],
|
||||
\ [bufname(l[3].bufnr), l[3].lnum, l[3].col, l[3].text])
|
||||
|
||||
call assert_fails('Xvimgrep /xyz/fg Xfile*', 'E480:')
|
||||
endfunc
|
||||
|
||||
func Test_vimgrep_fuzzy_match()
|
||||
call writefile(['one two three', 'aaaaaa'], 'Xfile1')
|
||||
call writefile(['one', 'three one two', 'two', 'aaathreeaaa'], 'Xfile2')
|
||||
call Xvimgrep_fuzzy_match('c')
|
||||
call Xvimgrep_fuzzy_match('l')
|
||||
call delete('Xfile1')
|
||||
call delete('Xfile2')
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
||||
@@ -926,4 +926,13 @@ func Test_substitute_multiline_submatch()
|
||||
close!
|
||||
endfunc
|
||||
|
||||
func Test_substitute_skipped_range()
|
||||
new
|
||||
if 0
|
||||
/1/5/2/2/\n
|
||||
endif
|
||||
call assert_equal([0, 1, 1, 0, 1], getcurpos())
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
||||
@@ -2029,5 +2029,12 @@ func Test_terminal_nested_autocmd()
|
||||
augroup END
|
||||
endfunc
|
||||
|
||||
func Test_terminal_adds_jump()
|
||||
clearjumps
|
||||
call term_start("ls", #{curwin: 1})
|
||||
call assert_equal(1, getjumplist()[0]->len())
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
||||
@@ -1768,14 +1768,14 @@ def Test_expr_error_no_assign()
|
||||
var x = 1 / 0
|
||||
echo x
|
||||
END
|
||||
CheckScriptFailureList(lines, ['E1154:', 'E121:'])
|
||||
CheckScriptFailure(lines, 'E1154:')
|
||||
|
||||
lines =<< trim END
|
||||
vim9script
|
||||
var x = 1 % 0
|
||||
echo x
|
||||
END
|
||||
CheckScriptFailureList(lines, ['E1154:', 'E121:'])
|
||||
CheckScriptFailure(lines, 'E1154:')
|
||||
|
||||
lines =<< trim END
|
||||
var x: string 'string'
|
||||
|
||||
@@ -1887,6 +1887,7 @@ enddef
|
||||
def Test_expr7_lambda()
|
||||
var lines =<< trim END
|
||||
var La = () => 'result'
|
||||
# comment
|
||||
assert_equal('result', La())
|
||||
assert_equal([1, 3, 5], [1, 2, 3]->map((key, val) => key + val))
|
||||
|
||||
@@ -1897,6 +1898,12 @@ def Test_expr7_lambda()
|
||||
)
|
||||
assert_equal([{}, {111: 111}, {}], dll)
|
||||
|
||||
# comment halfway an expression
|
||||
var Ref = () => 4
|
||||
# comment
|
||||
+ 6
|
||||
assert_equal(10, Ref())
|
||||
|
||||
ll = range(3)
|
||||
map(ll, (k, v) => v == 8 || v
|
||||
== 9
|
||||
|
||||
@@ -2592,6 +2592,7 @@ enddef
|
||||
def Test_nested_lambda_in_closure()
|
||||
var lines =<< trim END
|
||||
vim9script
|
||||
command WriteDone writefile(['Done'], 'XnestedDone')
|
||||
def Outer()
|
||||
def g:Inner()
|
||||
echo map([1, 2, 3], {_, v -> v + 1})
|
||||
@@ -2599,10 +2600,9 @@ def Test_nested_lambda_in_closure()
|
||||
g:Inner()
|
||||
enddef
|
||||
defcompile
|
||||
writefile(['Done'], 'XnestedDone')
|
||||
quit
|
||||
# not reached
|
||||
END
|
||||
if !RunVim([], lines, '--clean')
|
||||
if !RunVim([], lines, '--clean -c WriteDone -c quit')
|
||||
return
|
||||
endif
|
||||
assert_equal(['Done'], readfile('XnestedDone'))
|
||||
|
||||
@@ -854,6 +854,20 @@ def Test_error_in_nested_function()
|
||||
assert_equal(0, g:test_var)
|
||||
enddef
|
||||
|
||||
def Test_abort_after_error()
|
||||
var lines =<< trim END
|
||||
vim9script
|
||||
while true
|
||||
echo notfound
|
||||
endwhile
|
||||
g:gotthere = true
|
||||
END
|
||||
g:gotthere = false
|
||||
CheckScriptFailure(lines, 'E121:')
|
||||
assert_false(g:gotthere)
|
||||
unlet g:gotthere
|
||||
enddef
|
||||
|
||||
def Test_cexpr_vimscript()
|
||||
# only checks line continuation
|
||||
set errorformat=File\ %f\ line\ %l
|
||||
@@ -3361,6 +3375,7 @@ def Test_vim9_autoload()
|
||||
return 'test'
|
||||
enddef
|
||||
g:some#name = 'name'
|
||||
g:some#dict = {key: 'value'}
|
||||
|
||||
def some#varargs(a1: string, ...l: list<string>): string
|
||||
return a1 .. l[0] .. l[1]
|
||||
@@ -3374,6 +3389,7 @@ def Test_vim9_autoload()
|
||||
|
||||
assert_equal('test', g:some#gettest())
|
||||
assert_equal('name', g:some#name)
|
||||
assert_equal('value', g:some#dict.key)
|
||||
g:some#other = 'other'
|
||||
assert_equal('other', g:some#other)
|
||||
|
||||
|
||||
@@ -750,6 +750,40 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
2829,
|
||||
/**/
|
||||
2828,
|
||||
/**/
|
||||
2827,
|
||||
/**/
|
||||
2826,
|
||||
/**/
|
||||
2825,
|
||||
/**/
|
||||
2824,
|
||||
/**/
|
||||
2823,
|
||||
/**/
|
||||
2822,
|
||||
/**/
|
||||
2821,
|
||||
/**/
|
||||
2820,
|
||||
/**/
|
||||
2819,
|
||||
/**/
|
||||
2818,
|
||||
/**/
|
||||
2817,
|
||||
/**/
|
||||
2816,
|
||||
/**/
|
||||
2815,
|
||||
/**/
|
||||
2814,
|
||||
/**/
|
||||
2813,
|
||||
/**/
|
||||
2812,
|
||||
/**/
|
||||
|
||||
@@ -2457,6 +2457,7 @@ typedef enum {
|
||||
// flags for skip_vimgrep_pat()
|
||||
#define VGR_GLOBAL 1
|
||||
#define VGR_NOJUMP 2
|
||||
#define VGR_FUZZY 4
|
||||
|
||||
// behavior for bad character, "++bad=" argument
|
||||
#define BAD_REPLACE '?' // replace it with '?' (default)
|
||||
@@ -2711,4 +2712,7 @@ long elapsed(DWORD start_tick);
|
||||
#define EVAL_VAR_NOAUTOLOAD 2 // do not use script autoloading
|
||||
#define EVAL_VAR_IMPORT 4 // may return special variable for import
|
||||
|
||||
// Maximum number of characters that can be fuzzy matched
|
||||
#define MAX_FUZZY_MATCHES 256
|
||||
|
||||
#endif // VIM__H
|
||||
|
||||
@@ -543,11 +543,11 @@ func_return(ectx_T *ectx)
|
||||
estack_T *entry;
|
||||
int prev_dfunc_idx = STACK_TV(ectx->ec_frame_idx
|
||||
+ STACK_FRAME_FUNC_OFF)->vval.v_number;
|
||||
funclocal_T *floc;
|
||||
#ifdef FEAT_PROFILE
|
||||
dfunc_T *prev_dfunc = ((dfunc_T *)def_functions.ga_data)
|
||||
+ prev_dfunc_idx;
|
||||
funclocal_T *floc;
|
||||
|
||||
#ifdef FEAT_PROFILE
|
||||
if (do_profiling == PROF_YES)
|
||||
{
|
||||
ufunc_T *caller = prev_dfunc->df_ufunc;
|
||||
|
||||
Reference in New Issue
Block a user