diff options
69 files changed, 3601 insertions, 1408 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 0f8978d74f..398dfdc303 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -153,6 +153,12 @@ endif() if(BUSTED_PRG) get_property(TEST_INCLUDE_DIRS DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES) + + # Set policy CMP0026 to OLD so we avoid CMake warnings on newer + # versions of cmake. + if(POLICY CMP0026) + cmake_policy(SET CMP0026 OLD) + endif() get_target_property(TEST_LIBNVIM_PATH nvim-test LOCATION) configure_file( @@ -171,7 +177,8 @@ if(BUSTED_PRG) DEPENDS nvim-test unittest-headers) endif() -install(DIRECTORY runtime DESTINATION share/nvim/) +install(DIRECTORY runtime DESTINATION share/nvim) +install(SCRIPT ${CMAKE_MODULE_PATH}/GenerateHelptags.cmake) # Unfortunately, the below does not work under Ninja. Ninja doesn't use a # pseudo-tty when launching processes, because it can put many jobs in parallel @@ -10,7 +10,7 @@ [](https://waffle.io/neovim/neovim) [](https://coveralls.io/r/neovim/neovim) [](https://scan.coverity.com/projects/2227) -[](http://neovim.org/doc/build-reports/clang) +[](http://neovim.org/doc/reports/clang) [](https://www.bountysource.com/trackers/461131-neovim?utm_source=461131&utm_medium=shield&utm_campaign=TRACKER_BADGE) Neovim is a project that seeks to aggressively refactor Vim in order to: diff --git a/cmake/GenerateHelptags.cmake b/cmake/GenerateHelptags.cmake new file mode 100644 index 0000000000..4101ff6cbf --- /dev/null +++ b/cmake/GenerateHelptags.cmake @@ -0,0 +1,20 @@ +file(TO_CMAKE_PATH + "$ENV{DESTDIR}/${CMAKE_INSTALL_PREFIX}/share/nvim/runtime/doc" + HELPTAGS_WORKING_DIRECTORY) + +message(STATUS "Generating helptags in ${HELPTAGS_WORKING_DIRECTORY}.") + +execute_process( + COMMAND "${CMAKE_CURRENT_BINARY_DIR}/bin/nvim" + -u NONE + -esX + -c "helptags ++t ." + -c quit + WORKING_DIRECTORY "${HELPTAGS_WORKING_DIRECTORY}" + OUTPUT_VARIABLE err + ERROR_VARIABLE err + RESULT_VARIABLE res) + +if(NOT res EQUAL 0) + message(FATAL_ERROR "Generating helptags failed: ${err}") +endif() diff --git a/runtime/autoload/ada.vim b/runtime/autoload/ada.vim index 1f8234a575..cc5191fa43 100644 --- a/runtime/autoload/ada.vim +++ b/runtime/autoload/ada.vim @@ -447,7 +447,7 @@ function ada#Switch_Session (New_Session) if a:New_Session != v:this_session " - " We actualy got a new session - otherwise there + " We actually got a new session - otherwise there " is nothing to do. " if strlen (v:this_session) > 0 diff --git a/runtime/autoload/sqlcomplete.vim b/runtime/autoload/sqlcomplete.vim index 9326c15bb3..4a8863e15f 100644 --- a/runtime/autoload/sqlcomplete.vim +++ b/runtime/autoload/sqlcomplete.vim @@ -588,7 +588,7 @@ function! sqlcomplete#DrillIntoTable() else " If the popup is not visible, simple perform the normal " key behaviour. - " Must use exec since they key must be preceeded by "\" + " Must use exec since the key must be preceded by "\" " or feedkeys will simply push each character of the string " rather than the "key press". exec 'call feedkeys("\'.g:ftplugin_sql_omni_key_right.'", "n")' @@ -605,7 +605,7 @@ function! sqlcomplete#DrillOutOfColumns() else " If the popup is not visible, simple perform the normal " key behaviour. - " Must use exec since they key must be preceeded by "\" + " Must use exec since the key must be preceded by "\" " or feedkeys will simply push each character of the string " rather than the "key press". exec 'call feedkeys("\'.g:ftplugin_sql_omni_key_left.'", "n")' @@ -831,7 +831,7 @@ function! s:SQLCGetColumns(table_name, list_type) " Start characterwise visual mode " Advance right one character - " Search foward until one of the following: + " Search forward until one of the following: " 1. Another select/update/delete statement " 2. A ; at the end of a line (the delimiter) " 3. The end of the file (incase no delimiter) diff --git a/runtime/autoload/syntaxcomplete.vim b/runtime/autoload/syntaxcomplete.vim index a18c3c360c..0ce3e6e154 100644 --- a/runtime/autoload/syntaxcomplete.vim +++ b/runtime/autoload/syntaxcomplete.vim @@ -548,7 +548,7 @@ function! s:SyntaxCSyntaxGroupItems( group_name, syntax_full ) " let syn_list = substitute( @l, '^.*xxx\s*\%(contained\s*\)\?', "", '' ) " let syn_list = substitute( @l, '^.*xxx\s*', "", '' ) - " We only want the words for the lines begining with + " We only want the words for the lines beginning with " containedin, but there could be other items. " Tried to remove all lines that do not begin with contained diff --git a/runtime/compiler/checkstyle.vim b/runtime/compiler/checkstyle.vim index eac461bb2d..ccab3c585d 100644 --- a/runtime/compiler/checkstyle.vim +++ b/runtime/compiler/checkstyle.vim @@ -14,6 +14,6 @@ endif CompilerSet makeprg=java\ com.puppycrawl.tools.checkstyle.Main\ -f\ plain -" sample error: WebTable.java:282: '+=' is not preceeded with whitespace. +" sample error: WebTable.java:282: '+=' is not preceded with whitespace. " WebTable.java:201:1: '{' should be on the previous line. CompilerSet errorformat=%f:%l:%v:\ %m,%f:%l:\ %m,%-G%.%# diff --git a/runtime/doc/os_win32.txt b/runtime/doc/os_win32.txt index a01a06c8ec..22e763a08e 100644 --- a/runtime/doc/os_win32.txt +++ b/runtime/doc/os_win32.txt @@ -334,7 +334,7 @@ A. You have two possible solutions depending on what you want: :!start /min ctags -R . < When it has finished you should see file named "tags" in your current directory. You should notice the window title blinking on your taskbar. - This is more noticable for commands that take longer. + This is more noticeable for commands that take longer. Now delete the "tags" file and run this command: > :!start /b ctags -R . < You should have the same "tags" file, but this time there will be no diff --git a/runtime/indent/ada.vim b/runtime/indent/ada.vim index 03fbaa3a18..a553756715 100644 --- a/runtime/indent/ada.vim +++ b/runtime/indent/ada.vim @@ -219,7 +219,7 @@ function GetAdaIndent() " Move indent in twice (next 'when' will move back) let ind = ind + 2 * &sw elseif line =~ '^\s*end\s*record\>' - " Move indent back to tallying 'type' preceeding the 'record'. + " Move indent back to tallying 'type' preceding the 'record'. " Allow indent to be equal to 'end record's. let ind = s:MainBlockIndent( ind+&sw, lnum, 'type\>', '' ) elseif line =~ '\(^\s*new\>.*\)\@<!)\s*[;,]\s*$' diff --git a/runtime/syntax/asm68k.vim b/runtime/syntax/asm68k.vim index 8463e487e1..cd23517cad 100644 --- a/runtime/syntax/asm68k.vim +++ b/runtime/syntax/asm68k.vim @@ -223,7 +223,7 @@ syn match asm68kOperator "<>" " inequality syn match asm68kOperator "=" " must be before other ops containing '=' syn match asm68kOperator ">=" syn match asm68kOperator "<=" -syn match asm68kOperator "==" " operand existance - used in macro definitions +syn match asm68kOperator "==" " operand existence - used in macro definitions " Condition code style operators syn match asm68kOperator "<[CV][CS]>" diff --git a/runtime/syntax/aspvbs.vim b/runtime/syntax/aspvbs.vim index 07c129e463..f1435cb04b 100644 --- a/runtime/syntax/aspvbs.vim +++ b/runtime/syntax/aspvbs.vim @@ -40,7 +40,7 @@ syn match AspVBSVariableComplex contained "\<\(arr\|ary\|obj\)\u\w*" " Functions and methods that are in VB but will cause errors in an ASP page -" This is helpfull if your porting VB code to ASP +" This is helpful if you're porting VB code to ASP " I removed (Count, Item) because these are common variable names in AspVBScript syn keyword AspVBSError contained Val Str CVar CVDate DoEvents GoSub Return GoTo syn keyword AspVBSError contained Stop LinkExecute Add Type LinkPoke @@ -62,7 +62,7 @@ syn match AspVBSError contained "\<Option\s\+\(Base\|Compare\|Private\s\+Module\ syn match AspVBSError contained "Respon\?ce\.\S*" syn match AspVBSError contained "Respose\.\S*" " When I looked up the VBScript syntax it mentioned that Property Get/Set/Let -" statements are illegal, however, I have recived reports that they do work. +" statements are illegal, however, I have received reports that they do work. " So I commented it out for now. " syn match AspVBSError contained "\<Property\s\+\(Get\|Let\|Set\)\>" diff --git a/runtime/syntax/chill.vim b/runtime/syntax/chill.vim index ca00cd95e8..e5200fe722 100644 --- a/runtime/syntax/chill.vim +++ b/runtime/syntax/chill.vim @@ -27,7 +27,7 @@ syn keyword chillLogical NOT not syn keyword chillRepeat while WHILE for FOR do DO od OD TO to syn keyword chillProcess START start STACKSIZE stacksize PRIORITY priority THIS this STOP stop syn keyword chillBlock PROC proc PROCESS process -syn keyword chillSignal RECEIVE receive SEND send NONPERSISTENT nonpersistent PERSISTENT peristent SET set EVER ever +syn keyword chillSignal RECEIVE receive SEND send NONPERSISTENT nonpersistent PERSISTENT persistent SET set EVER ever syn keyword chillTodo contained TODO FIXME XXX diff --git a/runtime/syntax/clipper.vim b/runtime/syntax/clipper.vim index 1a10a2dca2..6ee3892845 100644 --- a/runtime/syntax/clipper.vim +++ b/runtime/syntax/clipper.vim @@ -109,7 +109,7 @@ else endif syntax match clipperCommentError "\*/" -" Lines beggining with an "*" are comments too +" Lines beginning with an "*" are comments too syntax match clipperComment "^\*.*" diff --git a/runtime/syntax/d.vim b/runtime/syntax/d.vim index 52c83bf913..07a299fa55 100644 --- a/runtime/syntax/d.vim +++ b/runtime/syntax/d.vim @@ -387,7 +387,7 @@ hi def link dPragmaIdentifier Identifier hi def link dExtern dExternal hi def link dExternIdentifier Identifier -" Marks contents of the asm statment body as special +" Marks contents of the asm statement body as special syn match dAsmStatement "\<asm\>" syn region dAsmBody start="asm[\n]*\s*{"hs=e+1 end="}"he=e-1 contains=dAsmStatement,dAsmOpCode,@dComment,DUserLabel diff --git a/runtime/syntax/dtrace.vim b/runtime/syntax/dtrace.vim index 2f2d6e2cc7..493de1ed0f 100644 --- a/runtime/syntax/dtrace.vim +++ b/runtime/syntax/dtrace.vim @@ -47,7 +47,7 @@ exec 'syn match dtraceProbe "'.s:oneProbe.'\%(,\_s*'.s:oneProbe.'\)*\ze\_s\%({\| " Also be careful not to eat `c = a / b; b = a / 2;`. We use the same " technique as the dtrace lexer: a predicate has to be followed by {, ;, or " EOF. Also note that dtrace doesn't allow an empty predicate // (we do). -" This regex doesn't allow a divison operator in the predicate. +" This regex doesn't allow a division operator in the predicate. " Make sure that this matches the empty predicate as well. " XXX: This doesn't work if followed by a comment. syn match dtracePredicate "/\*\@!\_[^/]*/\ze\_s*\%({\|;\|\%$\)" diff --git a/runtime/syntax/ia64.vim b/runtime/syntax/ia64.vim index f0d510b945..ebfdc95bae 100644 --- a/runtime/syntax/ia64.vim +++ b/runtime/syntax/ia64.vim @@ -56,7 +56,7 @@ syn keyword ia64opcode pshradd2 psub4 rfi rsm rum shl shladd shladdp4 syn keyword ia64opcode shrp ssm sub sum sync.i tak thash syn keyword ia64opcode tpa ttag xor -"put to override these being recognized as floats. They are orignally from masm.vim +"put to override these being recognized as floats. They are originally from masm.vim "put here to avoid confusion with float syn match ia64Directive "\.186" syn match ia64Directive "\.286" diff --git a/runtime/syntax/kix.vim b/runtime/syntax/kix.vim index 62dc3253e8..800e286042 100644 --- a/runtime/syntax/kix.vim +++ b/runtime/syntax/kix.vim @@ -10,7 +10,7 @@ " 26 April 2001: RMH " Removed development comments from distro version " Renamed "Kix*" to "kix*" for consistancy -" Changes made in preperation for VIM version 5.8/6.00 +" Changes made in preparation for VIM version 5.8/6.00 " TODO: " Handle arrays highlighting diff --git a/runtime/syntax/mel.vim b/runtime/syntax/mel.vim index dab894865c..a668e70378 100644 --- a/runtime/syntax/mel.vim +++ b/runtime/syntax/mel.vim @@ -18,7 +18,7 @@ if exists("mel_space_errors") sy match melSpaceError " \+\t"me=e-1 endif -" A bunch of usefull MEL keyworks +" A bunch of useful MEL keywords sy keyword melBoolean true false yes no on off sy keyword melFunction proc diff --git a/runtime/syntax/php.vim b/runtime/syntax/php.vim index f27d923400..26d60a9382 100644 --- a/runtime/syntax/php.vim +++ b/runtime/syntax/php.vim @@ -110,7 +110,7 @@ if exists( "php_htmlInStrings") syn cluster phpAddStrings add=@htmlTop endif -" make sure we can use \ at the begining of the line to do a continuation +" make sure we can use \ at the beginning of the line to do a continuation let s:cpo_save = &cpo set cpo&vim diff --git a/runtime/syntax/postscr.vim b/runtime/syntax/postscr.vim index fddfe4c947..8b051d33b3 100644 --- a/runtime/syntax/postscr.vim +++ b/runtime/syntax/postscr.vim @@ -503,11 +503,11 @@ if postscr_level == 2 || postscr_level == 3 " Page duplexing operators syn keyword postscrL2Operator duplexmode firstside newsheet setduplexmode settumble tumble -" Device compatability operators +" Device compatibility operators syn keyword postscrL2Operator devdismount devformat devmount devstatus syn keyword postscrL2Repeat devforall -" Imagesetter compatability operators +" Imagesetter compatibility operators syn keyword postscrL2Operator accuratescreens checkscreen pagemargin pageparams setaccuratescreens setpage syn keyword postscrL2Operator setpagemargin setpageparams diff --git a/runtime/syntax/redif.vim b/runtime/syntax/redif.vim index 1b83c07790..1a44a9f479 100644 --- a/runtime/syntax/redif.vim +++ b/runtime/syntax/redif.vim @@ -934,7 +934,7 @@ highlight redifFieldDeprecated term=undercurl cterm=undercurl gui=undercurl guis " Sync: The template-type (ReDIF-Paper, ReDIF-Archive, etc.) influences which " fields can follow. Thus sync must search backwards for it. " -" I would like to simply ask VIM to search backward for the first occurence of +" I would like to simply ask VIM to search backward for the first occurrence of " /^Template-Type:/, but it does not seem to be possible, so I have to start " from the beginning of the file... This might slow down a lot for files that " contain a lot of Template-Type statements. diff --git a/runtime/syntax/samba.vim b/runtime/syntax/samba.vim index dae4040ec5..93029cc202 100644 --- a/runtime/syntax/samba.vim +++ b/runtime/syntax/samba.vim @@ -55,7 +55,7 @@ syn keyword sambaKeyword contained only open oplock oplocks options order os syn keyword sambaKeyword contained output packet page panic passwd password syn keyword sambaKeyword contained passwords path permissions pipe port ports syn keyword sambaKeyword contained postexec postscript prediction preexec -syn keyword sambaKeyword contained prefered preferred preload preserve print +syn keyword sambaKeyword contained preferred preload preserve print syn keyword sambaKeyword contained printable printcap printer printers syn keyword sambaKeyword contained printing program protocol proxy public syn keyword sambaKeyword contained queuepause queueresume raw read readonly diff --git a/runtime/syntax/sather.vim b/runtime/syntax/sather.vim index 759591bf84..103cf0b8cd 100644 --- a/runtime/syntax/sather.vim +++ b/runtime/syntax/sather.vim @@ -4,7 +4,7 @@ " URL: http://www.fleiner.com/vim/syntax/sather.vim " Last Change: 2003 May 11 -" Sather is a OO-language developped at the International Computer Science +" Sather is a OO-language developed at the International Computer Science " Institute (ICSI) in Berkeley, CA. pSather is a parallel extension to Sather. " Homepage: http://www.icsi.berkeley.edu/~sather " Sather files use .sa as suffix diff --git a/runtime/syntax/specman.vim b/runtime/syntax/specman.vim index 3fb77a2afa..93fb4a86c6 100644 --- a/runtime/syntax/specman.vim +++ b/runtime/syntax/specman.vim @@ -111,8 +111,8 @@ syn region specmanString start=+"+ end=+"+ "********************************************************************** -" I took this section from c.vim but I didnt succeded to make it work -" ANY one who dare jumping to this deep watter is more than welocome! +" I took this section from c.vim, but I didn't succeed in making it work +" ANY one who dares to jump into this deep water is more than welcome! "********************************************************************** ""catch errors caused by wrong parenthesis and brackets diff --git a/runtime/syntax/spup.vim b/runtime/syntax/spup.vim index 07e9708eaa..8d7a9e525c 100644 --- a/runtime/syntax/spup.vim +++ b/runtime/syntax/spup.vim @@ -38,7 +38,7 @@ endif " one line comment syntax (# comments) " 1. allow appended code after comment, do not complain -" 2. show code beginnig with the second # as an error +" 2. show code beginning with the second # as an error " 3. show whole lines with more than one # as an error if !exists("oneline_comments") let oneline_comments = 2 diff --git a/runtime/syntax/tcl.vim b/runtime/syntax/tcl.vim index 3c598267dc..06629d077f 100644 --- a/runtime/syntax/tcl.vim +++ b/runtime/syntax/tcl.vim @@ -171,7 +171,7 @@ syn region tcltkCommand matchgroup=tcltkCommandColor start="\<format\>" matchgro " PACK " commands associated with pack -syn keyword tcltkPackSwitch contained forget info propogate slaves +syn keyword tcltkPackSwitch contained forget info propagate slaves syn keyword tcltkPackConfSwitch contained after anchor before expand fill in ipadx ipady padx pady side syn region tcltkCommand matchgroup=tcltkCommandColor start="\<pack\>" matchgroup=NONE skip="^\s*$" end="]\|[^\\]*\s*$"he=e-1 contains=tclLineContinue,tcltkPackSwitch,tcltkPackConf,tcltkPackConfSwitch,tclNumber,tclVarRef,tclString,tcltkCommand keepend diff --git a/scripts/genex_cmds.lua b/scripts/genex_cmds.lua new file mode 100644 index 0000000000..7fd258a6c3 --- /dev/null +++ b/scripts/genex_cmds.lua @@ -0,0 +1,87 @@ +local nvimsrcdir = arg[1] +local includedir = arg[2] +local autodir = arg[3] + +if nvimsrcdir == '--help' then + print ([[ +Usage: + lua genex_cmds.lua src/nvim build/include build/src/nvim/auto + +Will generate files build/include/ex_cmds_enum.generated.h with cmdidx_T +enum and build/src/nvim/auto/ex_cmds_defs.generated.h with main Ex commands +definitions. +]]) + os.exit(0) +end + +package.path = nvimsrcdir .. '/?.lua;' .. package.path + +local enumfname = includedir .. '/ex_cmds_enum.generated.h' +local defsfname = autodir .. '/ex_cmds_defs.generated.h' + +local enumfile = io.open(enumfname, 'w') +local defsfile = io.open(defsfname, 'w') + +local defs = require('ex_cmds') +local lastchar = nil + +local i +local cmd +local first = true +local prevfirstchar = nil + +local byte_a = string.byte('a') +local byte_z = string.byte('z') + +local cmdidxs = string.format([[ +static const cmdidx_T cmdidxs[%u] = { +]], byte_z - byte_a + 2) + +enumfile:write([[ +typedef enum CMD_index { +]]) +defsfile:write(string.format([[ +static CommandDefinition cmdnames[%u] = { +]], #defs)) +for i, cmd in ipairs(defs) do + local enumname = cmd.enum or ('CMD_' .. cmd.command) + firstchar = string.byte(cmd.command) + if firstchar ~= prevfirstchar then + if (not prevfirstchar + or (byte_a <= firstchar and firstchar <= byte_z) + or (byte_a <= prevfirstchar and prevfirstchar <= byte_z)) then + if not first then + cmdidxs = cmdidxs .. ',\n' + end + cmdidxs = cmdidxs .. ' ' .. enumname + end + prevfirstchar = firstchar + end + if first then + first = false + else + defsfile:write(',\n') + end + enumfile:write(' ' .. enumname .. ',\n') + defsfile:write(string.format([[ + [%s] = { + .cmd_name = (char_u *) "%s", + .cmd_func = &%s, + .cmd_argt = %uL + }]], enumname, cmd.command, cmd.func, cmd.flags)) +end +defsfile:write([[ + +}; +]]) +enumfile:write([[ + CMD_SIZE, + CMD_USER = -1, + CMD_USER_BUF = -2 +} cmdidx_T; +]]) +cmdidxs = cmdidxs .. [[ + +}; +]] +defsfile:write(cmdidxs) diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index 951cd9ded1..83de3347bd 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -7,6 +7,10 @@ set(MSGPACK_RPC_HEADER ${PROJECT_SOURCE_DIR}/src/nvim/os/msgpack_rpc.h) set(MSGPACK_DISPATCH ${GENERATED_DIR}/msgpack_dispatch.c) set(HEADER_GENERATOR ${PROJECT_SOURCE_DIR}/scripts/gendeclarations.lua) set(GENERATED_INCLUDES_DIR ${PROJECT_BINARY_DIR}/include) +set(GENERATED_EX_CMDS_ENUM ${GENERATED_INCLUDES_DIR}/ex_cmds_enum.generated.h) +set(GENERATED_EX_CMDS_DEFS ${GENERATED_DIR}/ex_cmds_defs.generated.h) +set(EX_CMDS_GENERATOR ${PROJECT_SOURCE_DIR}/scripts/genex_cmds.lua) +set(EX_CMDS_DEFS_FILE ${PROJECT_SOURCE_DIR}/src/nvim/ex_cmds.lua) include_directories(${GENERATED_DIR}) include_directories(${GENERATED_INCLUDES_DIR}) @@ -124,11 +128,20 @@ add_custom_command(OUTPUT ${MSGPACK_DISPATCH} ${API_HEADERS} ${MSGPACK_RPC_HEADER} ${DISPATCH_GENERATOR} - ) +) list(APPEND NEOVIM_GENERATED_SOURCES "${PROJECT_BINARY_DIR}/config/auto/pathdef.c" - "${MSGPACK_DISPATCH}") + "${MSGPACK_DISPATCH}" + "${GENERATED_EX_CMDS_ENUM}" + "${GENERATED_EX_CMDS_DEFS}" +) + +add_custom_command(OUTPUT ${GENERATED_EX_CMDS_ENUM} ${GENERATED_EX_CMDS_DEFS} + COMMAND ${LUA_PRG} ${EX_CMDS_GENERATOR} + ${PROJECT_SOURCE_DIR}/src/nvim ${GENERATED_INCLUDES_DIR} ${GENERATED_DIR} + DEPENDS ${EX_CMDS_GENERATOR} ${EX_CMDS_DEFS_FILE} +) # Our dependencies come first. diff --git a/src/nvim/api/window.c b/src/nvim/api/window.c index 548d8171a5..1ab441bed3 100644 --- a/src/nvim/api/window.c +++ b/src/nvim/api/window.c @@ -35,7 +35,7 @@ Buffer window_get_buffer(Window window, Error *err) /// @return the (row, col) tuple Position window_get_cursor(Window window, Error *err) { - Position rv = {.row = 0, .col = 0}; + Position rv = POSITION_INIT; win_T *win = find_window_by_handle(window, err); if (win) { @@ -245,7 +245,7 @@ void window_set_option(Window window, String name, Object value, Error *err) /// @return The (row, col) tuple with the window position Position window_get_position(Window window, Error *err) { - Position rv; + Position rv = POSITION_INIT; win_T *win = find_window_by_handle(window, err); if (win) { diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 8bcb5934dc..77bed67d5f 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -115,9 +115,15 @@ open_buffer ( * If we can't create one for the current buffer, take another buffer */ close_buffer(NULL, curbuf, 0, FALSE); - for (curbuf = firstbuf; curbuf != NULL; curbuf = curbuf->b_next) - if (curbuf->b_ml.ml_mfp != NULL) + + curbuf = NULL; + FOR_ALL_BUFFERS(buf) { + if (buf->b_ml.ml_mfp != NULL) { + curbuf = buf; break; + } + } + /* * if there is no memfile at all, exit * This is OK, since there are no changes to lose. @@ -260,11 +266,11 @@ open_buffer ( */ int buf_valid(buf_T *buf) { - buf_T *bp; - - for (bp = firstbuf; bp != NULL; bp = bp->b_next) - if (bp == buf) + FOR_ALL_BUFFERS(bp) { + if (bp == buf) { return TRUE; + } + } return FALSE; } @@ -946,9 +952,13 @@ do_buffer ( * If deleting the last (listed) buffer, make it empty. * The last (listed) buffer cannot be unloaded. */ - for (bp = firstbuf; bp != NULL; bp = bp->b_next) - if (bp->b_p_bl && bp != buf) + bp = NULL; + FOR_ALL_BUFFERS(bp2) { + if (bp2->b_p_bl && bp2 != buf) { + bp = bp2; break; + } + } if (bp == NULL && buf == curbuf) return empty_curbuf(TRUE, forceit, action); @@ -1047,9 +1057,12 @@ do_buffer ( if (buf == NULL) /* No loaded buffer, use unloaded one */ buf = bp; if (buf == NULL) { /* No loaded buffer, find listed one */ - for (buf = firstbuf; buf != NULL; buf = buf->b_next) - if (buf->b_p_bl && buf != curbuf) + FOR_ALL_BUFFERS(buf2) { + if (buf2->b_p_bl && buf2 != curbuf) { + buf = buf2; break; + } + } } if (buf == NULL) { /* Still no buffer, just take one */ if (curbuf->b_next != NULL) @@ -1670,9 +1683,7 @@ buf_T *buflist_findname(char_u *ffname) static buf_T *buflist_findname_file_id(char_u *ffname, FileID *file_id, bool file_id_valid) { - buf_T *buf; - - for (buf = firstbuf; buf != NULL; buf = buf->b_next) { + FOR_ALL_BUFFERS(buf) { if ((buf->b_flags & BF_DUMMY) == 0 && !otherfile_buf(buf, ffname, file_id, file_id_valid)) { return buf; @@ -1695,7 +1706,6 @@ buflist_findpat ( int curtab_only /* find buffers in current tab only */ ) { - buf_T *buf; regprog_T *prog; int match = -1; int find_listed; @@ -1746,7 +1756,7 @@ buflist_findpat ( return -1; } - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) { if (buf->b_p_bl == find_listed && (!diffmode || diff_mode_buf(buf)) && buflist_match(prog, buf) != NULL) { @@ -1767,6 +1777,7 @@ buflist_findpat ( } match = buf->b_fnum; /* remember first match */ } + } vim_regfree(prog); if (match >= 0) /* found one match */ @@ -1799,7 +1810,6 @@ buflist_findpat ( int ExpandBufnames(char_u *pat, int *num_file, char_u ***file, int options) { int count = 0; - buf_T *buf; int round; char_u *p; int attempt; @@ -1837,7 +1847,7 @@ int ExpandBufnames(char_u *pat, int *num_file, char_u ***file, int options) */ for (round = 1; round <= 2; ++round) { count = 0; - for (buf = firstbuf; buf != NULL; buf = buf->b_next) { + FOR_ALL_BUFFERS(buf) { if (!buf->b_p_bl) /* skip unlisted buffers */ continue; p = buflist_match(prog, buf); @@ -1921,13 +1931,15 @@ static char_u *fname_match(regprog_T *prog, char_u *name) */ buf_T *buflist_findnr(int nr) { - buf_T *buf; - - if (nr == 0) + if (nr == 0) { nr = curwin->w_alt_fnum; - for (buf = firstbuf; buf != NULL; buf = buf->b_next) - if (buf->b_fnum == nr) + } + + FOR_ALL_BUFFERS(buf) { + if (buf->b_fnum == nr) { return buf; + } + } return NULL; } @@ -2344,9 +2356,7 @@ int buflist_add(char_u *fname, int flags) */ void buflist_slash_adjust(void) { - buf_T *bp; - - for (bp = firstbuf; bp != NULL; bp = bp->b_next) { + FOR_ALL_BUFFERS(bp) { if (bp->b_ffname != NULL) slash_adjust(bp->b_ffname); if (bp->b_sfname != NULL) @@ -4192,7 +4202,6 @@ int read_viminfo_bufferlist(vir_T *virp, int writing) void write_viminfo_bufferlist(FILE *fp) { - buf_T *buf; win_T *win; tabpage_T *tp; char_u *line; @@ -4213,7 +4222,7 @@ void write_viminfo_bufferlist(FILE *fp) } fputs(_("\n# Buffer list:\n"), fp); - for (buf = firstbuf; buf != NULL; buf = buf->b_next) { + FOR_ALL_BUFFERS(buf) { if (buf->b_fname == NULL || !buf->b_p_bl || bt_quickfix(buf) @@ -4488,13 +4497,11 @@ void buf_delete_signs(buf_T *buf) */ void buf_delete_all_signs(void) { - buf_T *buf; /* buffer we are checking for signs */ - - for (buf = firstbuf; buf != NULL; buf = buf->b_next) { - if (buf->b_signlist != NULL) { - buf_delete_signs(buf); - } + FOR_ALL_BUFFERS(buf) { + if (buf->b_signlist != NULL) { + buf_delete_signs(buf); } + } } /* diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 9f5d7b86eb..4162df63ab 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -136,6 +136,10 @@ struct buffheader { typedef struct { int wo_arab; # define w_p_arab w_onebuf_opt.wo_arab /* 'arabic' */ + int wo_bri; +# define w_p_bri w_onebuf_opt.wo_bri /* 'breakindent' */ + char_u *wo_briopt; +# define w_p_briopt w_onebuf_opt.wo_briopt /* 'breakindentopt' */ int wo_diff; # define w_p_diff w_onebuf_opt.wo_diff /* 'diff' */ long wo_fdc; @@ -1069,6 +1073,9 @@ struct window_S { long_u w_p_fde_flags; /* flags for 'foldexpr' */ long_u w_p_fdt_flags; /* flags for 'foldtext' */ int *w_p_cc_cols; /* array of columns to highlight or NULL */ + int w_p_brimin; /* minimum width for breakindent */ + int w_p_brishift; /* additional shift for breakindent */ + bool w_p_brisbr; /* sbr in 'briopt' */ /* transform a pointer to a "onebuf" option into a "allbuf" option */ #define GLOBAL_WO(p) ((char *)p + sizeof(winopt_T)) diff --git a/src/nvim/charset.c b/src/nvim/charset.c index baf6895b4c..57c4aec395 100644 --- a/src/nvim/charset.c +++ b/src/nvim/charset.c @@ -13,6 +13,7 @@ #include "nvim/charset.h" #include "nvim/farsi.h" #include "nvim/func_attr.h" +#include "nvim/indent.h" #include "nvim/main.h" #include "nvim/mbyte.h" #include "nvim/memline.h" @@ -775,9 +776,10 @@ int linetabsize(char_u *s) int linetabsize_col(int startcol, char_u *s) { colnr_T col = startcol; + char_u *line = s; /* pointer to start of line, for breakindent */ while (*s != NUL) { - col += lbr_chartabsize_adv(&s, col); + col += lbr_chartabsize_adv(line, &s, col); } return (int)col; } @@ -785,17 +787,17 @@ int linetabsize_col(int startcol, char_u *s) /// Like linetabsize(), but for a given window instead of the current one. /// /// @param wp -/// @param p +/// @param line /// @param len /// /// @return Number of characters the string will take on the screen. -int win_linetabsize(win_T *wp, char_u *p, colnr_T len) +int win_linetabsize(win_T *wp, char_u *line, colnr_T len) { colnr_T col = 0; char_u *s; - for (s = p; *s != NUL && (len == MAXCOL || s < p + len); mb_ptr_adv(s)) { - col += win_lbr_chartabsize(wp, s, col, NULL); + for (s = line; *s != NUL && (len == MAXCOL || s < line + len); mb_ptr_adv(s)) { + col += win_lbr_chartabsize(wp, line, s, col, NULL); } return (int)col; } @@ -922,32 +924,34 @@ int vim_isprintc_strict(int c) /// like chartabsize(), but also check for line breaks on the screen /// +/// @param line /// @param s /// @param col /// /// @return The number of characters taken up on the screen. -int lbr_chartabsize(unsigned char *s, colnr_T col) +int lbr_chartabsize(char_u *line, unsigned char *s, colnr_T col) { - if (!curwin->w_p_lbr && (*p_sbr == NUL)) { + if (!curwin->w_p_lbr && (*p_sbr == NUL) && !curwin->w_p_bri) { if (curwin->w_p_wrap) { return win_nolbr_chartabsize(curwin, s, col, NULL); } RET_WIN_BUF_CHARTABSIZE(curwin, curbuf, s, col) } - return win_lbr_chartabsize(curwin, s, col, NULL); + return win_lbr_chartabsize(curwin, line == NULL ? s: line, s, col, NULL); } /// Call lbr_chartabsize() and advance the pointer. /// +/// @param line /// @param s /// @param col /// /// @return The number of characters take up on the screen. -int lbr_chartabsize_adv(char_u **s, colnr_T col) +int lbr_chartabsize_adv(char_u *line, char_u **s, colnr_T col) { int retval; - retval = lbr_chartabsize(*s, col); + retval = lbr_chartabsize(line, *s, col); mb_ptr_adv(*s); return retval; } @@ -959,14 +963,16 @@ int lbr_chartabsize_adv(char_u **s, colnr_T col) /// value, init to 0 before calling. /// /// @param wp +/// @param line /// @param s /// @param col /// @param headp /// /// @return The number of characters taken up on the screen. -int win_lbr_chartabsize(win_T *wp, char_u *s, colnr_T col, int *headp) +int win_lbr_chartabsize(win_T *wp, char_u *line, char_u *s, colnr_T col, int *headp) { colnr_T col2; + colnr_T col_adj = 0; /* col + screen size of tab */ colnr_T colmax; int added; int mb_added = 0; @@ -975,8 +981,8 @@ int win_lbr_chartabsize(win_T *wp, char_u *s, colnr_T col, int *headp) int tab_corr = (*s == TAB); int n; - // No 'linebreak' and 'showbreak': return quickly. - if (!wp->w_p_lbr && (*p_sbr == NUL)) { + // No 'linebreak', 'showbreak' and 'breakindent': return quickly. + if (!wp->w_p_lbr && !wp->w_p_bri && (*p_sbr == NUL)) { if (wp->w_p_wrap) { return win_nolbr_chartabsize(wp, s, col, headp); } @@ -986,26 +992,29 @@ int win_lbr_chartabsize(win_T *wp, char_u *s, colnr_T col, int *headp) // First get normal size, without 'linebreak' int size = win_chartabsize(wp, s, col); int c = *s; + if (tab_corr) { + col_adj = size - 1; + } // If 'linebreak' set check at a blank before a non-blank if the line // needs a break here if (wp->w_p_lbr && vim_isbreak(c) && !vim_isbreak(s[1]) - && !wp->w_p_list && wp->w_p_wrap && (wp->w_width != 0)) { // Count all characters from first non-blank after a blank up to next // non-blank after a blank. numberextra = win_col_off(wp); col2 = col; - colmax = (colnr_T)(wp->w_width - numberextra); + colmax = (colnr_T)(wp->w_width - numberextra - col_adj); if (col >= colmax) { - n = colmax + win_col_off2(wp); + colmax += col_adj; + n = colmax + win_col_off2(wp); if (n > 0) { - colmax += (((col - colmax) / n) + 1) * n; + colmax += (((col - colmax) / n) + 1) * n - col_adj; } } @@ -1024,7 +1033,7 @@ int win_lbr_chartabsize(win_T *wp, char_u *s, colnr_T col, int *headp) col2 += win_chartabsize(wp, s, col2); if (col2 >= colmax) { /* doesn't fit */ - size = colmax - col; + size = colmax - col + col_adj; tab_corr = FALSE; break; } @@ -1039,11 +1048,12 @@ int win_lbr_chartabsize(win_T *wp, char_u *s, colnr_T col, int *headp) mb_added = 1; } - // May have to add something for 'showbreak' string at start of line + // May have to add something for 'breakindent' and/or 'showbreak' + // string at start of line. // Set *headp to the size of what we add. added = 0; - if ((*p_sbr != NUL) && wp->w_p_wrap && (col != 0)) { + if ((*p_sbr != NUL || wp->w_p_bri) && wp->w_p_wrap && (col != 0)) { numberextra = win_col_off(wp); col += numberextra + mb_added; @@ -1056,7 +1066,12 @@ int win_lbr_chartabsize(win_T *wp, char_u *s, colnr_T col, int *headp) } if ((col == 0) || (col + size > (colnr_T)wp->w_width)) { - added = vim_strsize(p_sbr); + added = 0; + if (*p_sbr != NUL) + added += vim_strsize(p_sbr); + if (wp->w_p_bri) + added += get_breakindent_win(wp, line); + if (tab_corr) { size += (added / wp->w_buffer->b_p_ts) * wp->w_buffer->b_p_ts; } else { @@ -1157,13 +1172,14 @@ void getvcol(win_T *wp, pos_T *pos, colnr_T *start, colnr_T *cursor, colnr_T vcol; char_u *ptr; // points to current char char_u *posptr; // points to char at pos->col + char_u *line; // start of the line int incr; int head; int ts = wp->w_buffer->b_p_ts; int c; vcol = 0; - ptr = ml_get_buf(wp->w_buffer, pos->lnum, FALSE); + line = ptr = ml_get_buf(wp->w_buffer, pos->lnum, FALSE); if (pos->col == MAXCOL) { // continue until the NUL @@ -1173,11 +1189,13 @@ void getvcol(win_T *wp, pos_T *pos, colnr_T *start, colnr_T *cursor, } // This function is used very often, do some speed optimizations. - // When 'list', 'linebreak' and 'showbreak' are not set use a simple loop. - // Also use this when 'list' is set but tabs take their normal size. + // When 'list', 'linebreak', 'showbreak' and 'breakindent' are not set + // use a simple loop. + // Also use this when 'list' is set but tabs take their normal size. if ((!wp->w_p_list || (lcs_tab1 != NUL)) && !wp->w_p_lbr - && (*p_sbr == NUL)) { + && (*p_sbr == NUL) + && !wp->w_p_bri ) { for (;;) { head = 0; c = *ptr; @@ -1229,7 +1247,7 @@ void getvcol(win_T *wp, pos_T *pos, colnr_T *start, colnr_T *cursor, for (;;) { // A tab gets expanded, depending on the current column head = 0; - incr = win_lbr_chartabsize(wp, ptr, vcol, &head); + incr = win_lbr_chartabsize(wp, line, ptr, vcol, &head); // make sure we don't go past the end of the line if (*ptr == NUL) { diff --git a/src/nvim/cursor.c b/src/nvim/cursor.c index 64a3b73f15..cd84d7014c 100644 --- a/src/nvim/cursor.c +++ b/src/nvim/cursor.c @@ -138,7 +138,7 @@ static int coladvance2( ptr = line; while (col <= wcol && *ptr != NUL) { /* Count a tab for what it's worth (if list mode not on) */ - csize = win_lbr_chartabsize(curwin, ptr, col, &head); + csize = win_lbr_chartabsize(curwin, line, ptr, col, &head); mb_ptr_adv(ptr); col += csize; } diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 05d6c9758a..6158176e56 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -1551,7 +1551,7 @@ change_indent ( new_cursor_col += (*mb_ptr2len)(ptr + new_cursor_col); else ++new_cursor_col; - vcol += lbr_chartabsize(ptr + new_cursor_col, (colnr_T)vcol); + vcol += lbr_chartabsize(ptr, ptr + new_cursor_col, (colnr_T)vcol); } vcol = last_vcol; @@ -3436,8 +3436,9 @@ static int ins_compl_get_exp(pos_T *ini) int set_match_pos; if (!compl_started) { - for (ins_buf = firstbuf; ins_buf != NULL; ins_buf = ins_buf->b_next) - ins_buf->b_scanned = 0; + FOR_ALL_BUFFERS(buf) { + buf->b_scanned = 0; + } found_all = FALSE; ins_buf = curbuf; e_cpt = (compl_cont_status & CONT_LOCAL) @@ -5897,9 +5898,11 @@ int oneleft(void) width = 1; for (;; ) { coladvance(v - width); - /* getviscol() is slow, skip it when 'showbreak' is empty and - * there are no multi-byte characters */ + /* getviscol() is slow, skip it when 'showbreak' is empty, + 'breakindent' is not set and there are no multi-byte + characters */ if ((*p_sbr == NUL + && !curwin->w_p_bri && !has_mbyte ) || getviscol() < v) break; @@ -7913,10 +7916,10 @@ static int ins_tab(void) getvcol(curwin, &fpos, &vcol, NULL, NULL); getvcol(curwin, cursor, &want_vcol, NULL, NULL); - /* Use as many TABs as possible. Beware of 'showbreak' and - * 'linebreak' adding extra virtual columns. */ + /* Use as many TABs as possible. Beware of 'breakindent', 'showbreak' + and 'linebreak' adding extra virtual columns. */ while (vim_iswhite(*ptr)) { - i = lbr_chartabsize((char_u *)"\t", vcol); + i = lbr_chartabsize(NULL, (char_u *)"\t", vcol); if (vcol + i > want_vcol) break; if (*ptr != TAB) { @@ -7935,10 +7938,11 @@ static int ins_tab(void) if (change_col >= 0) { int repl_off = 0; + char_u *line = ptr; /* Skip over the spaces we need. */ while (vcol < want_vcol && *ptr == ' ') { - vcol += lbr_chartabsize(ptr, vcol); + vcol += lbr_chartabsize(line, ptr, vcol); ++ptr; ++repl_off; } @@ -8125,6 +8129,7 @@ int ins_copychar(linenr_T lnum) int c; int temp; char_u *ptr, *prev_ptr; + char_u *line; if (lnum < 1 || lnum > curbuf->b_ml.ml_line_count) { vim_beep(); @@ -8133,12 +8138,12 @@ int ins_copychar(linenr_T lnum) /* try to advance to the cursor column */ temp = 0; - ptr = ml_get(lnum); + line = ptr = ml_get(lnum); prev_ptr = ptr; validate_virtcol(); while ((colnr_T)temp < curwin->w_virtcol && *ptr != NUL) { prev_ptr = ptr; - temp += lbr_chartabsize_adv(&ptr, (colnr_T)temp); + temp += lbr_chartabsize_adv(line, &ptr, (colnr_T)temp); } if ((colnr_T)temp > curwin->w_virtcol) ptr = prev_ptr; diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 5bda9fcd3f..1cef91785c 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -5405,7 +5405,6 @@ static int list_join(garray_T *gap, list_T *l, char_u *sep, int echo_style, int int garbage_collect(void) { int copyID; - buf_T *buf; win_T *wp; funccall_T *fc, **pfc; int did_free; @@ -5440,8 +5439,9 @@ int garbage_collect(void) set_ref_in_ht(&SCRIPT_VARS(i), copyID); /* buffer-local variables */ - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) { set_ref_in_item(&buf->b_bufvar.di_tv, copyID); + } /* window-local variables */ FOR_ALL_TAB_WINDOWS(tp, wp) @@ -7223,13 +7223,16 @@ static buf_T *find_buffer(typval_T *avar) if (buf == NULL) { /* No full path name match, try a match with a URL or a "nofile" * buffer, these don't use the full path. */ - for (buf = firstbuf; buf != NULL; buf = buf->b_next) - if (buf->b_fname != NULL - && (path_with_url(buf->b_fname) - || bt_nofile(buf) + FOR_ALL_BUFFERS(bp) { + if (bp->b_fname != NULL + && (path_with_url(bp->b_fname) + || bt_nofile(bp) ) - && STRCMP(buf->b_fname, avar->vval.v_string) == 0) + && STRCMP(bp->b_fname, avar->vval.v_string) == 0) { + buf = bp; break; + } + } } } return buf; @@ -10635,11 +10638,12 @@ static void f_keys(typval_T *argvars, typval_T *rettv) static void f_last_buffer_nr(typval_T *argvars, typval_T *rettv) { int n = 0; - buf_T *buf; - for (buf = firstbuf; buf != NULL; buf = buf->b_next) - if (n < buf->b_fnum) + FOR_ALL_BUFFERS(buf) { + if (n < buf->b_fnum) { n = buf->b_fnum; + } + } rettv->vval.v_number = n; } diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 48e75190aa..5b6604fc93 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -1211,7 +1211,6 @@ do_shell ( int flags /* may be SHELL_DOOUT when output is redirected */ ) { - buf_T *buf; int save_nwr; /* @@ -1239,11 +1238,12 @@ do_shell ( if (p_warn && !autocmd_busy && msg_silent == 0) - for (buf = firstbuf; buf; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) { if (bufIsChanged(buf)) { MSG_PUTS(_("[No write since last change]\n")); break; } + } /* This windgoto is required for when the '\n' resulted in a "delete line * 1" command to the terminal. */ @@ -1753,7 +1753,6 @@ static void do_viminfo(FILE *fp_in, FILE *fp_out, int flags) static int read_viminfo_up_to_marks(vir_T *virp, int forceit, int writing) { int eof; - buf_T *buf; prepare_viminfo_history(forceit ? 9999 : 0, writing); eof = viminfo_readline(virp); @@ -1816,8 +1815,9 @@ static int read_viminfo_up_to_marks(vir_T *virp, int forceit, int writing) finish_viminfo_history(); /* Change file names to buffer numbers for fmarks. */ - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) { fmarks_check_names(buf); + } return eof; } @@ -2362,14 +2362,13 @@ void ex_wnext(exarg_T *eap) */ void do_wqall(exarg_T *eap) { - buf_T *buf; int error = 0; int save_forceit = eap->forceit; if (eap->cmdidx == CMD_xall || eap->cmdidx == CMD_wqall) exiting = TRUE; - for (buf = firstbuf; buf != NULL; buf = buf->b_next) { + FOR_ALL_BUFFERS(buf) { if (bufIsChanged(buf)) { /* * Check if there is a reason the buffer cannot be written: @@ -5679,7 +5678,6 @@ void ex_sign(exarg_T *eap) int idx; sign_T *sp; sign_T *sp_prev; - buf_T *buf; /* Parse the subcommand. */ p = skiptowhite(arg); @@ -5906,10 +5904,11 @@ void ex_sign(exarg_T *eap) if (idx == SIGNCMD_UNPLACE && *arg == NUL) { /* ":sign unplace {id}": remove placed sign by number */ - for (buf = firstbuf; buf != NULL; buf = buf->b_next) - if ((lnum = buf_delsign(buf, id)) != 0) - update_debug_sign(buf, lnum); - return; + FOR_ALL_BUFFERS(buf) { + if ((lnum = buf_delsign(buf, id)) != 0) + update_debug_sign(buf, lnum); + return; + } } } } @@ -5918,6 +5917,8 @@ void ex_sign(exarg_T *eap) * Check for line={lnum} name={name} and file={fname} or buffer={nr}. * Leave "arg" pointing to {fname}. */ + + buf_T *buf = NULL; for (;;) { if (STRNCMP(arg, "line=", 5) == 0) diff --git a/src/nvim/ex_cmds.lua b/src/nvim/ex_cmds.lua new file mode 100644 index 0000000000..5cd69232aa --- /dev/null +++ b/src/nvim/ex_cmds.lua @@ -0,0 +1,2552 @@ +bit = require 'bit' + +-- Description of the values below is contained in ex_cmds_defs.h file. +local RANGE = 0x001 +local BANG = 0x002 +local EXTRA = 0x004 +local XFILE = 0x008 +local NOSPC = 0x010 +local DFLALL = 0x020 +local WHOLEFOLD = 0x040 +local NEEDARG = 0x080 +local TRLBAR = 0x100 +local REGSTR = 0x200 +local COUNT = 0x400 +local NOTRLCOM = 0x800 +local ZEROR = 0x1000 +local USECTRLV = 0x2000 +local NOTADR = 0x4000 +local EDITCMD = 0x8000 +local BUFNAME = 0x10000 +local BUFUNL = 0x20000 +local ARGOPT = 0x40000 +local SBOXOK = 0x80000 +local CMDWIN = 0x100000 +local MODIFY = 0x200000 +local EXFLAGS = 0x400000 +local FILES = bit.bor(XFILE, EXTRA) +local WORD1 = bit.bor(EXTRA, NOSPC) +local FILE1 = bit.bor(FILES, NOSPC) + +-- The following table is described in ex_cmds_defs.h file. +return { + { + command='append', + flags=bit.bor(BANG, RANGE, ZEROR, TRLBAR, CMDWIN, MODIFY), + func='ex_append', + }, + { + command='abbreviate', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_abbreviate', + }, + { + command='abclear', + flags=bit.bor(EXTRA, TRLBAR, CMDWIN), + func='ex_abclear', + }, + { + command='aboveleft', + flags=bit.bor(NEEDARG, EXTRA, NOTRLCOM), + func='ex_wrongmodifier', + }, + { + command='all', + flags=bit.bor(BANG, RANGE, NOTADR, COUNT, TRLBAR), + func='ex_all', + }, + { + command='amenu', + flags=bit.bor(RANGE, NOTADR, ZEROR, EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_menu', + }, + { + command='anoremenu', + flags=bit.bor(RANGE, NOTADR, ZEROR, EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_menu', + }, + { + command='args', + flags=bit.bor(BANG, FILES, EDITCMD, ARGOPT, TRLBAR), + func='ex_args', + }, + { + command='argadd', + flags=bit.bor(BANG, NEEDARG, RANGE, NOTADR, ZEROR, FILES, TRLBAR), + func='ex_argadd', + }, + { + command='argdelete', + flags=bit.bor(BANG, RANGE, NOTADR, FILES, TRLBAR), + func='ex_argdelete', + }, + { + command='argdo', + flags=bit.bor(BANG, NEEDARG, EXTRA, NOTRLCOM), + func='ex_listdo', + }, + { + command='argedit', + flags=bit.bor(BANG, NEEDARG, RANGE, NOTADR, FILE1, EDITCMD, ARGOPT, TRLBAR), + func='ex_argedit', + }, + { + command='argglobal', + flags=bit.bor(BANG, FILES, EDITCMD, ARGOPT, TRLBAR), + func='ex_args', + }, + { + command='arglocal', + flags=bit.bor(BANG, FILES, EDITCMD, ARGOPT, TRLBAR), + func='ex_args', + }, + { + command='argument', + flags=bit.bor(BANG, RANGE, NOTADR, COUNT, EXTRA, EDITCMD, ARGOPT, TRLBAR), + func='ex_argument', + }, + { + command='ascii', + flags=bit.bor(TRLBAR, SBOXOK, CMDWIN), + func='do_ascii', + }, + { + command='autocmd', + flags=bit.bor(BANG, EXTRA, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_autocmd', + }, + { + command='augroup', + flags=bit.bor(BANG, WORD1, TRLBAR, CMDWIN), + func='ex_autocmd', + }, + { + command='aunmenu', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_menu', + }, + { + command='buffer', + flags=bit.bor(BANG, RANGE, NOTADR, BUFNAME, BUFUNL, COUNT, EXTRA, TRLBAR), + func='ex_buffer', + }, + { + command='bNext', + flags=bit.bor(BANG, RANGE, NOTADR, COUNT, TRLBAR), + func='ex_bprevious', + }, + { + command='ball', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR), + func='ex_buffer_all', + }, + { + command='badd', + flags=bit.bor(NEEDARG, FILE1, EDITCMD, TRLBAR, CMDWIN), + func='ex_edit', + }, + { + command='bdelete', + flags=bit.bor(BANG, RANGE, NOTADR, BUFNAME, COUNT, EXTRA, TRLBAR), + func='ex_bunload', + }, + { + command='behave', + flags=bit.bor(NEEDARG, WORD1, TRLBAR, CMDWIN), + func='ex_behave', + }, + { + command='belowright', + flags=bit.bor(NEEDARG, EXTRA, NOTRLCOM), + func='ex_wrongmodifier', + }, + { + command='bfirst', + flags=bit.bor(BANG, RANGE, NOTADR, TRLBAR), + func='ex_brewind', + }, + { + command='blast', + flags=bit.bor(BANG, RANGE, NOTADR, TRLBAR), + func='ex_blast', + }, + { + command='bmodified', + flags=bit.bor(BANG, RANGE, NOTADR, COUNT, TRLBAR), + func='ex_bmodified', + }, + { + command='bnext', + flags=bit.bor(BANG, RANGE, NOTADR, COUNT, TRLBAR), + func='ex_bnext', + }, + { + command='botright', + flags=bit.bor(NEEDARG, EXTRA, NOTRLCOM), + func='ex_wrongmodifier', + }, + { + command='bprevious', + flags=bit.bor(BANG, RANGE, NOTADR, COUNT, TRLBAR), + func='ex_bprevious', + }, + { + command='brewind', + flags=bit.bor(BANG, RANGE, NOTADR, TRLBAR), + func='ex_brewind', + }, + { + command='break', + flags=bit.bor(TRLBAR, SBOXOK, CMDWIN), + func='ex_break', + }, + { + command='breakadd', + flags=bit.bor(EXTRA, TRLBAR, CMDWIN), + func='ex_breakadd', + }, + { + command='breakdel', + flags=bit.bor(EXTRA, TRLBAR, CMDWIN), + func='ex_breakdel', + }, + { + command='breaklist', + flags=bit.bor(EXTRA, TRLBAR, CMDWIN), + func='ex_breaklist', + }, + { + command='browse', + flags=bit.bor(NEEDARG, EXTRA, NOTRLCOM, CMDWIN), + func='ex_wrongmodifier', + }, + { + command='buffers', + flags=bit.bor(BANG, TRLBAR, CMDWIN), + func='buflist_list', + }, + { + command='bufdo', + flags=bit.bor(BANG, NEEDARG, EXTRA, NOTRLCOM), + func='ex_listdo', + }, + { + command='bunload', + flags=bit.bor(BANG, RANGE, NOTADR, BUFNAME, COUNT, EXTRA, TRLBAR), + func='ex_bunload', + }, + { + command='bwipeout', + flags=bit.bor(BANG, RANGE, NOTADR, BUFNAME, BUFUNL, COUNT, EXTRA, TRLBAR), + func='ex_bunload', + }, + { + command='change', + flags=bit.bor(BANG, WHOLEFOLD, RANGE, COUNT, TRLBAR, CMDWIN, MODIFY), + func='ex_change', + }, + { + command='cNext', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR, BANG), + func='ex_cnext', + }, + { + command='cNfile', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR, BANG), + func='ex_cnext', + }, + { + command='cabbrev', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_abbreviate', + }, + { + command='cabclear', + flags=bit.bor(EXTRA, TRLBAR, CMDWIN), + func='ex_abclear', + }, + { + command='caddbuffer', + flags=bit.bor(RANGE, NOTADR, WORD1, TRLBAR), + func='ex_cbuffer', + }, + { + command='caddexpr', + flags=bit.bor(NEEDARG, WORD1, NOTRLCOM, TRLBAR), + func='ex_cexpr', + }, + { + command='caddfile', + flags=bit.bor(TRLBAR, FILE1), + func='ex_cfile', + }, + { + command='call', + flags=bit.bor(RANGE, NEEDARG, EXTRA, NOTRLCOM, SBOXOK, CMDWIN), + func='ex_call', + }, + { + command='catch', + flags=bit.bor(EXTRA, SBOXOK, CMDWIN), + func='ex_catch', + }, + { + command='cbuffer', + flags=bit.bor(BANG, RANGE, NOTADR, WORD1, TRLBAR), + func='ex_cbuffer', + }, + { + command='cc', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR, BANG), + func='ex_cc', + }, + { + command='cclose', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR), + func='ex_cclose', + }, + { + command='cd', + flags=bit.bor(BANG, FILE1, TRLBAR, CMDWIN), + func='ex_cd', + }, + { + command='center', + flags=bit.bor(TRLBAR, RANGE, WHOLEFOLD, EXTRA, CMDWIN, MODIFY), + func='ex_align', + }, + { + command='cexpr', + flags=bit.bor(NEEDARG, WORD1, NOTRLCOM, TRLBAR, BANG), + func='ex_cexpr', + }, + { + command='cfile', + flags=bit.bor(TRLBAR, FILE1, BANG), + func='ex_cfile', + }, + { + command='cfirst', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR, BANG), + func='ex_cc', + }, + { + command='cgetfile', + flags=bit.bor(TRLBAR, FILE1), + func='ex_cfile', + }, + { + command='cgetbuffer', + flags=bit.bor(RANGE, NOTADR, WORD1, TRLBAR), + func='ex_cbuffer', + }, + { + command='cgetexpr', + flags=bit.bor(NEEDARG, WORD1, NOTRLCOM, TRLBAR), + func='ex_cexpr', + }, + { + command='chdir', + flags=bit.bor(BANG, FILE1, TRLBAR, CMDWIN), + func='ex_cd', + }, + { + command='changes', + flags=bit.bor(TRLBAR, CMDWIN), + func='ex_changes', + }, + { + command='checkpath', + flags=bit.bor(TRLBAR, BANG, CMDWIN), + func='ex_checkpath', + }, + { + command='checktime', + flags=bit.bor(RANGE, NOTADR, BUFNAME, COUNT, EXTRA, TRLBAR), + func='ex_checktime', + }, + { + command='clist', + flags=bit.bor(BANG, EXTRA, TRLBAR, CMDWIN), + func='qf_list', + }, + { + command='clast', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR, BANG), + func='ex_cc', + }, + { + command='close', + flags=bit.bor(BANG, TRLBAR, CMDWIN), + func='ex_close', + }, + { + command='cmap', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_map', + }, + { + command='cmapclear', + flags=bit.bor(EXTRA, TRLBAR, CMDWIN), + func='ex_mapclear', + }, + { + command='cmenu', + flags=bit.bor(RANGE, NOTADR, ZEROR, EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_menu', + }, + { + command='cnext', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR, BANG), + func='ex_cnext', + }, + { + command='cnewer', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR), + func='qf_age', + }, + { + command='cnfile', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR, BANG), + func='ex_cnext', + }, + { + command='cnoremap', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_map', + }, + { + command='cnoreabbrev', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_abbreviate', + }, + { + command='cnoremenu', + flags=bit.bor(RANGE, NOTADR, ZEROR, EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_menu', + }, + { + command='copy', + flags=bit.bor(RANGE, WHOLEFOLD, EXTRA, TRLBAR, CMDWIN, MODIFY), + func='ex_copymove', + }, + { + command='colder', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR), + func='qf_age', + }, + { + command='colorscheme', + flags=bit.bor(WORD1, TRLBAR, CMDWIN), + func='ex_colorscheme', + }, + { + command='command', + flags=bit.bor(EXTRA, BANG, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_command', + }, + { + command='comclear', + flags=bit.bor(TRLBAR, CMDWIN), + func='ex_comclear', + }, + { + command='compiler', + flags=bit.bor(BANG, TRLBAR, WORD1, CMDWIN), + func='ex_compiler', + }, + { + command='continue', + flags=bit.bor(TRLBAR, SBOXOK, CMDWIN), + func='ex_continue', + }, + { + command='confirm', + flags=bit.bor(NEEDARG, EXTRA, NOTRLCOM, CMDWIN), + func='ex_wrongmodifier', + }, + { + command='copen', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR), + func='ex_copen', + }, + { + command='cprevious', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR, BANG), + func='ex_cnext', + }, + { + command='cpfile', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR, BANG), + func='ex_cnext', + }, + { + command='cquit', + flags=bit.bor(TRLBAR, BANG), + func='ex_cquit', + }, + { + command='crewind', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR, BANG), + func='ex_cc', + }, + { + command='cscope', + flags=bit.bor(EXTRA, NOTRLCOM, XFILE), + func='do_cscope', + }, + { + command='cstag', + flags=bit.bor(BANG, TRLBAR, WORD1), + func='do_cstag', + }, + { + command='cunmap', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_unmap', + }, + { + command='cunabbrev', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_abbreviate', + }, + { + command='cunmenu', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_menu', + }, + { + command='cwindow', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR), + func='ex_cwindow', + }, + { + command='delete', + flags=bit.bor(RANGE, WHOLEFOLD, REGSTR, COUNT, TRLBAR, CMDWIN, MODIFY), + func='ex_operators', + }, + { + command='delmarks', + flags=bit.bor(BANG, EXTRA, TRLBAR, CMDWIN), + func='ex_delmarks', + }, + { + command='debug', + flags=bit.bor(NEEDARG, EXTRA, NOTRLCOM, SBOXOK, CMDWIN), + func='ex_debug', + }, + { + command='debuggreedy', + flags=bit.bor(RANGE, NOTADR, ZEROR, TRLBAR, CMDWIN), + func='ex_debuggreedy', + }, + { + command='delcommand', + flags=bit.bor(NEEDARG, WORD1, TRLBAR, CMDWIN), + func='ex_delcommand', + }, + { + command='delfunction', + flags=bit.bor(NEEDARG, WORD1, CMDWIN), + func='ex_delfunction', + }, + { + command='display', + flags=bit.bor(EXTRA, NOTRLCOM, TRLBAR, SBOXOK, CMDWIN), + func='ex_display', + }, + { + command='diffupdate', + flags=bit.bor(BANG, TRLBAR), + func='ex_diffupdate', + }, + { + command='diffget', + flags=bit.bor(RANGE, EXTRA, TRLBAR, MODIFY), + func='ex_diffgetput', + }, + { + command='diffoff', + flags=bit.bor(BANG, TRLBAR), + func='ex_diffoff', + }, + { + command='diffpatch', + flags=bit.bor(EXTRA, FILE1, TRLBAR, MODIFY), + func='ex_diffpatch', + }, + { + command='diffput', + flags=bit.bor(RANGE, EXTRA, TRLBAR), + func='ex_diffgetput', + }, + { + command='diffsplit', + flags=bit.bor(EXTRA, FILE1, TRLBAR), + func='ex_diffsplit', + }, + { + command='diffthis', + flags=bit.bor(TRLBAR), + func='ex_diffthis', + }, + { + command='digraphs', + flags=bit.bor(EXTRA, TRLBAR, CMDWIN), + func='ex_digraphs', + }, + { + command='djump', + flags=bit.bor(BANG, RANGE, DFLALL, WHOLEFOLD, EXTRA), + func='ex_findpat', + }, + { + command='dlist', + flags=bit.bor(BANG, RANGE, DFLALL, WHOLEFOLD, EXTRA, CMDWIN), + func='ex_findpat', + }, + { + command='doautocmd', + flags=bit.bor(EXTRA, TRLBAR, CMDWIN), + func='ex_doautocmd', + }, + { + command='doautoall', + flags=bit.bor(EXTRA, TRLBAR, CMDWIN), + func='ex_doautoall', + }, + { + command='drop', + flags=bit.bor(FILES, EDITCMD, NEEDARG, ARGOPT, TRLBAR), + func='ex_drop', + }, + { + command='dsearch', + flags=bit.bor(BANG, RANGE, DFLALL, WHOLEFOLD, EXTRA, CMDWIN), + func='ex_findpat', + }, + { + command='dsplit', + flags=bit.bor(BANG, RANGE, DFLALL, WHOLEFOLD, EXTRA), + func='ex_findpat', + }, + { + command='edit', + flags=bit.bor(BANG, FILE1, EDITCMD, ARGOPT, TRLBAR), + func='ex_edit', + }, + { + command='earlier', + flags=bit.bor(TRLBAR, EXTRA, NOSPC, CMDWIN), + func='ex_later', + }, + { + command='echo', + flags=bit.bor(EXTRA, NOTRLCOM, SBOXOK, CMDWIN), + func='ex_echo', + }, + { + command='echoerr', + flags=bit.bor(EXTRA, NOTRLCOM, SBOXOK, CMDWIN), + func='ex_execute', + }, + { + command='echohl', + flags=bit.bor(EXTRA, TRLBAR, SBOXOK, CMDWIN), + func='ex_echohl', + }, + { + command='echomsg', + flags=bit.bor(EXTRA, NOTRLCOM, SBOXOK, CMDWIN), + func='ex_execute', + }, + { + command='echon', + flags=bit.bor(EXTRA, NOTRLCOM, SBOXOK, CMDWIN), + func='ex_echo', + }, + { + command='else', + flags=bit.bor(TRLBAR, SBOXOK, CMDWIN), + func='ex_else', + }, + { + command='elseif', + flags=bit.bor(EXTRA, NOTRLCOM, SBOXOK, CMDWIN), + func='ex_else', + }, + { + command='emenu', + flags=bit.bor(NEEDARG, EXTRA, TRLBAR, NOTRLCOM, RANGE, NOTADR, CMDWIN), + func='ex_emenu', + }, + { + command='endif', + flags=bit.bor(TRLBAR, SBOXOK, CMDWIN), + func='ex_endif', + }, + { + command='endfunction', + flags=bit.bor(TRLBAR, CMDWIN), + func='ex_endfunction', + }, + { + command='endfor', + flags=bit.bor(TRLBAR, SBOXOK, CMDWIN), + func='ex_endwhile', + }, + { + command='endtry', + flags=bit.bor(TRLBAR, SBOXOK, CMDWIN), + func='ex_endtry', + }, + { + command='endwhile', + flags=bit.bor(TRLBAR, SBOXOK, CMDWIN), + func='ex_endwhile', + }, + { + command='enew', + flags=bit.bor(BANG, TRLBAR), + func='ex_edit', + }, + { + command='ex', + flags=bit.bor(BANG, FILE1, EDITCMD, ARGOPT, TRLBAR), + func='ex_edit', + }, + { + command='execute', + flags=bit.bor(EXTRA, NOTRLCOM, SBOXOK, CMDWIN), + func='ex_execute', + }, + { + command='exit', + flags=bit.bor(RANGE, WHOLEFOLD, BANG, FILE1, ARGOPT, DFLALL, TRLBAR, CMDWIN), + func='ex_exit', + }, + { + command='exusage', + flags=bit.bor(TRLBAR), + func='ex_exusage', + }, + { + command='file', + flags=bit.bor(RANGE, NOTADR, ZEROR, BANG, FILE1, TRLBAR), + func='ex_file', + }, + { + command='files', + flags=bit.bor(BANG, TRLBAR, CMDWIN), + func='buflist_list', + }, + { + command='filetype', + flags=bit.bor(EXTRA, TRLBAR, CMDWIN), + func='ex_filetype', + }, + { + command='find', + flags=bit.bor(RANGE, NOTADR, BANG, FILE1, EDITCMD, ARGOPT, TRLBAR), + func='ex_find', + }, + { + command='finally', + flags=bit.bor(TRLBAR, SBOXOK, CMDWIN), + func='ex_finally', + }, + { + command='finish', + flags=bit.bor(TRLBAR, SBOXOK, CMDWIN), + func='ex_finish', + }, + { + command='first', + flags=bit.bor(EXTRA, BANG, EDITCMD, ARGOPT, TRLBAR), + func='ex_rewind', + }, + { + command='fixdel', + flags=bit.bor(TRLBAR, CMDWIN), + func='do_fixdel', + }, + { + command='fold', + flags=bit.bor(RANGE, WHOLEFOLD, TRLBAR, SBOXOK, CMDWIN), + func='ex_fold', + }, + { + command='foldclose', + flags=bit.bor(RANGE, BANG, WHOLEFOLD, TRLBAR, SBOXOK, CMDWIN), + func='ex_foldopen', + }, + { + command='folddoopen', + flags=bit.bor(RANGE, DFLALL, NEEDARG, EXTRA, NOTRLCOM), + func='ex_folddo', + }, + { + command='folddoclosed', + flags=bit.bor(RANGE, DFLALL, NEEDARG, EXTRA, NOTRLCOM), + func='ex_folddo', + }, + { + command='foldopen', + flags=bit.bor(RANGE, BANG, WHOLEFOLD, TRLBAR, SBOXOK, CMDWIN), + func='ex_foldopen', + }, + { + command='for', + flags=bit.bor(EXTRA, NOTRLCOM, SBOXOK, CMDWIN), + func='ex_while', + }, + { + command='function', + flags=bit.bor(EXTRA, BANG, CMDWIN), + func='ex_function', + }, + { + command='global', + flags=bit.bor(RANGE, WHOLEFOLD, BANG, EXTRA, DFLALL, SBOXOK, CMDWIN), + func='ex_global', + }, + { + command='goto', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR, SBOXOK, CMDWIN), + func='ex_goto', + }, + { + command='grep', + flags=bit.bor(RANGE, NOTADR, BANG, NEEDARG, EXTRA, NOTRLCOM, TRLBAR, XFILE), + func='ex_make', + }, + { + command='grepadd', + flags=bit.bor(RANGE, NOTADR, BANG, NEEDARG, EXTRA, NOTRLCOM, TRLBAR, XFILE), + func='ex_make', + }, + { + command='gui', + flags=bit.bor(BANG, FILES, EDITCMD, ARGOPT, TRLBAR, CMDWIN), + func='ex_gui', + }, + { + command='gvim', + flags=bit.bor(BANG, FILES, EDITCMD, ARGOPT, TRLBAR, CMDWIN), + func='ex_gui', + }, + { + command='help', + flags=bit.bor(BANG, EXTRA, NOTRLCOM), + func='ex_help', + }, + { + command='helpfind', + flags=bit.bor(EXTRA, NOTRLCOM), + func='ex_helpfind', + }, + { + command='helpgrep', + flags=bit.bor(EXTRA, NOTRLCOM, NEEDARG), + func='ex_helpgrep', + }, + { + command='helptags', + flags=bit.bor(NEEDARG, FILES, TRLBAR, CMDWIN), + func='ex_helptags', + }, + { + command='hardcopy', + flags=bit.bor(RANGE, COUNT, EXTRA, TRLBAR, DFLALL, BANG), + func='ex_hardcopy', + }, + { + command='highlight', + flags=bit.bor(BANG, EXTRA, TRLBAR, SBOXOK, CMDWIN), + func='ex_highlight', + }, + { + command='hide', + flags=bit.bor(BANG, EXTRA, NOTRLCOM), + func='ex_hide', + }, + { + command='history', + flags=bit.bor(EXTRA, TRLBAR, CMDWIN), + func='ex_history', + }, + { + command='insert', + flags=bit.bor(BANG, RANGE, TRLBAR, CMDWIN, MODIFY), + func='ex_append', + }, + { + command='iabbrev', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_abbreviate', + }, + { + command='iabclear', + flags=bit.bor(EXTRA, TRLBAR, CMDWIN), + func='ex_abclear', + }, + { + command='if', + flags=bit.bor(EXTRA, NOTRLCOM, SBOXOK, CMDWIN), + func='ex_if', + }, + { + command='ijump', + flags=bit.bor(BANG, RANGE, DFLALL, WHOLEFOLD, EXTRA), + func='ex_findpat', + }, + { + command='ilist', + flags=bit.bor(BANG, RANGE, DFLALL, WHOLEFOLD, EXTRA, CMDWIN), + func='ex_findpat', + }, + { + command='imap', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_map', + }, + { + command='imapclear', + flags=bit.bor(EXTRA, TRLBAR, CMDWIN), + func='ex_mapclear', + }, + { + command='imenu', + flags=bit.bor(RANGE, NOTADR, ZEROR, EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_menu', + }, + { + command='inoremap', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_map', + }, + { + command='inoreabbrev', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_abbreviate', + }, + { + command='inoremenu', + flags=bit.bor(RANGE, NOTADR, ZEROR, EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_menu', + }, + { + command='intro', + flags=bit.bor(TRLBAR, CMDWIN), + func='ex_intro', + }, + { + command='isearch', + flags=bit.bor(BANG, RANGE, DFLALL, WHOLEFOLD, EXTRA, CMDWIN), + func='ex_findpat', + }, + { + command='isplit', + flags=bit.bor(BANG, RANGE, DFLALL, WHOLEFOLD, EXTRA), + func='ex_findpat', + }, + { + command='iunmap', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_unmap', + }, + { + command='iunabbrev', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_abbreviate', + }, + { + command='iunmenu', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_menu', + }, + { + command='join', + flags=bit.bor(BANG, RANGE, WHOLEFOLD, COUNT, EXFLAGS, TRLBAR, CMDWIN, MODIFY), + func='ex_join', + }, + { + command='jumps', + flags=bit.bor(TRLBAR, CMDWIN), + func='ex_jumps', + }, + { + command='k', + flags=bit.bor(RANGE, WORD1, TRLBAR, SBOXOK, CMDWIN), + func='ex_mark', + }, + { + command='keepmarks', + flags=bit.bor(NEEDARG, EXTRA, NOTRLCOM), + func='ex_wrongmodifier', + }, + { + command='keepjumps', + flags=bit.bor(NEEDARG, EXTRA, NOTRLCOM), + func='ex_wrongmodifier', + }, + { + command='keeppatterns', + flags=bit.bor(NEEDARG, EXTRA, NOTRLCOM), + func='ex_wrongmodifier', + }, + { + command='keepalt', + flags=bit.bor(NEEDARG, EXTRA, NOTRLCOM), + func='ex_wrongmodifier', + }, + { + command='list', + flags=bit.bor(RANGE, WHOLEFOLD, COUNT, EXFLAGS, TRLBAR, CMDWIN), + func='ex_print', + }, + { + command='lNext', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR, BANG), + func='ex_cnext', + }, + { + command='lNfile', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR, BANG), + func='ex_cnext', + }, + { + command='last', + flags=bit.bor(EXTRA, BANG, EDITCMD, ARGOPT, TRLBAR), + func='ex_last', + }, + { + command='language', + flags=bit.bor(EXTRA, TRLBAR, CMDWIN), + func='ex_language', + }, + { + command='laddexpr', + flags=bit.bor(NEEDARG, WORD1, NOTRLCOM, TRLBAR), + func='ex_cexpr', + }, + { + command='laddbuffer', + flags=bit.bor(RANGE, NOTADR, WORD1, TRLBAR), + func='ex_cbuffer', + }, + { + command='laddfile', + flags=bit.bor(TRLBAR, FILE1), + func='ex_cfile', + }, + { + command='later', + flags=bit.bor(TRLBAR, EXTRA, NOSPC, CMDWIN), + func='ex_later', + }, + { + command='lbuffer', + flags=bit.bor(BANG, RANGE, NOTADR, WORD1, TRLBAR), + func='ex_cbuffer', + }, + { + command='lcd', + flags=bit.bor(BANG, FILE1, TRLBAR, CMDWIN), + func='ex_cd', + }, + { + command='lchdir', + flags=bit.bor(BANG, FILE1, TRLBAR, CMDWIN), + func='ex_cd', + }, + { + command='lclose', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR), + func='ex_cclose', + }, + { + command='lcscope', + flags=bit.bor(EXTRA, NOTRLCOM, XFILE), + func='do_cscope', + }, + { + command='left', + flags=bit.bor(TRLBAR, RANGE, WHOLEFOLD, EXTRA, CMDWIN, MODIFY), + func='ex_align', + }, + { + command='leftabove', + flags=bit.bor(NEEDARG, EXTRA, NOTRLCOM), + func='ex_wrongmodifier', + }, + { + command='let', + flags=bit.bor(EXTRA, NOTRLCOM, SBOXOK, CMDWIN), + func='ex_let', + }, + { + command='lexpr', + flags=bit.bor(NEEDARG, WORD1, NOTRLCOM, TRLBAR, BANG), + func='ex_cexpr', + }, + { + command='lfile', + flags=bit.bor(TRLBAR, FILE1, BANG), + func='ex_cfile', + }, + { + command='lfirst', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR, BANG), + func='ex_cc', + }, + { + command='lgetfile', + flags=bit.bor(TRLBAR, FILE1), + func='ex_cfile', + }, + { + command='lgetbuffer', + flags=bit.bor(RANGE, NOTADR, WORD1, TRLBAR), + func='ex_cbuffer', + }, + { + command='lgetexpr', + flags=bit.bor(NEEDARG, WORD1, NOTRLCOM, TRLBAR), + func='ex_cexpr', + }, + { + command='lgrep', + flags=bit.bor(RANGE, NOTADR, BANG, NEEDARG, EXTRA, NOTRLCOM, TRLBAR, XFILE), + func='ex_make', + }, + { + command='lgrepadd', + flags=bit.bor(RANGE, NOTADR, BANG, NEEDARG, EXTRA, NOTRLCOM, TRLBAR, XFILE), + func='ex_make', + }, + { + command='lhelpgrep', + flags=bit.bor(EXTRA, NOTRLCOM, NEEDARG), + func='ex_helpgrep', + }, + { + command='ll', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR, BANG), + func='ex_cc', + }, + { + command='llast', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR, BANG), + func='ex_cc', + }, + { + command='llist', + flags=bit.bor(BANG, EXTRA, TRLBAR, CMDWIN), + func='qf_list', + }, + { + command='lmap', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_map', + }, + { + command='lmapclear', + flags=bit.bor(EXTRA, TRLBAR, CMDWIN), + func='ex_mapclear', + }, + { + command='lmake', + flags=bit.bor(BANG, EXTRA, NOTRLCOM, TRLBAR, XFILE), + func='ex_make', + }, + { + command='lnoremap', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_map', + }, + { + command='lnext', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR, BANG), + func='ex_cnext', + }, + { + command='lnewer', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR), + func='qf_age', + }, + { + command='lnfile', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR, BANG), + func='ex_cnext', + }, + { + command='loadview', + flags=bit.bor(FILE1, TRLBAR), + func='ex_loadview', + }, + { + command='loadkeymap', + flags=bit.bor(CMDWIN), + func='ex_loadkeymap', + }, + { + command='lockmarks', + flags=bit.bor(NEEDARG, EXTRA, NOTRLCOM), + func='ex_wrongmodifier', + }, + { + command='lockvar', + flags=bit.bor(BANG, EXTRA, NEEDARG, SBOXOK, CMDWIN), + func='ex_lockvar', + }, + { + command='lolder', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR), + func='qf_age', + }, + { + command='lopen', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR), + func='ex_copen', + }, + { + command='lprevious', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR, BANG), + func='ex_cnext', + }, + { + command='lpfile', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR, BANG), + func='ex_cnext', + }, + { + command='lrewind', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR, BANG), + func='ex_cc', + }, + { + command='ltag', + flags=bit.bor(NOTADR, TRLBAR, BANG, WORD1), + func='ex_tag', + }, + { + command='lunmap', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_unmap', + }, + { + command='lvimgrep', + flags=bit.bor(RANGE, NOTADR, BANG, NEEDARG, EXTRA, NOTRLCOM, TRLBAR, XFILE), + func='ex_vimgrep', + }, + { + command='lvimgrepadd', + flags=bit.bor(RANGE, NOTADR, BANG, NEEDARG, EXTRA, NOTRLCOM, TRLBAR, XFILE), + func='ex_vimgrep', + }, + { + command='lwindow', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR), + func='ex_cwindow', + }, + { + command='ls', + flags=bit.bor(BANG, TRLBAR, CMDWIN), + func='buflist_list', + }, + { + command='move', + flags=bit.bor(RANGE, WHOLEFOLD, EXTRA, TRLBAR, CMDWIN, MODIFY), + func='ex_copymove', + }, + { + command='mark', + flags=bit.bor(RANGE, WORD1, TRLBAR, SBOXOK, CMDWIN), + func='ex_mark', + }, + { + command='make', + flags=bit.bor(BANG, EXTRA, NOTRLCOM, TRLBAR, XFILE), + func='ex_make', + }, + { + command='map', + flags=bit.bor(BANG, EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_map', + }, + { + command='mapclear', + flags=bit.bor(EXTRA, BANG, TRLBAR, CMDWIN), + func='ex_mapclear', + }, + { + command='marks', + flags=bit.bor(EXTRA, TRLBAR, CMDWIN), + func='do_marks', + }, + { + command='match', + flags=bit.bor(RANGE, NOTADR, EXTRA, CMDWIN), + func='ex_match', + }, + { + command='menu', + flags=bit.bor(RANGE, NOTADR, ZEROR, BANG, EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_menu', + }, + { + command='menutranslate', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_menutranslate', + }, + { + command='messages', + flags=bit.bor(TRLBAR, CMDWIN), + func='ex_messages', + }, + { + command='mkexrc', + flags=bit.bor(BANG, FILE1, TRLBAR, CMDWIN), + func='ex_mkrc', + }, + { + command='mksession', + flags=bit.bor(BANG, FILE1, TRLBAR), + func='ex_mkrc', + }, + { + command='mkspell', + flags=bit.bor(BANG, NEEDARG, EXTRA, NOTRLCOM, TRLBAR, XFILE), + func='ex_mkspell', + }, + { + command='mkvimrc', + flags=bit.bor(BANG, FILE1, TRLBAR, CMDWIN), + func='ex_mkrc', + }, + { + command='mkview', + flags=bit.bor(BANG, FILE1, TRLBAR), + func='ex_mkrc', + }, + { + command='mode', + flags=bit.bor(WORD1, TRLBAR, CMDWIN), + func='ex_mode', + }, + { + command='next', + flags=bit.bor(RANGE, NOTADR, BANG, FILES, EDITCMD, ARGOPT, TRLBAR), + func='ex_next', + }, + { + command='nbkey', + flags=bit.bor(EXTRA, NOTADR, NEEDARG), + func='ex_nbkey', + }, + { + command='nbclose', + flags=bit.bor(TRLBAR, CMDWIN), + func='ex_nbclose', + }, + { + command='nbstart', + flags=bit.bor(WORD1, TRLBAR, CMDWIN), + func='ex_nbstart', + }, + { + command='new', + flags=bit.bor(BANG, FILE1, RANGE, NOTADR, EDITCMD, ARGOPT, TRLBAR), + func='ex_splitview', + }, + { + command='nmap', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_map', + }, + { + command='nmapclear', + flags=bit.bor(EXTRA, TRLBAR, CMDWIN), + func='ex_mapclear', + }, + { + command='nmenu', + flags=bit.bor(RANGE, NOTADR, ZEROR, EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_menu', + }, + { + command='nnoremap', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_map', + }, + { + command='nnoremenu', + flags=bit.bor(RANGE, NOTADR, ZEROR, EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_menu', + }, + { + command='noremap', + flags=bit.bor(BANG, EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_map', + }, + { + command='noautocmd', + flags=bit.bor(NEEDARG, EXTRA, NOTRLCOM), + func='ex_wrongmodifier', + }, + { + command='nohlsearch', + flags=bit.bor(TRLBAR, SBOXOK, CMDWIN), + func='ex_nohlsearch', + }, + { + command='noreabbrev', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_abbreviate', + }, + { + command='noremenu', + flags=bit.bor(RANGE, NOTADR, ZEROR, BANG, EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_menu', + }, + { + command='noswapfile', + flags=bit.bor(NEEDARG, EXTRA, NOTRLCOM), + func='ex_wrongmodifier', + }, + { + command='normal', + flags=bit.bor(RANGE, BANG, EXTRA, NEEDARG, NOTRLCOM, USECTRLV, SBOXOK, CMDWIN), + func='ex_normal', + }, + { + command='number', + flags=bit.bor(RANGE, WHOLEFOLD, COUNT, EXFLAGS, TRLBAR, CMDWIN), + func='ex_print', + }, + { + command='nunmap', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_unmap', + }, + { + command='nunmenu', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_menu', + }, + { + command='open', + flags=bit.bor(RANGE, BANG, EXTRA), + func='ex_open', + }, + { + command='oldfiles', + flags=bit.bor(BANG, TRLBAR, SBOXOK, CMDWIN), + func='ex_oldfiles', + }, + { + command='omap', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_map', + }, + { + command='omapclear', + flags=bit.bor(EXTRA, TRLBAR, CMDWIN), + func='ex_mapclear', + }, + { + command='omenu', + flags=bit.bor(RANGE, NOTADR, ZEROR, EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_menu', + }, + { + command='only', + flags=bit.bor(BANG, TRLBAR), + func='ex_only', + }, + { + command='onoremap', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_map', + }, + { + command='onoremenu', + flags=bit.bor(RANGE, NOTADR, ZEROR, EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_menu', + }, + { + command='options', + flags=bit.bor(TRLBAR), + func='ex_options', + }, + { + command='ounmap', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_unmap', + }, + { + command='ounmenu', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_menu', + }, + { + command='ownsyntax', + flags=bit.bor(EXTRA, NOTRLCOM, SBOXOK, CMDWIN), + func='ex_ownsyntax', + }, + { + command='print', + flags=bit.bor(RANGE, WHOLEFOLD, COUNT, EXFLAGS, TRLBAR, CMDWIN, SBOXOK), + func='ex_print', + }, + { + command='pclose', + flags=bit.bor(BANG, TRLBAR), + func='ex_pclose', + }, + { + command='pedit', + flags=bit.bor(BANG, FILE1, EDITCMD, ARGOPT, TRLBAR), + func='ex_pedit', + }, + { + command='pop', + flags=bit.bor(RANGE, NOTADR, BANG, COUNT, TRLBAR, ZEROR), + func='ex_tag', + }, + { + command='popup', + flags=bit.bor(NEEDARG, EXTRA, BANG, TRLBAR, NOTRLCOM, CMDWIN), + func='ex_popup', + }, + { + command='ppop', + flags=bit.bor(RANGE, NOTADR, BANG, COUNT, TRLBAR, ZEROR), + func='ex_ptag', + }, + { + command='preserve', + flags=bit.bor(TRLBAR), + func='ex_preserve', + }, + { + command='previous', + flags=bit.bor(EXTRA, RANGE, NOTADR, COUNT, BANG, EDITCMD, ARGOPT, TRLBAR), + func='ex_previous', + }, + { + command='promptfind', + flags=bit.bor(EXTRA, NOTRLCOM, CMDWIN), + func='gui_mch_find_dialog', + }, + { + command='promptrepl', + flags=bit.bor(EXTRA, NOTRLCOM, CMDWIN), + func='gui_mch_replace_dialog', + }, + { + command='profile', + flags=bit.bor(BANG, EXTRA, TRLBAR, CMDWIN), + func='ex_profile', + }, + { + command='profdel', + flags=bit.bor(EXTRA, TRLBAR, CMDWIN), + func='ex_breakdel', + }, + { + command='psearch', + flags=bit.bor(BANG, RANGE, WHOLEFOLD, DFLALL, EXTRA), + func='ex_psearch', + }, + { + command='ptag', + flags=bit.bor(RANGE, NOTADR, BANG, WORD1, TRLBAR, ZEROR), + func='ex_ptag', + }, + { + command='ptNext', + flags=bit.bor(RANGE, NOTADR, BANG, TRLBAR, ZEROR), + func='ex_ptag', + }, + { + command='ptfirst', + flags=bit.bor(RANGE, NOTADR, BANG, TRLBAR, ZEROR), + func='ex_ptag', + }, + { + command='ptjump', + flags=bit.bor(BANG, TRLBAR, WORD1), + func='ex_ptag', + }, + { + command='ptlast', + flags=bit.bor(BANG, TRLBAR), + func='ex_ptag', + }, + { + command='ptnext', + flags=bit.bor(RANGE, NOTADR, BANG, TRLBAR, ZEROR), + func='ex_ptag', + }, + { + command='ptprevious', + flags=bit.bor(RANGE, NOTADR, BANG, TRLBAR, ZEROR), + func='ex_ptag', + }, + { + command='ptrewind', + flags=bit.bor(RANGE, NOTADR, BANG, TRLBAR, ZEROR), + func='ex_ptag', + }, + { + command='ptselect', + flags=bit.bor(BANG, TRLBAR, WORD1), + func='ex_ptag', + }, + { + command='put', + flags=bit.bor(RANGE, WHOLEFOLD, BANG, REGSTR, TRLBAR, ZEROR, CMDWIN, MODIFY), + func='ex_put', + }, + { + command='pwd', + flags=bit.bor(TRLBAR, CMDWIN), + func='ex_pwd', + }, + { + command='python', + flags=bit.bor(RANGE, EXTRA, NEEDARG, CMDWIN), + func='ex_python', + }, + { + command='pydo', + flags=bit.bor(RANGE, DFLALL, EXTRA, NEEDARG, CMDWIN), + func='ex_pydo', + }, + { + command='pyfile', + flags=bit.bor(RANGE, FILE1, NEEDARG, CMDWIN), + func='ex_pyfile', + }, + { + command='quit', + flags=bit.bor(BANG, TRLBAR, CMDWIN), + func='ex_quit', + }, + { + command='quitall', + flags=bit.bor(BANG, TRLBAR), + func='ex_quit_all', + }, + { + command='qall', + flags=bit.bor(BANG, TRLBAR, CMDWIN), + func='ex_quit_all', + }, + { + command='read', + flags=bit.bor(BANG, RANGE, WHOLEFOLD, FILE1, ARGOPT, TRLBAR, ZEROR, CMDWIN, MODIFY), + func='ex_read', + }, + { + command='recover', + flags=bit.bor(BANG, FILE1, TRLBAR), + func='ex_recover', + }, + { + command='redo', + flags=bit.bor(TRLBAR, CMDWIN), + func='ex_redo', + }, + { + command='redir', + flags=bit.bor(BANG, FILES, TRLBAR, CMDWIN), + func='ex_redir', + }, + { + command='redraw', + flags=bit.bor(BANG, TRLBAR, CMDWIN), + func='ex_redraw', + }, + { + command='redrawstatus', + flags=bit.bor(BANG, TRLBAR, CMDWIN), + func='ex_redrawstatus', + }, + { + command='registers', + flags=bit.bor(EXTRA, NOTRLCOM, TRLBAR, CMDWIN), + func='ex_display', + }, + { + command='resize', + flags=bit.bor(RANGE, NOTADR, TRLBAR, WORD1), + func='ex_resize', + }, + { + command='retab', + flags=bit.bor(TRLBAR, RANGE, WHOLEFOLD, DFLALL, BANG, WORD1, CMDWIN, MODIFY), + func='ex_retab', + }, + { + command='return', + flags=bit.bor(EXTRA, NOTRLCOM, SBOXOK, CMDWIN), + func='ex_return', + }, + { + command='rewind', + flags=bit.bor(EXTRA, BANG, EDITCMD, ARGOPT, TRLBAR), + func='ex_rewind', + }, + { + command='right', + flags=bit.bor(TRLBAR, RANGE, WHOLEFOLD, EXTRA, CMDWIN, MODIFY), + func='ex_align', + }, + { + command='rightbelow', + flags=bit.bor(NEEDARG, EXTRA, NOTRLCOM), + func='ex_wrongmodifier', + }, + { + command='runtime', + flags=bit.bor(BANG, NEEDARG, FILES, TRLBAR, SBOXOK, CMDWIN), + func='ex_runtime', + }, + { + command='rundo', + flags=bit.bor(NEEDARG, FILE1), + func='ex_rundo', + }, + { + command='rviminfo', + flags=bit.bor(BANG, FILE1, TRLBAR, CMDWIN), + func='ex_viminfo', + }, + { + command='substitute', + flags=bit.bor(RANGE, WHOLEFOLD, EXTRA, CMDWIN), + func='do_sub', + }, + { + command='sNext', + flags=bit.bor(EXTRA, RANGE, NOTADR, COUNT, BANG, EDITCMD, ARGOPT, TRLBAR), + func='ex_previous', + }, + { + command='sargument', + flags=bit.bor(BANG, RANGE, NOTADR, COUNT, EXTRA, EDITCMD, ARGOPT, TRLBAR), + func='ex_argument', + }, + { + command='sall', + flags=bit.bor(BANG, RANGE, NOTADR, COUNT, TRLBAR), + func='ex_all', + }, + { + command='sandbox', + flags=bit.bor(NEEDARG, EXTRA, NOTRLCOM), + func='ex_wrongmodifier', + }, + { + command='saveas', + flags=bit.bor(BANG, DFLALL, FILE1, ARGOPT, CMDWIN, TRLBAR), + func='ex_write', + }, + { + command='sbuffer', + flags=bit.bor(BANG, RANGE, NOTADR, BUFNAME, BUFUNL, COUNT, EXTRA, TRLBAR), + func='ex_buffer', + }, + { + command='sbNext', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR), + func='ex_bprevious', + }, + { + command='sball', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR), + func='ex_buffer_all', + }, + { + command='sbfirst', + flags=bit.bor(TRLBAR), + func='ex_brewind', + }, + { + command='sblast', + flags=bit.bor(TRLBAR), + func='ex_blast', + }, + { + command='sbmodified', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR), + func='ex_bmodified', + }, + { + command='sbnext', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR), + func='ex_bnext', + }, + { + command='sbprevious', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR), + func='ex_bprevious', + }, + { + command='sbrewind', + flags=bit.bor(TRLBAR), + func='ex_brewind', + }, + { + command='scriptnames', + flags=bit.bor(TRLBAR, CMDWIN), + func='ex_scriptnames', + }, + { + command='scriptencoding', + flags=bit.bor(WORD1, TRLBAR, CMDWIN), + func='ex_scriptencoding', + }, + { + command='scscope', + flags=bit.bor(EXTRA, NOTRLCOM), + func='do_scscope', + }, + { + command='set', + flags=bit.bor(TRLBAR, EXTRA, CMDWIN, SBOXOK), + func='ex_set', + }, + { + command='setfiletype', + flags=bit.bor(TRLBAR, EXTRA, NEEDARG, CMDWIN), + func='ex_setfiletype', + }, + { + command='setglobal', + flags=bit.bor(TRLBAR, EXTRA, CMDWIN, SBOXOK), + func='ex_set', + }, + { + command='setlocal', + flags=bit.bor(TRLBAR, EXTRA, CMDWIN, SBOXOK), + func='ex_set', + }, + { + command='sfind', + flags=bit.bor(BANG, FILE1, RANGE, NOTADR, EDITCMD, ARGOPT, TRLBAR), + func='ex_splitview', + }, + { + command='sfirst', + flags=bit.bor(EXTRA, BANG, EDITCMD, ARGOPT, TRLBAR), + func='ex_rewind', + }, + { + command='simalt', + flags=bit.bor(NEEDARG, WORD1, TRLBAR, CMDWIN), + func='ex_simalt', + }, + { + command='sign', + flags=bit.bor(NEEDARG, RANGE, NOTADR, EXTRA, CMDWIN), + func='ex_sign', + }, + { + command='silent', + flags=bit.bor(NEEDARG, EXTRA, BANG, NOTRLCOM, SBOXOK, CMDWIN), + func='ex_wrongmodifier', + }, + { + command='sleep', + flags=bit.bor(RANGE, NOTADR, COUNT, EXTRA, TRLBAR, CMDWIN), + func='ex_sleep', + }, + { + command='slast', + flags=bit.bor(EXTRA, BANG, EDITCMD, ARGOPT, TRLBAR), + func='ex_last', + }, + { + command='smagic', + flags=bit.bor(RANGE, WHOLEFOLD, EXTRA, CMDWIN), + func='ex_submagic', + }, + { + command='smap', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_map', + }, + { + command='smapclear', + flags=bit.bor(EXTRA, TRLBAR, CMDWIN), + func='ex_mapclear', + }, + { + command='smenu', + flags=bit.bor(RANGE, NOTADR, ZEROR, EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_menu', + }, + { + command='snext', + flags=bit.bor(RANGE, NOTADR, BANG, FILES, EDITCMD, ARGOPT, TRLBAR), + func='ex_next', + }, + { + command='snomagic', + flags=bit.bor(RANGE, WHOLEFOLD, EXTRA, CMDWIN), + func='ex_submagic', + }, + { + command='snoremap', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_map', + }, + { + command='snoremenu', + flags=bit.bor(RANGE, NOTADR, ZEROR, EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_menu', + }, + { + command='source', + flags=bit.bor(BANG, FILE1, TRLBAR, SBOXOK, CMDWIN), + func='ex_source', + }, + { + command='sort', + flags=bit.bor(RANGE, DFLALL, WHOLEFOLD, BANG, EXTRA, NOTRLCOM, MODIFY), + func='ex_sort', + }, + { + command='split', + flags=bit.bor(BANG, FILE1, RANGE, NOTADR, EDITCMD, ARGOPT, TRLBAR), + func='ex_splitview', + }, + { + command='spellgood', + flags=bit.bor(BANG, RANGE, NOTADR, NEEDARG, EXTRA, TRLBAR), + func='ex_spell', + }, + { + command='spelldump', + flags=bit.bor(BANG, TRLBAR), + func='ex_spelldump', + }, + { + command='spellinfo', + flags=bit.bor(TRLBAR), + func='ex_spellinfo', + }, + { + command='spellrepall', + flags=bit.bor(TRLBAR), + func='ex_spellrepall', + }, + { + command='spellundo', + flags=bit.bor(BANG, RANGE, NOTADR, NEEDARG, EXTRA, TRLBAR), + func='ex_spell', + }, + { + command='spellwrong', + flags=bit.bor(BANG, RANGE, NOTADR, NEEDARG, EXTRA, TRLBAR), + func='ex_spell', + }, + { + command='sprevious', + flags=bit.bor(EXTRA, RANGE, NOTADR, COUNT, BANG, EDITCMD, ARGOPT, TRLBAR), + func='ex_previous', + }, + { + command='srewind', + flags=bit.bor(EXTRA, BANG, EDITCMD, ARGOPT, TRLBAR), + func='ex_rewind', + }, + { + command='stop', + flags=bit.bor(TRLBAR, BANG, CMDWIN), + func='ex_stop', + }, + { + command='stag', + flags=bit.bor(RANGE, NOTADR, BANG, WORD1, TRLBAR, ZEROR), + func='ex_stag', + }, + { + command='startinsert', + flags=bit.bor(BANG, TRLBAR, CMDWIN), + func='ex_startinsert', + }, + { + command='startgreplace', + flags=bit.bor(BANG, TRLBAR, CMDWIN), + func='ex_startinsert', + }, + { + command='startreplace', + flags=bit.bor(BANG, TRLBAR, CMDWIN), + func='ex_startinsert', + }, + { + command='stopinsert', + flags=bit.bor(BANG, TRLBAR, CMDWIN), + func='ex_stopinsert', + }, + { + command='stjump', + flags=bit.bor(BANG, TRLBAR, WORD1), + func='ex_stag', + }, + { + command='stselect', + flags=bit.bor(BANG, TRLBAR, WORD1), + func='ex_stag', + }, + { + command='sunhide', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR), + func='ex_buffer_all', + }, + { + command='sunmap', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_unmap', + }, + { + command='sunmenu', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_menu', + }, + { + command='suspend', + flags=bit.bor(TRLBAR, BANG, CMDWIN), + func='ex_stop', + }, + { + command='sview', + flags=bit.bor(BANG, FILE1, RANGE, NOTADR, EDITCMD, ARGOPT, TRLBAR), + func='ex_splitview', + }, + { + command='swapname', + flags=bit.bor(TRLBAR, CMDWIN), + func='ex_swapname', + }, + { + command='syntax', + flags=bit.bor(EXTRA, NOTRLCOM, CMDWIN), + func='ex_syntax', + }, + { + command='syntime', + flags=bit.bor(NEEDARG, WORD1, TRLBAR, CMDWIN), + func='ex_syntime', + }, + { + command='syncbind', + flags=bit.bor(TRLBAR), + func='ex_syncbind', + }, + { + command='t', + flags=bit.bor(RANGE, WHOLEFOLD, EXTRA, TRLBAR, CMDWIN, MODIFY), + func='ex_copymove', + }, + { + command='tNext', + flags=bit.bor(RANGE, NOTADR, BANG, TRLBAR, ZEROR), + func='ex_tag', + }, + { + command='tag', + flags=bit.bor(RANGE, NOTADR, BANG, WORD1, TRLBAR, ZEROR), + func='ex_tag', + }, + { + command='tags', + flags=bit.bor(TRLBAR, CMDWIN), + func='do_tags', + }, + { + command='tab', + flags=bit.bor(NEEDARG, EXTRA, NOTRLCOM), + func='ex_wrongmodifier', + }, + { + command='tabclose', + flags=bit.bor(RANGE, NOTADR, COUNT, BANG, TRLBAR, CMDWIN), + func='ex_tabclose', + }, + { + command='tabdo', + flags=bit.bor(NEEDARG, EXTRA, NOTRLCOM), + func='ex_listdo', + }, + { + command='tabedit', + flags=bit.bor(BANG, FILE1, RANGE, NOTADR, ZEROR, EDITCMD, ARGOPT, TRLBAR), + func='ex_splitview', + }, + { + command='tabfind', + flags=bit.bor(BANG, FILE1, RANGE, NOTADR, ZEROR, EDITCMD, ARGOPT, NEEDARG, TRLBAR), + func='ex_splitview', + }, + { + command='tabfirst', + flags=bit.bor(TRLBAR), + func='ex_tabnext', + }, + { + command='tabmove', + flags=bit.bor(RANGE, NOTADR, ZEROR, EXTRA, NOSPC, TRLBAR), + func='ex_tabmove', + }, + { + command='tablast', + flags=bit.bor(TRLBAR), + func='ex_tabnext', + }, + { + command='tabnext', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR), + func='ex_tabnext', + }, + { + command='tabnew', + flags=bit.bor(BANG, FILE1, RANGE, NOTADR, ZEROR, EDITCMD, ARGOPT, TRLBAR), + func='ex_splitview', + }, + { + command='tabonly', + flags=bit.bor(BANG, TRLBAR, CMDWIN), + func='ex_tabonly', + }, + { + command='tabprevious', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR), + func='ex_tabnext', + }, + { + command='tabNext', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR), + func='ex_tabnext', + }, + { + command='tabrewind', + flags=bit.bor(TRLBAR), + func='ex_tabnext', + }, + { + command='tabs', + flags=bit.bor(TRLBAR, CMDWIN), + func='ex_tabs', + }, + { + command='tearoff', + flags=bit.bor(NEEDARG, EXTRA, TRLBAR, NOTRLCOM, CMDWIN), + func='ex_tearoff', + }, + { + command='tfirst', + flags=bit.bor(RANGE, NOTADR, BANG, TRLBAR, ZEROR), + func='ex_tag', + }, + { + command='throw', + flags=bit.bor(EXTRA, NEEDARG, SBOXOK, CMDWIN), + func='ex_throw', + }, + { + command='tjump', + flags=bit.bor(BANG, TRLBAR, WORD1), + func='ex_tag', + }, + { + command='tlast', + flags=bit.bor(BANG, TRLBAR), + func='ex_tag', + }, + { + command='tmenu', + flags=bit.bor(RANGE, NOTADR, ZEROR, EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_menu', + }, + { + command='tnext', + flags=bit.bor(RANGE, NOTADR, BANG, TRLBAR, ZEROR), + func='ex_tag', + }, + { + command='topleft', + flags=bit.bor(NEEDARG, EXTRA, NOTRLCOM), + func='ex_wrongmodifier', + }, + { + command='tprevious', + flags=bit.bor(RANGE, NOTADR, BANG, TRLBAR, ZEROR), + func='ex_tag', + }, + { + command='trewind', + flags=bit.bor(RANGE, NOTADR, BANG, TRLBAR, ZEROR), + func='ex_tag', + }, + { + command='try', + flags=bit.bor(TRLBAR, SBOXOK, CMDWIN), + func='ex_try', + }, + { + command='tselect', + flags=bit.bor(BANG, TRLBAR, WORD1), + func='ex_tag', + }, + { + command='tunmenu', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_menu', + }, + { + command='undo', + flags=bit.bor(RANGE, NOTADR, COUNT, ZEROR, TRLBAR, CMDWIN), + func='ex_undo', + }, + { + command='undojoin', + flags=bit.bor(TRLBAR, CMDWIN), + func='ex_undojoin', + }, + { + command='undolist', + flags=bit.bor(TRLBAR, CMDWIN), + func='ex_undolist', + }, + { + command='unabbreviate', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_abbreviate', + }, + { + command='unhide', + flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR), + func='ex_buffer_all', + }, + { + command='unlet', + flags=bit.bor(BANG, EXTRA, NEEDARG, SBOXOK, CMDWIN), + func='ex_unlet', + }, + { + command='unlockvar', + flags=bit.bor(BANG, EXTRA, NEEDARG, SBOXOK, CMDWIN), + func='ex_lockvar', + }, + { + command='unmap', + flags=bit.bor(BANG, EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_unmap', + }, + { + command='unmenu', + flags=bit.bor(BANG, EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_menu', + }, + { + command='unsilent', + flags=bit.bor(NEEDARG, EXTRA, NOTRLCOM, SBOXOK, CMDWIN), + func='ex_wrongmodifier', + }, + { + command='update', + flags=bit.bor(RANGE, WHOLEFOLD, BANG, FILE1, ARGOPT, DFLALL, TRLBAR), + func='ex_update', + }, + { + command='vglobal', + flags=bit.bor(RANGE, WHOLEFOLD, EXTRA, DFLALL, CMDWIN), + func='ex_global', + }, + { + command='version', + flags=bit.bor(EXTRA, TRLBAR, CMDWIN), + func='ex_version', + }, + { + command='verbose', + flags=bit.bor(NEEDARG, RANGE, NOTADR, EXTRA, NOTRLCOM, SBOXOK, CMDWIN), + func='ex_wrongmodifier', + }, + { + command='vertical', + flags=bit.bor(NEEDARG, EXTRA, NOTRLCOM), + func='ex_wrongmodifier', + }, + { + command='visual', + flags=bit.bor(BANG, FILE1, EDITCMD, ARGOPT, TRLBAR), + func='ex_edit', + }, + { + command='view', + flags=bit.bor(BANG, FILE1, EDITCMD, ARGOPT, TRLBAR), + func='ex_edit', + }, + { + command='vimgrep', + flags=bit.bor(RANGE, NOTADR, BANG, NEEDARG, EXTRA, NOTRLCOM, TRLBAR, XFILE), + func='ex_vimgrep', + }, + { + command='vimgrepadd', + flags=bit.bor(RANGE, NOTADR, BANG, NEEDARG, EXTRA, NOTRLCOM, TRLBAR, XFILE), + func='ex_vimgrep', + }, + { + command='viusage', + flags=bit.bor(TRLBAR), + func='ex_viusage', + }, + { + command='vmap', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_map', + }, + { + command='vmapclear', + flags=bit.bor(EXTRA, TRLBAR, CMDWIN), + func='ex_mapclear', + }, + { + command='vmenu', + flags=bit.bor(RANGE, NOTADR, ZEROR, EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_menu', + }, + { + command='vnoremap', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_map', + }, + { + command='vnew', + flags=bit.bor(BANG, FILE1, RANGE, NOTADR, EDITCMD, ARGOPT, TRLBAR), + func='ex_splitview', + }, + { + command='vnoremenu', + flags=bit.bor(RANGE, NOTADR, ZEROR, EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_menu', + }, + { + command='vsplit', + flags=bit.bor(BANG, FILE1, RANGE, NOTADR, EDITCMD, ARGOPT, TRLBAR), + func='ex_splitview', + }, + { + command='vunmap', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_unmap', + }, + { + command='vunmenu', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_menu', + }, + { + command='write', + flags=bit.bor(RANGE, WHOLEFOLD, BANG, FILE1, ARGOPT, DFLALL, TRLBAR, CMDWIN), + func='ex_write', + }, + { + command='wNext', + flags=bit.bor(RANGE, WHOLEFOLD, NOTADR, BANG, FILE1, ARGOPT, TRLBAR), + func='ex_wnext', + }, + { + command='wall', + flags=bit.bor(BANG, TRLBAR, CMDWIN), + func='do_wqall', + }, + { + command='while', + flags=bit.bor(EXTRA, NOTRLCOM, SBOXOK, CMDWIN), + func='ex_while', + }, + { + command='winsize', + flags=bit.bor(EXTRA, NEEDARG, TRLBAR), + func='ex_winsize', + }, + { + command='wincmd', + flags=bit.bor(NEEDARG, WORD1, RANGE, NOTADR), + func='ex_wincmd', + }, + { + command='windo', + flags=bit.bor(BANG, NEEDARG, EXTRA, NOTRLCOM), + func='ex_listdo', + }, + { + command='winpos', + flags=bit.bor(EXTRA, TRLBAR, CMDWIN), + func='ex_winpos', + }, + { + command='wnext', + flags=bit.bor(RANGE, NOTADR, BANG, FILE1, ARGOPT, TRLBAR), + func='ex_wnext', + }, + { + command='wprevious', + flags=bit.bor(RANGE, NOTADR, BANG, FILE1, ARGOPT, TRLBAR), + func='ex_wnext', + }, + { + command='wq', + flags=bit.bor(RANGE, WHOLEFOLD, BANG, FILE1, ARGOPT, DFLALL, TRLBAR), + func='ex_exit', + }, + { + command='wqall', + flags=bit.bor(BANG, FILE1, ARGOPT, DFLALL, TRLBAR), + func='do_wqall', + }, + { + command='wsverb', + flags=bit.bor(EXTRA, NOTADR, NEEDARG), + func='ex_wsverb', + }, + { + command='wundo', + flags=bit.bor(BANG, NEEDARG, FILE1), + func='ex_wundo', + }, + { + command='wviminfo', + flags=bit.bor(BANG, FILE1, TRLBAR, CMDWIN), + func='ex_viminfo', + }, + { + command='xit', + flags=bit.bor(RANGE, WHOLEFOLD, BANG, FILE1, ARGOPT, DFLALL, TRLBAR, CMDWIN), + func='ex_exit', + }, + { + command='xall', + flags=bit.bor(BANG, TRLBAR), + func='do_wqall', + }, + { + command='xmap', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_map', + }, + { + command='xmapclear', + flags=bit.bor(EXTRA, TRLBAR, CMDWIN), + func='ex_mapclear', + }, + { + command='xmenu', + flags=bit.bor(RANGE, NOTADR, ZEROR, EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_menu', + }, + { + command='xnoremap', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_map', + }, + { + command='xnoremenu', + flags=bit.bor(RANGE, NOTADR, ZEROR, EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_menu', + }, + { + command='xunmap', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_unmap', + }, + { + command='xunmenu', + flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN), + func='ex_menu', + }, + { + command='yank', + flags=bit.bor(RANGE, WHOLEFOLD, REGSTR, COUNT, TRLBAR, CMDWIN), + func='ex_operators', + }, + { + command='z', + flags=bit.bor(RANGE, WHOLEFOLD, EXTRA, EXFLAGS, TRLBAR, CMDWIN), + func='ex_z', + }, + { + command='!', + enum='CMD_bang', + flags=bit.bor(RANGE, WHOLEFOLD, BANG, FILES, CMDWIN), + func='ex_bang', + }, + { + command='#', + enum='CMD_pound', + flags=bit.bor(RANGE, WHOLEFOLD, COUNT, EXFLAGS, TRLBAR, CMDWIN), + func='ex_print', + }, + { + command='&', + enum='CMD_and', + flags=bit.bor(RANGE, WHOLEFOLD, EXTRA, CMDWIN, MODIFY), + func='do_sub', + }, + { + command='*', + enum='CMD_star', + flags=bit.bor(RANGE, WHOLEFOLD, EXTRA, TRLBAR, CMDWIN), + func='ex_at', + }, + { + command='<', + enum='CMD_lshift', + flags=bit.bor(RANGE, WHOLEFOLD, COUNT, EXFLAGS, TRLBAR, CMDWIN, MODIFY), + func='ex_operators', + }, + { + command='=', + enum='CMD_equal', + flags=bit.bor(RANGE, TRLBAR, DFLALL, EXFLAGS, CMDWIN), + func='ex_equal', + }, + { + command='>', + enum='CMD_rshift', + flags=bit.bor(RANGE, WHOLEFOLD, COUNT, EXFLAGS, TRLBAR, CMDWIN, MODIFY), + func='ex_operators', + }, + { + command='@', + enum='CMD_at', + flags=bit.bor(RANGE, WHOLEFOLD, EXTRA, TRLBAR, CMDWIN), + func='ex_at', + }, + { + command='Next', + flags=bit.bor(EXTRA, RANGE, NOTADR, COUNT, BANG, EDITCMD, ARGOPT, TRLBAR), + func='ex_previous', + }, + { + command='Print', + flags=bit.bor(RANGE, WHOLEFOLD, COUNT, EXFLAGS, TRLBAR, CMDWIN), + func='ex_print', + }, + { + command='~', + enum='CMD_tilde', + flags=bit.bor(RANGE, WHOLEFOLD, EXTRA, CMDWIN, MODIFY), + func='do_sub', + }, +} diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index afbb3b40f1..e0b0b55f41 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -1044,17 +1044,18 @@ int autowrite(buf_T *buf, int forceit) */ void autowrite_all(void) { - buf_T *buf; - - if (!(p_aw || p_awa) || !p_write) + if (!(p_aw || p_awa) || !p_write) { return; - for (buf = firstbuf; buf; buf = buf->b_next) + } + + FOR_ALL_BUFFERS(buf) { if (bufIsChanged(buf) && !buf->b_p_ro) { (void)buf_write_all(buf, FALSE); /* an autocommand may have deleted the buffer */ if (!buf_valid(buf)) buf = firstbuf; } + } } /* @@ -1070,15 +1071,14 @@ int check_changed(buf_T *buf, int flags) && ((flags & CCGD_MULTWIN) || buf->b_nwindows <= 1) && (!(flags & CCGD_AW) || autowrite(buf, forceit) == FAIL)) { if ((p_confirm || cmdmod.confirm) && p_write) { - buf_T *buf2; int count = 0; if (flags & CCGD_ALLBUF) - for (buf2 = firstbuf; buf2 != NULL; buf2 = buf2->b_next) - if (bufIsChanged(buf2) - && (buf2->b_ffname != NULL - )) + FOR_ALL_BUFFERS(buf2) { + if (bufIsChanged(buf2) && (buf2->b_ffname != NULL)) { ++count; + } + } if (!buf_valid(buf)) /* Autocommand deleted buffer, oops! It's not changed now. */ return FALSE; @@ -1111,7 +1111,6 @@ dialog_changed ( { char_u buff[DIALOG_MSG_SIZE]; int ret; - buf_T *buf2; exarg_T ea; dialog_msg(buff, _("Save changes to \"%s\"?"), @@ -1139,7 +1138,7 @@ dialog_changed ( * Skip readonly buffers, these need to be confirmed * individually. */ - for (buf2 = firstbuf; buf2 != NULL; buf2 = buf2->b_next) { + FOR_ALL_BUFFERS(buf2) { if (bufIsChanged(buf2) && (buf2->b_ffname != NULL ) @@ -1157,8 +1156,9 @@ dialog_changed ( /* * mark all buffers as unchanged */ - for (buf2 = firstbuf; buf2 != NULL; buf2 = buf2->b_next) + FOR_ALL_BUFFERS(buf2) { unchanged(buf2, TRUE); + } } } @@ -1200,7 +1200,6 @@ check_changed_any ( ) { int ret = FALSE; - buf_T *buf; int save; int i; int bufnum = 0; @@ -1209,8 +1208,9 @@ check_changed_any ( tabpage_T *tp; win_T *wp; - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) { ++bufcount; + } if (bufcount == 0) return FALSE; @@ -1230,9 +1230,11 @@ check_changed_any ( for (wp = tp->tp_firstwin; wp != NULL; wp = wp->w_next) add_bufnum(bufnrs, &bufnum, wp->w_buffer->b_fnum); /* any other buf */ - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) { add_bufnum(bufnrs, &bufnum, buf->b_fnum); + } + buf_T *buf = NULL; for (i = 0; i < bufnum; ++i) { buf = buflist_findnr(bufnrs[i]); if (buf == NULL) @@ -1817,7 +1819,6 @@ void ex_listdo(exarg_T *eap) int i; win_T *wp; tabpage_T *tp; - buf_T *buf; int next_fnum = 0; char_u *save_ei = NULL; char_u *p_shm_save; @@ -1882,7 +1883,7 @@ void ex_listdo(exarg_T *eap) /* Remember the number of the next listed buffer, in case * ":bwipe" is used or autocommands do something strange. */ next_fnum = -1; - for (buf = curbuf->b_next; buf != NULL; buf = buf->b_next) + for (buf_T *buf = curbuf->b_next; buf != NULL; buf = buf->b_next) if (buf->b_p_bl) { next_fnum = buf->b_fnum; break; @@ -1897,12 +1898,18 @@ void ex_listdo(exarg_T *eap) /* Done? */ if (next_fnum < 0) break; + /* Check if the buffer still exists. */ - for (buf = firstbuf; buf != NULL; buf = buf->b_next) - if (buf->b_fnum == next_fnum) + bool buf_still_exists = false; + FOR_ALL_BUFFERS(bp) { + if (bp->b_fnum == next_fnum) { + buf_still_exists = true; break; - if (buf == NULL) + } + } + if (buf_still_exists) { break; + } /* Go to the next buffer. Clear 'shm' to avoid that the file * message overwrites any output from the command. */ diff --git a/src/nvim/ex_cmds_defs.h b/src/nvim/ex_cmds_defs.h index 52e8bb7465..abf7cc4587 100644 --- a/src/nvim/ex_cmds_defs.h +++ b/src/nvim/ex_cmds_defs.h @@ -4,35 +4,38 @@ * Do ":help uganda" in Vim to read copying and usage conditions. * Do ":help credits" in Vim to see a list of people who contributed. */ - -#if (!defined(DO_DECLARE_EXCMD) && !defined(NVIM_EX_CMDS_DEFS_H)) \ - || (defined(DO_DECLARE_EXCMD) && \ - !defined(NVIM_EX_CMDS_DEFS_H_DO_DECLARE_EXCMD)) -#ifdef DO_DECLARE_EXCMD -# define NVIM_EX_CMDS_DEFS_H_DO_DECLARE_EXCMD -#else -# define NVIM_EX_CMDS_DEFS_H -#endif +#ifndef NVIM_EX_CMDS_DEFS_H +#define NVIM_EX_CMDS_DEFS_H #include <stdbool.h> #include "nvim/pos.h" // for linenr_T #include "nvim/normal.h" -/* - * This file defines the Ex commands. - * When DO_DECLARE_EXCMD is defined, the table with ex command names and - * options results. - * When DO_DECLARE_EXCMD is NOT defined, the enum with all the Ex commands - * results. - * This clever trick was invented by Ron Aaron. - */ +#ifdef INCLUDE_GENERATED_DECLARATIONS +# include "ex_cmds_enum.generated.h" +#endif /* * When adding an Ex command: - * 1. Add an entry in the table below. Keep it sorted on the shortest - * version of the command name that works. If it doesn't start with a - * lower case letter, add it at the end. + * 1. Add an entry to the table in src/nvim/ex_cmds.lua. Keep it sorted on the + * shortest version of the command name that works. If it doesn't start with + * a lower case letter, add it at the end. + * + * Each table entry is a table with the following keys: + * + * Key | Description + * ------- | ------------------------------------------------------------- + * command | Name of the command. Required. + * enum | Name of the enum entry. If not set defaults to CMD_{command}. + * flags | A set of the flags from below list joined by bitwise or. + * func | Name of the function containing the implementation. + * + * Referenced function should be either non-static one or defined in + * ex_docmd.c and be coercible to ex_func_T type from below. + * + * All keys not described in the above table are reserved for future use. + * * 2. Add a "case: CMD_xxx" in the big switch in ex_docmd.c. * 3. Add an entry in the index for Ex commands at ":help ex-cmd-index". * 4. Add documentation in ../doc/xxx.txt. Add a tag for both the short and @@ -67,1093 +70,56 @@ #define WORD1 (EXTRA | NOSPC) /* one extra word allowed */ #define FILE1 (FILES | NOSPC) /* 1 file allowed, defaults to current file */ -#ifndef DO_DECLARE_EXCMD typedef struct exarg exarg_T; -#endif /* behavior for bad character, "++bad=" argument */ #define BAD_REPLACE '?' /* replace it with '?' (default) */ #define BAD_KEEP -1 /* leave it */ #define BAD_DROP -2 /* erase it */ -/* - * This array maps ex command names to command codes. - * The order in which command names are listed below is significant -- - * ambiguous abbreviations are always resolved to be the first possible match - * (e.g. "r" is taken to mean "read", not "rewind", because "read" comes - * before "rewind"). - * Not supported commands are included to avoid ambiguities. - */ -#ifdef EX -# undef EX /* just in case */ -#endif -#ifdef DO_DECLARE_EXCMD -# define EX(a, b, c, d) {(char_u *)b, c, (long_u)(d)} - typedef void (*ex_func_T)(exarg_T *eap); -static struct cmdname { - char_u *cmd_name; /* name of the command */ - ex_func_T cmd_func; /* function for this command */ - long_u cmd_argt; /* flags declared above */ -} -cmdnames[] = -#else -# define EX(a, b, c, d) a -enum CMD_index -#endif -{ - EX(CMD_append, "append", ex_append, - BANG|RANGE|ZEROR|TRLBAR|CMDWIN|MODIFY), - EX(CMD_abbreviate, "abbreviate", ex_abbreviate, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_abclear, "abclear", ex_abclear, - EXTRA|TRLBAR|CMDWIN), - EX(CMD_aboveleft, "aboveleft", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), - EX(CMD_all, "all", ex_all, - BANG|RANGE|NOTADR|COUNT|TRLBAR), - EX(CMD_amenu, "amenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_anoremenu, "anoremenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_args, "args", ex_args, - BANG|FILES|EDITCMD|ARGOPT|TRLBAR), - EX(CMD_argadd, "argadd", ex_argadd, - BANG|NEEDARG|RANGE|NOTADR|ZEROR|FILES|TRLBAR), - EX(CMD_argdelete, "argdelete", ex_argdelete, - BANG|RANGE|NOTADR|FILES|TRLBAR), - EX(CMD_argdo, "argdo", ex_listdo, - BANG|NEEDARG|EXTRA|NOTRLCOM), - EX(CMD_argedit, "argedit", ex_argedit, - BANG|NEEDARG|RANGE|NOTADR|FILE1|EDITCMD|ARGOPT|TRLBAR), - EX(CMD_argglobal, "argglobal", ex_args, - BANG|FILES|EDITCMD|ARGOPT|TRLBAR), - EX(CMD_arglocal, "arglocal", ex_args, - BANG|FILES|EDITCMD|ARGOPT|TRLBAR), - EX(CMD_argument, "argument", ex_argument, - BANG|RANGE|NOTADR|COUNT|EXTRA|EDITCMD|ARGOPT|TRLBAR), - EX(CMD_ascii, "ascii", do_ascii, - TRLBAR|SBOXOK|CMDWIN), - EX(CMD_autocmd, "autocmd", ex_autocmd, - BANG|EXTRA|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_augroup, "augroup", ex_autocmd, - BANG|WORD1|TRLBAR|CMDWIN), - EX(CMD_aunmenu, "aunmenu", ex_menu, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_buffer, "buffer", ex_buffer, - BANG|RANGE|NOTADR|BUFNAME|BUFUNL|COUNT|EXTRA|TRLBAR), - EX(CMD_bNext, "bNext", ex_bprevious, - BANG|RANGE|NOTADR|COUNT|TRLBAR), - EX(CMD_ball, "ball", ex_buffer_all, - RANGE|NOTADR|COUNT|TRLBAR), - EX(CMD_badd, "badd", ex_edit, - NEEDARG|FILE1|EDITCMD|TRLBAR|CMDWIN), - EX(CMD_bdelete, "bdelete", ex_bunload, - BANG|RANGE|NOTADR|BUFNAME|COUNT|EXTRA|TRLBAR), - EX(CMD_behave, "behave", ex_behave, - NEEDARG|WORD1|TRLBAR|CMDWIN), - EX(CMD_belowright, "belowright", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), - EX(CMD_bfirst, "bfirst", ex_brewind, - BANG|RANGE|NOTADR|TRLBAR), - EX(CMD_blast, "blast", ex_blast, - BANG|RANGE|NOTADR|TRLBAR), - EX(CMD_bmodified, "bmodified", ex_bmodified, - BANG|RANGE|NOTADR|COUNT|TRLBAR), - EX(CMD_bnext, "bnext", ex_bnext, - BANG|RANGE|NOTADR|COUNT|TRLBAR), - EX(CMD_botright, "botright", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), - EX(CMD_bprevious, "bprevious", ex_bprevious, - BANG|RANGE|NOTADR|COUNT|TRLBAR), - EX(CMD_brewind, "brewind", ex_brewind, - BANG|RANGE|NOTADR|TRLBAR), - EX(CMD_break, "break", ex_break, - TRLBAR|SBOXOK|CMDWIN), - EX(CMD_breakadd, "breakadd", ex_breakadd, - EXTRA|TRLBAR|CMDWIN), - EX(CMD_breakdel, "breakdel", ex_breakdel, - EXTRA|TRLBAR|CMDWIN), - EX(CMD_breaklist, "breaklist", ex_breaklist, - EXTRA|TRLBAR|CMDWIN), - EX(CMD_browse, "browse", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM|CMDWIN), - EX(CMD_buffers, "buffers", buflist_list, - BANG|TRLBAR|CMDWIN), - EX(CMD_bufdo, "bufdo", ex_listdo, - BANG|NEEDARG|EXTRA|NOTRLCOM), - EX(CMD_bunload, "bunload", ex_bunload, - BANG|RANGE|NOTADR|BUFNAME|COUNT|EXTRA|TRLBAR), - EX(CMD_bwipeout, "bwipeout", ex_bunload, - BANG|RANGE|NOTADR|BUFNAME|BUFUNL|COUNT|EXTRA|TRLBAR), - EX(CMD_change, "change", ex_change, - BANG|WHOLEFOLD|RANGE|COUNT|TRLBAR|CMDWIN|MODIFY), - EX(CMD_cNext, "cNext", ex_cnext, - RANGE|NOTADR|COUNT|TRLBAR|BANG), - EX(CMD_cNfile, "cNfile", ex_cnext, - RANGE|NOTADR|COUNT|TRLBAR|BANG), - EX(CMD_cabbrev, "cabbrev", ex_abbreviate, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_cabclear, "cabclear", ex_abclear, - EXTRA|TRLBAR|CMDWIN), - EX(CMD_caddbuffer, "caddbuffer", ex_cbuffer, - RANGE|NOTADR|WORD1|TRLBAR), - EX(CMD_caddexpr, "caddexpr", ex_cexpr, - NEEDARG|WORD1|NOTRLCOM|TRLBAR), - EX(CMD_caddfile, "caddfile", ex_cfile, - TRLBAR|FILE1), - EX(CMD_call, "call", ex_call, - RANGE|NEEDARG|EXTRA|NOTRLCOM|SBOXOK|CMDWIN), - EX(CMD_catch, "catch", ex_catch, - EXTRA|SBOXOK|CMDWIN), - EX(CMD_cbuffer, "cbuffer", ex_cbuffer, - BANG|RANGE|NOTADR|WORD1|TRLBAR), - EX(CMD_cc, "cc", ex_cc, - RANGE|NOTADR|COUNT|TRLBAR|BANG), - EX(CMD_cclose, "cclose", ex_cclose, - RANGE|NOTADR|COUNT|TRLBAR), - EX(CMD_cd, "cd", ex_cd, - BANG|FILE1|TRLBAR|CMDWIN), - EX(CMD_center, "center", ex_align, - TRLBAR|RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY), - EX(CMD_cexpr, "cexpr", ex_cexpr, - NEEDARG|WORD1|NOTRLCOM|TRLBAR|BANG), - EX(CMD_cfile, "cfile", ex_cfile, - TRLBAR|FILE1|BANG), - EX(CMD_cfirst, "cfirst", ex_cc, - RANGE|NOTADR|COUNT|TRLBAR|BANG), - EX(CMD_cgetfile, "cgetfile", ex_cfile, - TRLBAR|FILE1), - EX(CMD_cgetbuffer, "cgetbuffer", ex_cbuffer, - RANGE|NOTADR|WORD1|TRLBAR), - EX(CMD_cgetexpr, "cgetexpr", ex_cexpr, - NEEDARG|WORD1|NOTRLCOM|TRLBAR), - EX(CMD_chdir, "chdir", ex_cd, - BANG|FILE1|TRLBAR|CMDWIN), - EX(CMD_changes, "changes", ex_changes, - TRLBAR|CMDWIN), - EX(CMD_checkpath, "checkpath", ex_checkpath, - TRLBAR|BANG|CMDWIN), - EX(CMD_checktime, "checktime", ex_checktime, - RANGE|NOTADR|BUFNAME|COUNT|EXTRA|TRLBAR), - EX(CMD_clist, "clist", qf_list, - BANG|EXTRA|TRLBAR|CMDWIN), - EX(CMD_clast, "clast", ex_cc, - RANGE|NOTADR|COUNT|TRLBAR|BANG), - EX(CMD_close, "close", ex_close, - BANG|TRLBAR|CMDWIN), - EX(CMD_cmap, "cmap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_cmapclear, "cmapclear", ex_mapclear, - EXTRA|TRLBAR|CMDWIN), - EX(CMD_cmenu, "cmenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_cnext, "cnext", ex_cnext, - RANGE|NOTADR|COUNT|TRLBAR|BANG), - EX(CMD_cnewer, "cnewer", qf_age, - RANGE|NOTADR|COUNT|TRLBAR), - EX(CMD_cnfile, "cnfile", ex_cnext, - RANGE|NOTADR|COUNT|TRLBAR|BANG), - EX(CMD_cnoremap, "cnoremap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_cnoreabbrev, "cnoreabbrev", ex_abbreviate, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_cnoremenu, "cnoremenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_copy, "copy", ex_copymove, - RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN|MODIFY), - EX(CMD_colder, "colder", qf_age, - RANGE|NOTADR|COUNT|TRLBAR), - EX(CMD_colorscheme, "colorscheme", ex_colorscheme, - WORD1|TRLBAR|CMDWIN), - EX(CMD_command, "command", ex_command, - EXTRA|BANG|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_comclear, "comclear", ex_comclear, - TRLBAR|CMDWIN), - EX(CMD_compiler, "compiler", ex_compiler, - BANG|TRLBAR|WORD1|CMDWIN), - EX(CMD_continue, "continue", ex_continue, - TRLBAR|SBOXOK|CMDWIN), - EX(CMD_confirm, "confirm", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM|CMDWIN), - EX(CMD_copen, "copen", ex_copen, - RANGE|NOTADR|COUNT|TRLBAR), - EX(CMD_cprevious, "cprevious", ex_cnext, - RANGE|NOTADR|COUNT|TRLBAR|BANG), - EX(CMD_cpfile, "cpfile", ex_cnext, - RANGE|NOTADR|COUNT|TRLBAR|BANG), - EX(CMD_cquit, "cquit", ex_cquit, - TRLBAR|BANG), - EX(CMD_crewind, "crewind", ex_cc, - RANGE|NOTADR|COUNT|TRLBAR|BANG), - EX(CMD_cscope, "cscope", do_cscope, - EXTRA|NOTRLCOM|XFILE), - EX(CMD_cstag, "cstag", do_cstag, - BANG|TRLBAR|WORD1), - EX(CMD_cunmap, "cunmap", ex_unmap, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_cunabbrev, "cunabbrev", ex_abbreviate, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_cunmenu, "cunmenu", ex_menu, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_cwindow, "cwindow", ex_cwindow, - RANGE|NOTADR|COUNT|TRLBAR), - EX(CMD_delete, "delete", ex_operators, - RANGE|WHOLEFOLD|REGSTR|COUNT|TRLBAR|CMDWIN|MODIFY), - EX(CMD_delmarks, "delmarks", ex_delmarks, - BANG|EXTRA|TRLBAR|CMDWIN), - EX(CMD_debug, "debug", ex_debug, - NEEDARG|EXTRA|NOTRLCOM|SBOXOK|CMDWIN), - EX(CMD_debuggreedy, "debuggreedy", ex_debuggreedy, - RANGE|NOTADR|ZEROR|TRLBAR|CMDWIN), - EX(CMD_delcommand, "delcommand", ex_delcommand, - NEEDARG|WORD1|TRLBAR|CMDWIN), - EX(CMD_delfunction, "delfunction", ex_delfunction, - NEEDARG|WORD1|CMDWIN), - EX(CMD_display, "display", ex_display, - EXTRA|NOTRLCOM|TRLBAR|SBOXOK|CMDWIN), - EX(CMD_diffupdate, "diffupdate", ex_diffupdate, - BANG|TRLBAR), - EX(CMD_diffget, "diffget", ex_diffgetput, - RANGE|EXTRA|TRLBAR|MODIFY), - EX(CMD_diffoff, "diffoff", ex_diffoff, - BANG|TRLBAR), - EX(CMD_diffpatch, "diffpatch", ex_diffpatch, - EXTRA|FILE1|TRLBAR|MODIFY), - EX(CMD_diffput, "diffput", ex_diffgetput, - RANGE|EXTRA|TRLBAR), - EX(CMD_diffsplit, "diffsplit", ex_diffsplit, - EXTRA|FILE1|TRLBAR), - EX(CMD_diffthis, "diffthis", ex_diffthis, - TRLBAR), - EX(CMD_digraphs, "digraphs", ex_digraphs, - EXTRA|TRLBAR|CMDWIN), - EX(CMD_djump, "djump", ex_findpat, - BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA), - EX(CMD_dlist, "dlist", ex_findpat, - BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA|CMDWIN), - EX(CMD_doautocmd, "doautocmd", ex_doautocmd, - EXTRA|TRLBAR|CMDWIN), - EX(CMD_doautoall, "doautoall", ex_doautoall, - EXTRA|TRLBAR|CMDWIN), - EX(CMD_drop, "drop", ex_drop, - FILES|EDITCMD|NEEDARG|ARGOPT|TRLBAR), - EX(CMD_dsearch, "dsearch", ex_findpat, - BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA|CMDWIN), - EX(CMD_dsplit, "dsplit", ex_findpat, - BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA), - EX(CMD_edit, "edit", ex_edit, - BANG|FILE1|EDITCMD|ARGOPT|TRLBAR), - EX(CMD_earlier, "earlier", ex_later, - TRLBAR|EXTRA|NOSPC|CMDWIN), - EX(CMD_echo, "echo", ex_echo, - EXTRA|NOTRLCOM|SBOXOK|CMDWIN), - EX(CMD_echoerr, "echoerr", ex_execute, - EXTRA|NOTRLCOM|SBOXOK|CMDWIN), - EX(CMD_echohl, "echohl", ex_echohl, - EXTRA|TRLBAR|SBOXOK|CMDWIN), - EX(CMD_echomsg, "echomsg", ex_execute, - EXTRA|NOTRLCOM|SBOXOK|CMDWIN), - EX(CMD_echon, "echon", ex_echo, - EXTRA|NOTRLCOM|SBOXOK|CMDWIN), - EX(CMD_else, "else", ex_else, - TRLBAR|SBOXOK|CMDWIN), - EX(CMD_elseif, "elseif", ex_else, - EXTRA|NOTRLCOM|SBOXOK|CMDWIN), - EX(CMD_emenu, "emenu", ex_emenu, - NEEDARG|EXTRA|TRLBAR|NOTRLCOM|RANGE|NOTADR|CMDWIN), - EX(CMD_endif, "endif", ex_endif, - TRLBAR|SBOXOK|CMDWIN), - EX(CMD_endfunction, "endfunction", ex_endfunction, - TRLBAR|CMDWIN), - EX(CMD_endfor, "endfor", ex_endwhile, - TRLBAR|SBOXOK|CMDWIN), - EX(CMD_endtry, "endtry", ex_endtry, - TRLBAR|SBOXOK|CMDWIN), - EX(CMD_endwhile, "endwhile", ex_endwhile, - TRLBAR|SBOXOK|CMDWIN), - EX(CMD_enew, "enew", ex_edit, - BANG|TRLBAR), - EX(CMD_ex, "ex", ex_edit, - BANG|FILE1|EDITCMD|ARGOPT|TRLBAR), - EX(CMD_execute, "execute", ex_execute, - EXTRA|NOTRLCOM|SBOXOK|CMDWIN), - EX(CMD_exit, "exit", ex_exit, - RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR|CMDWIN), - EX(CMD_exusage, "exusage", ex_exusage, - TRLBAR), - EX(CMD_file, "file", ex_file, - RANGE|NOTADR|ZEROR|BANG|FILE1|TRLBAR), - EX(CMD_files, "files", buflist_list, - BANG|TRLBAR|CMDWIN), - EX(CMD_filetype, "filetype", ex_filetype, - EXTRA|TRLBAR|CMDWIN), - EX(CMD_find, "find", ex_find, - RANGE|NOTADR|BANG|FILE1|EDITCMD|ARGOPT|TRLBAR), - EX(CMD_finally, "finally", ex_finally, - TRLBAR|SBOXOK|CMDWIN), - EX(CMD_finish, "finish", ex_finish, - TRLBAR|SBOXOK|CMDWIN), - EX(CMD_first, "first", ex_rewind, - EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR), - EX(CMD_fixdel, "fixdel", do_fixdel, - TRLBAR|CMDWIN), - EX(CMD_fold, "fold", ex_fold, - RANGE|WHOLEFOLD|TRLBAR|SBOXOK|CMDWIN), - EX(CMD_foldclose, "foldclose", ex_foldopen, - RANGE|BANG|WHOLEFOLD|TRLBAR|SBOXOK|CMDWIN), - EX(CMD_folddoopen, "folddoopen", ex_folddo, - RANGE|DFLALL|NEEDARG|EXTRA|NOTRLCOM), - EX(CMD_folddoclosed, "folddoclosed", ex_folddo, - RANGE|DFLALL|NEEDARG|EXTRA|NOTRLCOM), - EX(CMD_foldopen, "foldopen", ex_foldopen, - RANGE|BANG|WHOLEFOLD|TRLBAR|SBOXOK|CMDWIN), - EX(CMD_for, "for", ex_while, - EXTRA|NOTRLCOM|SBOXOK|CMDWIN), - EX(CMD_function, "function", ex_function, - EXTRA|BANG|CMDWIN), - EX(CMD_global, "global", ex_global, - RANGE|WHOLEFOLD|BANG|EXTRA|DFLALL|SBOXOK|CMDWIN), - EX(CMD_goto, "goto", ex_goto, - RANGE|NOTADR|COUNT|TRLBAR|SBOXOK|CMDWIN), - EX(CMD_grep, "grep", ex_make, - RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE), - EX(CMD_grepadd, "grepadd", ex_make, - RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE), - EX(CMD_gui, "gui", ex_gui, - BANG|FILES|EDITCMD|ARGOPT|TRLBAR|CMDWIN), - EX(CMD_gvim, "gvim", ex_gui, - BANG|FILES|EDITCMD|ARGOPT|TRLBAR|CMDWIN), - EX(CMD_help, "help", ex_help, - BANG|EXTRA|NOTRLCOM), - EX(CMD_helpfind, "helpfind", ex_helpfind, - EXTRA|NOTRLCOM), - EX(CMD_helpgrep, "helpgrep", ex_helpgrep, - EXTRA|NOTRLCOM|NEEDARG), - EX(CMD_helptags, "helptags", ex_helptags, - NEEDARG|FILES|TRLBAR|CMDWIN), - EX(CMD_hardcopy, "hardcopy", ex_hardcopy, - RANGE|COUNT|EXTRA|TRLBAR|DFLALL|BANG), - EX(CMD_highlight, "highlight", ex_highlight, - BANG|EXTRA|TRLBAR|SBOXOK|CMDWIN), - EX(CMD_hide, "hide", ex_hide, - BANG|EXTRA|NOTRLCOM), - EX(CMD_history, "history", ex_history, - EXTRA|TRLBAR|CMDWIN), - EX(CMD_insert, "insert", ex_append, - BANG|RANGE|TRLBAR|CMDWIN|MODIFY), - EX(CMD_iabbrev, "iabbrev", ex_abbreviate, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_iabclear, "iabclear", ex_abclear, - EXTRA|TRLBAR|CMDWIN), - EX(CMD_if, "if", ex_if, - EXTRA|NOTRLCOM|SBOXOK|CMDWIN), - EX(CMD_ijump, "ijump", ex_findpat, - BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA), - EX(CMD_ilist, "ilist", ex_findpat, - BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA|CMDWIN), - EX(CMD_imap, "imap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_imapclear, "imapclear", ex_mapclear, - EXTRA|TRLBAR|CMDWIN), - EX(CMD_imenu, "imenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_inoremap, "inoremap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_inoreabbrev, "inoreabbrev", ex_abbreviate, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_inoremenu, "inoremenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_intro, "intro", ex_intro, - TRLBAR|CMDWIN), - EX(CMD_isearch, "isearch", ex_findpat, - BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA|CMDWIN), - EX(CMD_isplit, "isplit", ex_findpat, - BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA), - EX(CMD_iunmap, "iunmap", ex_unmap, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_iunabbrev, "iunabbrev", ex_abbreviate, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_iunmenu, "iunmenu", ex_menu, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_join, "join", ex_join, - BANG|RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN|MODIFY), - EX(CMD_jumps, "jumps", ex_jumps, - TRLBAR|CMDWIN), - EX(CMD_k, "k", ex_mark, - RANGE|WORD1|TRLBAR|SBOXOK|CMDWIN), - EX(CMD_keepmarks, "keepmarks", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), - EX(CMD_keepjumps, "keepjumps", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), - EX(CMD_keeppatterns, "keeppatterns", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), - EX(CMD_keepalt, "keepalt", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), - EX(CMD_list, "list", ex_print, - RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN), - EX(CMD_lNext, "lNext", ex_cnext, - RANGE|NOTADR|COUNT|TRLBAR|BANG), - EX(CMD_lNfile, "lNfile", ex_cnext, - RANGE|NOTADR|COUNT|TRLBAR|BANG), - EX(CMD_last, "last", ex_last, - EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR), - EX(CMD_language, "language", ex_language, - EXTRA|TRLBAR|CMDWIN), - EX(CMD_laddexpr, "laddexpr", ex_cexpr, - NEEDARG|WORD1|NOTRLCOM|TRLBAR), - EX(CMD_laddbuffer, "laddbuffer", ex_cbuffer, - RANGE|NOTADR|WORD1|TRLBAR), - EX(CMD_laddfile, "laddfile", ex_cfile, - TRLBAR|FILE1), - EX(CMD_later, "later", ex_later, - TRLBAR|EXTRA|NOSPC|CMDWIN), - EX(CMD_lbuffer, "lbuffer", ex_cbuffer, - BANG|RANGE|NOTADR|WORD1|TRLBAR), - EX(CMD_lcd, "lcd", ex_cd, - BANG|FILE1|TRLBAR|CMDWIN), - EX(CMD_lchdir, "lchdir", ex_cd, - BANG|FILE1|TRLBAR|CMDWIN), - EX(CMD_lclose, "lclose", ex_cclose, - RANGE|NOTADR|COUNT|TRLBAR), - EX(CMD_lcscope, "lcscope", do_cscope, - EXTRA|NOTRLCOM|XFILE), - EX(CMD_left, "left", ex_align, - TRLBAR|RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY), - EX(CMD_leftabove, "leftabove", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), - EX(CMD_let, "let", ex_let, - EXTRA|NOTRLCOM|SBOXOK|CMDWIN), - EX(CMD_lexpr, "lexpr", ex_cexpr, - NEEDARG|WORD1|NOTRLCOM|TRLBAR|BANG), - EX(CMD_lfile, "lfile", ex_cfile, - TRLBAR|FILE1|BANG), - EX(CMD_lfirst, "lfirst", ex_cc, - RANGE|NOTADR|COUNT|TRLBAR|BANG), - EX(CMD_lgetfile, "lgetfile", ex_cfile, - TRLBAR|FILE1), - EX(CMD_lgetbuffer, "lgetbuffer", ex_cbuffer, - RANGE|NOTADR|WORD1|TRLBAR), - EX(CMD_lgetexpr, "lgetexpr", ex_cexpr, - NEEDARG|WORD1|NOTRLCOM|TRLBAR), - EX(CMD_lgrep, "lgrep", ex_make, - RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE), - EX(CMD_lgrepadd, "lgrepadd", ex_make, - RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE), - EX(CMD_lhelpgrep, "lhelpgrep", ex_helpgrep, - EXTRA|NOTRLCOM|NEEDARG), - EX(CMD_ll, "ll", ex_cc, - RANGE|NOTADR|COUNT|TRLBAR|BANG), - EX(CMD_llast, "llast", ex_cc, - RANGE|NOTADR|COUNT|TRLBAR|BANG), - EX(CMD_llist, "llist", qf_list, - BANG|EXTRA|TRLBAR|CMDWIN), - EX(CMD_lmap, "lmap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_lmapclear, "lmapclear", ex_mapclear, - EXTRA|TRLBAR|CMDWIN), - EX(CMD_lmake, "lmake", ex_make, - BANG|EXTRA|NOTRLCOM|TRLBAR|XFILE), - EX(CMD_lnoremap, "lnoremap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_lnext, "lnext", ex_cnext, - RANGE|NOTADR|COUNT|TRLBAR|BANG), - EX(CMD_lnewer, "lnewer", qf_age, - RANGE|NOTADR|COUNT|TRLBAR), - EX(CMD_lnfile, "lnfile", ex_cnext, - RANGE|NOTADR|COUNT|TRLBAR|BANG), - EX(CMD_loadview, "loadview", ex_loadview, - FILE1|TRLBAR), - EX(CMD_loadkeymap, "loadkeymap", ex_loadkeymap, - CMDWIN), - EX(CMD_lockmarks, "lockmarks", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), - EX(CMD_lockvar, "lockvar", ex_lockvar, - BANG|EXTRA|NEEDARG|SBOXOK|CMDWIN), - EX(CMD_lolder, "lolder", qf_age, - RANGE|NOTADR|COUNT|TRLBAR), - EX(CMD_lopen, "lopen", ex_copen, - RANGE|NOTADR|COUNT|TRLBAR), - EX(CMD_lprevious, "lprevious", ex_cnext, - RANGE|NOTADR|COUNT|TRLBAR|BANG), - EX(CMD_lpfile, "lpfile", ex_cnext, - RANGE|NOTADR|COUNT|TRLBAR|BANG), - EX(CMD_lrewind, "lrewind", ex_cc, - RANGE|NOTADR|COUNT|TRLBAR|BANG), - EX(CMD_ltag, "ltag", ex_tag, - NOTADR|TRLBAR|BANG|WORD1), - EX(CMD_lunmap, "lunmap", ex_unmap, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_lvimgrep, "lvimgrep", ex_vimgrep, - RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE), - EX(CMD_lvimgrepadd, "lvimgrepadd", ex_vimgrep, - RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE), - EX(CMD_lwindow, "lwindow", ex_cwindow, - RANGE|NOTADR|COUNT|TRLBAR), - EX(CMD_ls, "ls", buflist_list, - BANG|TRLBAR|CMDWIN), - EX(CMD_move, "move", ex_copymove, - RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN|MODIFY), - EX(CMD_mark, "mark", ex_mark, - RANGE|WORD1|TRLBAR|SBOXOK|CMDWIN), - EX(CMD_make, "make", ex_make, - BANG|EXTRA|NOTRLCOM|TRLBAR|XFILE), - EX(CMD_map, "map", ex_map, - BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_mapclear, "mapclear", ex_mapclear, - EXTRA|BANG|TRLBAR|CMDWIN), - EX(CMD_marks, "marks", do_marks, - EXTRA|TRLBAR|CMDWIN), - EX(CMD_match, "match", ex_match, - RANGE|NOTADR|EXTRA|CMDWIN), - EX(CMD_menu, "menu", ex_menu, - RANGE|NOTADR|ZEROR|BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_menutranslate, "menutranslate", ex_menutranslate, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_messages, "messages", ex_messages, - TRLBAR|CMDWIN), - EX(CMD_mkexrc, "mkexrc", ex_mkrc, - BANG|FILE1|TRLBAR|CMDWIN), - EX(CMD_mksession, "mksession", ex_mkrc, - BANG|FILE1|TRLBAR), - EX(CMD_mkspell, "mkspell", ex_mkspell, - BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE), - EX(CMD_mkvimrc, "mkvimrc", ex_mkrc, - BANG|FILE1|TRLBAR|CMDWIN), - EX(CMD_mkview, "mkview", ex_mkrc, - BANG|FILE1|TRLBAR), - EX(CMD_mode, "mode", ex_mode, - WORD1|TRLBAR|CMDWIN), - EX(CMD_next, "next", ex_next, - RANGE|NOTADR|BANG|FILES|EDITCMD|ARGOPT|TRLBAR), - EX(CMD_nbkey, "nbkey", ex_nbkey, - EXTRA|NOTADR|NEEDARG), - EX(CMD_nbclose, "nbclose", ex_nbclose, - TRLBAR|CMDWIN), - EX(CMD_nbstart, "nbstart", ex_nbstart, - WORD1|TRLBAR|CMDWIN), - EX(CMD_new, "new", ex_splitview, - BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR), - EX(CMD_nmap, "nmap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_nmapclear, "nmapclear", ex_mapclear, - EXTRA|TRLBAR|CMDWIN), - EX(CMD_nmenu, "nmenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_nnoremap, "nnoremap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_nnoremenu, "nnoremenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_noremap, "noremap", ex_map, - BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_noautocmd, "noautocmd", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), - EX(CMD_nohlsearch, "nohlsearch", ex_nohlsearch, - TRLBAR|SBOXOK|CMDWIN), - EX(CMD_noreabbrev, "noreabbrev", ex_abbreviate, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_noremenu, "noremenu", ex_menu, - RANGE|NOTADR|ZEROR|BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_noswapfile, "noswapfile", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), - EX(CMD_normal, "normal", ex_normal, - RANGE|BANG|EXTRA|NEEDARG|NOTRLCOM|USECTRLV|SBOXOK|CMDWIN), - EX(CMD_number, "number", ex_print, - RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN), - EX(CMD_nunmap, "nunmap", ex_unmap, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_nunmenu, "nunmenu", ex_menu, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_open, "open", ex_open, - RANGE|BANG|EXTRA), - EX(CMD_oldfiles, "oldfiles", ex_oldfiles, - BANG|TRLBAR|SBOXOK|CMDWIN), - EX(CMD_omap, "omap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_omapclear, "omapclear", ex_mapclear, - EXTRA|TRLBAR|CMDWIN), - EX(CMD_omenu, "omenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_only, "only", ex_only, - BANG|TRLBAR), - EX(CMD_onoremap, "onoremap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_onoremenu, "onoremenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_options, "options", ex_options, - TRLBAR), - EX(CMD_ounmap, "ounmap", ex_unmap, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_ounmenu, "ounmenu", ex_menu, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_ownsyntax, "ownsyntax", ex_ownsyntax, - EXTRA|NOTRLCOM|SBOXOK|CMDWIN), - EX(CMD_print, "print", ex_print, - RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN|SBOXOK), - EX(CMD_pclose, "pclose", ex_pclose, - BANG|TRLBAR), - EX(CMD_pedit, "pedit", ex_pedit, - BANG|FILE1|EDITCMD|ARGOPT|TRLBAR), - EX(CMD_pop, "pop", ex_tag, - RANGE|NOTADR|BANG|COUNT|TRLBAR|ZEROR), - EX(CMD_popup, "popup", ex_popup, - NEEDARG|EXTRA|BANG|TRLBAR|NOTRLCOM|CMDWIN), - EX(CMD_ppop, "ppop", ex_ptag, - RANGE|NOTADR|BANG|COUNT|TRLBAR|ZEROR), - EX(CMD_preserve, "preserve", ex_preserve, - TRLBAR), - EX(CMD_previous, "previous", ex_previous, - EXTRA|RANGE|NOTADR|COUNT|BANG|EDITCMD|ARGOPT|TRLBAR), - EX(CMD_promptfind, "promptfind", gui_mch_find_dialog, - EXTRA|NOTRLCOM|CMDWIN), - EX(CMD_promptrepl, "promptrepl", gui_mch_replace_dialog, - EXTRA|NOTRLCOM|CMDWIN), - EX(CMD_profile, "profile", ex_profile, - BANG|EXTRA|TRLBAR|CMDWIN), - EX(CMD_profdel, "profdel", ex_breakdel, - EXTRA|TRLBAR|CMDWIN), - EX(CMD_psearch, "psearch", ex_psearch, - BANG|RANGE|WHOLEFOLD|DFLALL|EXTRA), - EX(CMD_ptag, "ptag", ex_ptag, - RANGE|NOTADR|BANG|WORD1|TRLBAR|ZEROR), - EX(CMD_ptNext, "ptNext", ex_ptag, - RANGE|NOTADR|BANG|TRLBAR|ZEROR), - EX(CMD_ptfirst, "ptfirst", ex_ptag, - RANGE|NOTADR|BANG|TRLBAR|ZEROR), - EX(CMD_ptjump, "ptjump", ex_ptag, - BANG|TRLBAR|WORD1), - EX(CMD_ptlast, "ptlast", ex_ptag, - BANG|TRLBAR), - EX(CMD_ptnext, "ptnext", ex_ptag, - RANGE|NOTADR|BANG|TRLBAR|ZEROR), - EX(CMD_ptprevious, "ptprevious", ex_ptag, - RANGE|NOTADR|BANG|TRLBAR|ZEROR), - EX(CMD_ptrewind, "ptrewind", ex_ptag, - RANGE|NOTADR|BANG|TRLBAR|ZEROR), - EX(CMD_ptselect, "ptselect", ex_ptag, - BANG|TRLBAR|WORD1), - EX(CMD_put, "put", ex_put, - RANGE|WHOLEFOLD|BANG|REGSTR|TRLBAR|ZEROR|CMDWIN|MODIFY), - EX(CMD_pwd, "pwd", ex_pwd, - TRLBAR|CMDWIN), - EX(CMD_python, "python", ex_python, - RANGE|EXTRA|NEEDARG|CMDWIN), - EX(CMD_pydo, "pydo", ex_pydo, - RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN), - EX(CMD_pyfile, "pyfile", ex_pyfile, - RANGE|FILE1|NEEDARG|CMDWIN), - EX(CMD_quit, "quit", ex_quit, - BANG|TRLBAR|CMDWIN), - EX(CMD_quitall, "quitall", ex_quit_all, - BANG|TRLBAR), - EX(CMD_qall, "qall", ex_quit_all, - BANG|TRLBAR|CMDWIN), - EX(CMD_read, "read", ex_read, - BANG|RANGE|WHOLEFOLD|FILE1|ARGOPT|TRLBAR|ZEROR|CMDWIN|MODIFY), - EX(CMD_recover, "recover", ex_recover, - BANG|FILE1|TRLBAR), - EX(CMD_redo, "redo", ex_redo, - TRLBAR|CMDWIN), - EX(CMD_redir, "redir", ex_redir, - BANG|FILES|TRLBAR|CMDWIN), - EX(CMD_redraw, "redraw", ex_redraw, - BANG|TRLBAR|CMDWIN), - EX(CMD_redrawstatus, "redrawstatus", ex_redrawstatus, - BANG|TRLBAR|CMDWIN), - EX(CMD_registers, "registers", ex_display, - EXTRA|NOTRLCOM|TRLBAR|CMDWIN), - EX(CMD_resize, "resize", ex_resize, - RANGE|NOTADR|TRLBAR|WORD1), - EX(CMD_retab, "retab", ex_retab, - TRLBAR|RANGE|WHOLEFOLD|DFLALL|BANG|WORD1|CMDWIN|MODIFY), - EX(CMD_return, "return", ex_return, - EXTRA|NOTRLCOM|SBOXOK|CMDWIN), - EX(CMD_rewind, "rewind", ex_rewind, - EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR), - EX(CMD_right, "right", ex_align, - TRLBAR|RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY), - EX(CMD_rightbelow, "rightbelow", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), - EX(CMD_runtime, "runtime", ex_runtime, - BANG|NEEDARG|FILES|TRLBAR|SBOXOK|CMDWIN), - EX(CMD_rundo, "rundo", ex_rundo, - NEEDARG|FILE1), - EX(CMD_rviminfo, "rviminfo", ex_viminfo, - BANG|FILE1|TRLBAR|CMDWIN), - EX(CMD_substitute, "substitute", do_sub, - RANGE|WHOLEFOLD|EXTRA|CMDWIN), - EX(CMD_sNext, "sNext", ex_previous, - EXTRA|RANGE|NOTADR|COUNT|BANG|EDITCMD|ARGOPT|TRLBAR), - EX(CMD_sargument, "sargument", ex_argument, - BANG|RANGE|NOTADR|COUNT|EXTRA|EDITCMD|ARGOPT|TRLBAR), - EX(CMD_sall, "sall", ex_all, - BANG|RANGE|NOTADR|COUNT|TRLBAR), - EX(CMD_sandbox, "sandbox", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), - EX(CMD_saveas, "saveas", ex_write, - BANG|DFLALL|FILE1|ARGOPT|CMDWIN|TRLBAR), - EX(CMD_sbuffer, "sbuffer", ex_buffer, - BANG|RANGE|NOTADR|BUFNAME|BUFUNL|COUNT|EXTRA|TRLBAR), - EX(CMD_sbNext, "sbNext", ex_bprevious, - RANGE|NOTADR|COUNT|TRLBAR), - EX(CMD_sball, "sball", ex_buffer_all, - RANGE|NOTADR|COUNT|TRLBAR), - EX(CMD_sbfirst, "sbfirst", ex_brewind, - TRLBAR), - EX(CMD_sblast, "sblast", ex_blast, - TRLBAR), - EX(CMD_sbmodified, "sbmodified", ex_bmodified, - RANGE|NOTADR|COUNT|TRLBAR), - EX(CMD_sbnext, "sbnext", ex_bnext, - RANGE|NOTADR|COUNT|TRLBAR), - EX(CMD_sbprevious, "sbprevious", ex_bprevious, - RANGE|NOTADR|COUNT|TRLBAR), - EX(CMD_sbrewind, "sbrewind", ex_brewind, - TRLBAR), - EX(CMD_scriptnames, "scriptnames", ex_scriptnames, - TRLBAR|CMDWIN), - EX(CMD_scriptencoding, "scriptencoding", ex_scriptencoding, - WORD1|TRLBAR|CMDWIN), - EX(CMD_scscope, "scscope", do_scscope, - EXTRA|NOTRLCOM), - EX(CMD_set, "set", ex_set, - TRLBAR|EXTRA|CMDWIN|SBOXOK), - EX(CMD_setfiletype, "setfiletype", ex_setfiletype, - TRLBAR|EXTRA|NEEDARG|CMDWIN), - EX(CMD_setglobal, "setglobal", ex_set, - TRLBAR|EXTRA|CMDWIN|SBOXOK), - EX(CMD_setlocal, "setlocal", ex_set, - TRLBAR|EXTRA|CMDWIN|SBOXOK), - EX(CMD_sfind, "sfind", ex_splitview, - BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR), - EX(CMD_sfirst, "sfirst", ex_rewind, - EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR), - EX(CMD_simalt, "simalt", ex_simalt, - NEEDARG|WORD1|TRLBAR|CMDWIN), - EX(CMD_sign, "sign", ex_sign, - NEEDARG|RANGE|NOTADR|EXTRA|CMDWIN), - EX(CMD_silent, "silent", ex_wrongmodifier, - NEEDARG|EXTRA|BANG|NOTRLCOM|SBOXOK|CMDWIN), - EX(CMD_sleep, "sleep", ex_sleep, - RANGE|NOTADR|COUNT|EXTRA|TRLBAR|CMDWIN), - EX(CMD_slast, "slast", ex_last, - EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR), - EX(CMD_smagic, "smagic", ex_submagic, - RANGE|WHOLEFOLD|EXTRA|CMDWIN), - EX(CMD_smap, "smap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_smapclear, "smapclear", ex_mapclear, - EXTRA|TRLBAR|CMDWIN), - EX(CMD_smenu, "smenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_snext, "snext", ex_next, - RANGE|NOTADR|BANG|FILES|EDITCMD|ARGOPT|TRLBAR), - EX(CMD_snomagic, "snomagic", ex_submagic, - RANGE|WHOLEFOLD|EXTRA|CMDWIN), - EX(CMD_snoremap, "snoremap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_snoremenu, "snoremenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_source, "source", ex_source, - BANG|FILE1|TRLBAR|SBOXOK|CMDWIN), - EX(CMD_sort, "sort", ex_sort, - RANGE|DFLALL|WHOLEFOLD|BANG|EXTRA|NOTRLCOM|MODIFY), - EX(CMD_split, "split", ex_splitview, - BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR), - EX(CMD_spellgood, "spellgood", ex_spell, - BANG|RANGE|NOTADR|NEEDARG|EXTRA|TRLBAR), - EX(CMD_spelldump, "spelldump", ex_spelldump, - BANG|TRLBAR), - EX(CMD_spellinfo, "spellinfo", ex_spellinfo, - TRLBAR), - EX(CMD_spellrepall, "spellrepall", ex_spellrepall, - TRLBAR), - EX(CMD_spellundo, "spellundo", ex_spell, - BANG|RANGE|NOTADR|NEEDARG|EXTRA|TRLBAR), - EX(CMD_spellwrong, "spellwrong", ex_spell, - BANG|RANGE|NOTADR|NEEDARG|EXTRA|TRLBAR), - EX(CMD_sprevious, "sprevious", ex_previous, - EXTRA|RANGE|NOTADR|COUNT|BANG|EDITCMD|ARGOPT|TRLBAR), - EX(CMD_srewind, "srewind", ex_rewind, - EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR), - EX(CMD_stop, "stop", ex_stop, - TRLBAR|BANG|CMDWIN), - EX(CMD_stag, "stag", ex_stag, - RANGE|NOTADR|BANG|WORD1|TRLBAR|ZEROR), - EX(CMD_startinsert, "startinsert", ex_startinsert, - BANG|TRLBAR|CMDWIN), - EX(CMD_startgreplace, "startgreplace", ex_startinsert, - BANG|TRLBAR|CMDWIN), - EX(CMD_startreplace, "startreplace", ex_startinsert, - BANG|TRLBAR|CMDWIN), - EX(CMD_stopinsert, "stopinsert", ex_stopinsert, - BANG|TRLBAR|CMDWIN), - EX(CMD_stjump, "stjump", ex_stag, - BANG|TRLBAR|WORD1), - EX(CMD_stselect, "stselect", ex_stag, - BANG|TRLBAR|WORD1), - EX(CMD_sunhide, "sunhide", ex_buffer_all, - RANGE|NOTADR|COUNT|TRLBAR), - EX(CMD_sunmap, "sunmap", ex_unmap, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_sunmenu, "sunmenu", ex_menu, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_suspend, "suspend", ex_stop, - TRLBAR|BANG|CMDWIN), - EX(CMD_sview, "sview", ex_splitview, - BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR), - EX(CMD_swapname, "swapname", ex_swapname, - TRLBAR|CMDWIN), - EX(CMD_syntax, "syntax", ex_syntax, - EXTRA|NOTRLCOM|CMDWIN), - EX(CMD_syntime, "syntime", ex_syntime, - NEEDARG|WORD1|TRLBAR|CMDWIN), - EX(CMD_syncbind, "syncbind", ex_syncbind, - TRLBAR), - EX(CMD_t, "t", ex_copymove, - RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN|MODIFY), - EX(CMD_tNext, "tNext", ex_tag, - RANGE|NOTADR|BANG|TRLBAR|ZEROR), - EX(CMD_tag, "tag", ex_tag, - RANGE|NOTADR|BANG|WORD1|TRLBAR|ZEROR), - EX(CMD_tags, "tags", do_tags, - TRLBAR|CMDWIN), - EX(CMD_tab, "tab", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), - EX(CMD_tabclose, "tabclose", ex_tabclose, - RANGE|NOTADR|COUNT|BANG|TRLBAR|CMDWIN), - EX(CMD_tabdo, "tabdo", ex_listdo, - NEEDARG|EXTRA|NOTRLCOM), - EX(CMD_tabedit, "tabedit", ex_splitview, - BANG|FILE1|RANGE|NOTADR|ZEROR|EDITCMD|ARGOPT|TRLBAR), - EX(CMD_tabfind, "tabfind", ex_splitview, - BANG|FILE1|RANGE|NOTADR|ZEROR|EDITCMD|ARGOPT|NEEDARG|TRLBAR), - EX(CMD_tabfirst, "tabfirst", ex_tabnext, - TRLBAR), - EX(CMD_tabmove, "tabmove", ex_tabmove, - RANGE|NOTADR|ZEROR|EXTRA|NOSPC|TRLBAR), - EX(CMD_tablast, "tablast", ex_tabnext, - TRLBAR), - EX(CMD_tabnext, "tabnext", ex_tabnext, - RANGE|NOTADR|COUNT|TRLBAR), - EX(CMD_tabnew, "tabnew", ex_splitview, - BANG|FILE1|RANGE|NOTADR|ZEROR|EDITCMD|ARGOPT|TRLBAR), - EX(CMD_tabonly, "tabonly", ex_tabonly, - BANG|TRLBAR|CMDWIN), - EX(CMD_tabprevious, "tabprevious", ex_tabnext, - RANGE|NOTADR|COUNT|TRLBAR), - EX(CMD_tabNext, "tabNext", ex_tabnext, - RANGE|NOTADR|COUNT|TRLBAR), - EX(CMD_tabrewind, "tabrewind", ex_tabnext, - TRLBAR), - EX(CMD_tabs, "tabs", ex_tabs, - TRLBAR|CMDWIN), - EX(CMD_tearoff, "tearoff", ex_tearoff, - NEEDARG|EXTRA|TRLBAR|NOTRLCOM|CMDWIN), - EX(CMD_tfirst, "tfirst", ex_tag, - RANGE|NOTADR|BANG|TRLBAR|ZEROR), - EX(CMD_throw, "throw", ex_throw, - EXTRA|NEEDARG|SBOXOK|CMDWIN), - EX(CMD_tjump, "tjump", ex_tag, - BANG|TRLBAR|WORD1), - EX(CMD_tlast, "tlast", ex_tag, - BANG|TRLBAR), - EX(CMD_tmenu, "tmenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_tnext, "tnext", ex_tag, - RANGE|NOTADR|BANG|TRLBAR|ZEROR), - EX(CMD_topleft, "topleft", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), - EX(CMD_tprevious, "tprevious", ex_tag, - RANGE|NOTADR|BANG|TRLBAR|ZEROR), - EX(CMD_trewind, "trewind", ex_tag, - RANGE|NOTADR|BANG|TRLBAR|ZEROR), - EX(CMD_try, "try", ex_try, - TRLBAR|SBOXOK|CMDWIN), - EX(CMD_tselect, "tselect", ex_tag, - BANG|TRLBAR|WORD1), - EX(CMD_tunmenu, "tunmenu", ex_menu, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_undo, "undo", ex_undo, - RANGE|NOTADR|COUNT|ZEROR|TRLBAR|CMDWIN), - EX(CMD_undojoin, "undojoin", ex_undojoin, - TRLBAR|CMDWIN), - EX(CMD_undolist, "undolist", ex_undolist, - TRLBAR|CMDWIN), - EX(CMD_unabbreviate, "unabbreviate", ex_abbreviate, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_unhide, "unhide", ex_buffer_all, - RANGE|NOTADR|COUNT|TRLBAR), - EX(CMD_unlet, "unlet", ex_unlet, - BANG|EXTRA|NEEDARG|SBOXOK|CMDWIN), - EX(CMD_unlockvar, "unlockvar", ex_lockvar, - BANG|EXTRA|NEEDARG|SBOXOK|CMDWIN), - EX(CMD_unmap, "unmap", ex_unmap, - BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_unmenu, "unmenu", ex_menu, - BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_unsilent, "unsilent", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM|SBOXOK|CMDWIN), - EX(CMD_update, "update", ex_update, - RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR), - EX(CMD_vglobal, "vglobal", ex_global, - RANGE|WHOLEFOLD|EXTRA|DFLALL|CMDWIN), - EX(CMD_version, "version", ex_version, - EXTRA|TRLBAR|CMDWIN), - EX(CMD_verbose, "verbose", ex_wrongmodifier, - NEEDARG|RANGE|NOTADR|EXTRA|NOTRLCOM|SBOXOK|CMDWIN), - EX(CMD_vertical, "vertical", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), - EX(CMD_visual, "visual", ex_edit, - BANG|FILE1|EDITCMD|ARGOPT|TRLBAR), - EX(CMD_view, "view", ex_edit, - BANG|FILE1|EDITCMD|ARGOPT|TRLBAR), - EX(CMD_vimgrep, "vimgrep", ex_vimgrep, - RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE), - EX(CMD_vimgrepadd, "vimgrepadd", ex_vimgrep, - RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE), - EX(CMD_viusage, "viusage", ex_viusage, - TRLBAR), - EX(CMD_vmap, "vmap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_vmapclear, "vmapclear", ex_mapclear, - EXTRA|TRLBAR|CMDWIN), - EX(CMD_vmenu, "vmenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_vnoremap, "vnoremap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_vnew, "vnew", ex_splitview, - BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR), - EX(CMD_vnoremenu, "vnoremenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_vsplit, "vsplit", ex_splitview, - BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR), - EX(CMD_vunmap, "vunmap", ex_unmap, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_vunmenu, "vunmenu", ex_menu, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_write, "write", ex_write, - RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR|CMDWIN), - EX(CMD_wNext, "wNext", ex_wnext, - RANGE|WHOLEFOLD|NOTADR|BANG|FILE1|ARGOPT|TRLBAR), - EX(CMD_wall, "wall", do_wqall, - BANG|TRLBAR|CMDWIN), - EX(CMD_while, "while", ex_while, - EXTRA|NOTRLCOM|SBOXOK|CMDWIN), - EX(CMD_winsize, "winsize", ex_winsize, - EXTRA|NEEDARG|TRLBAR), - EX(CMD_wincmd, "wincmd", ex_wincmd, - NEEDARG|WORD1|RANGE|NOTADR), - EX(CMD_windo, "windo", ex_listdo, - BANG|NEEDARG|EXTRA|NOTRLCOM), - EX(CMD_winpos, "winpos", ex_winpos, - EXTRA|TRLBAR|CMDWIN), - EX(CMD_wnext, "wnext", ex_wnext, - RANGE|NOTADR|BANG|FILE1|ARGOPT|TRLBAR), - EX(CMD_wprevious, "wprevious", ex_wnext, - RANGE|NOTADR|BANG|FILE1|ARGOPT|TRLBAR), - EX(CMD_wq, "wq", ex_exit, - RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR), - EX(CMD_wqall, "wqall", do_wqall, - BANG|FILE1|ARGOPT|DFLALL|TRLBAR), - EX(CMD_wsverb, "wsverb", ex_wsverb, - EXTRA|NOTADR|NEEDARG), - EX(CMD_wundo, "wundo", ex_wundo, - BANG|NEEDARG|FILE1), - EX(CMD_wviminfo, "wviminfo", ex_viminfo, - BANG|FILE1|TRLBAR|CMDWIN), - EX(CMD_xit, "xit", ex_exit, - RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR|CMDWIN), - EX(CMD_xall, "xall", do_wqall, - BANG|TRLBAR), - EX(CMD_xmap, "xmap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_xmapclear, "xmapclear", ex_mapclear, - EXTRA|TRLBAR|CMDWIN), - EX(CMD_xmenu, "xmenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_xnoremap, "xnoremap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_xnoremenu, "xnoremenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_xunmap, "xunmap", ex_unmap, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_xunmenu, "xunmenu", ex_menu, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), - EX(CMD_yank, "yank", ex_operators, - RANGE|WHOLEFOLD|REGSTR|COUNT|TRLBAR|CMDWIN), - EX(CMD_z, "z", ex_z, - RANGE|WHOLEFOLD|EXTRA|EXFLAGS|TRLBAR|CMDWIN), - - /* commands that don't start with a lowercase letter */ - EX(CMD_bang, "!", ex_bang, - RANGE|WHOLEFOLD|BANG|FILES|CMDWIN), - EX(CMD_pound, "#", ex_print, - RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN), - EX(CMD_and, "&", do_sub, - RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY), - EX(CMD_star, "*", ex_at, - RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN), - EX(CMD_lshift, "<", ex_operators, - RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN|MODIFY), - EX(CMD_equal, "=", ex_equal, - RANGE|TRLBAR|DFLALL|EXFLAGS|CMDWIN), - EX(CMD_rshift, ">", ex_operators, - RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN|MODIFY), - EX(CMD_at, "@", ex_at, - RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN), - EX(CMD_Next, "Next", ex_previous, - EXTRA|RANGE|NOTADR|COUNT|BANG|EDITCMD|ARGOPT|TRLBAR), - EX(CMD_Print, "Print", ex_print, - RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN), - EX(CMD_tilde, "~", do_sub, - RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY), +typedef char_u *(*LineGetter)(int, void *, int); -#ifndef DO_DECLARE_EXCMD - CMD_SIZE, /* MUST be after all real commands! */ - CMD_USER = -1, /* User-defined command */ - CMD_USER_BUF = -2 /* User-defined command local to buffer */ -#endif -}; +/// Structure for command definition. +typedef struct cmdname { + char_u *cmd_name; ///< Name of the command. + ex_func_T cmd_func; ///< Function with implementation of this command. + long_u cmd_argt; ///< Relevant flags from the declared above. +} CommandDefinition; #define USER_CMDIDX(idx) ((int)(idx) < 0) -#ifndef DO_DECLARE_EXCMD -typedef enum CMD_index cmdidx_T; - -/* - * Arguments used for Ex commands. - */ +/// Arguments used for Ex commands. struct exarg { - char_u *arg; /* argument of the command */ - char_u *nextcmd; /* next command (NULL if none) */ - char_u *cmd; /* the name of the command (except for :make) */ - char_u **cmdlinep; /* pointer to pointer of allocated cmdline */ - cmdidx_T cmdidx; /* the index for the command */ - long argt; /* flags for the command */ - int skip; /* don't execute the command, only parse it */ - int forceit; /* TRUE if ! present */ - int addr_count; /* the number of addresses given */ - linenr_T line1; /* the first line number */ - linenr_T line2; /* the second line number or count */ - int flags; /* extra flags after count: EXFLAG_ */ - char_u *do_ecmd_cmd; /* +command arg to be used in edited file */ - linenr_T do_ecmd_lnum; /* the line number in an edited file */ - int append; /* TRUE with ":w >>file" command */ - int usefilter; /* TRUE with ":w !command" and ":r!command" */ - int amount; /* number of '>' or '<' for shift command */ - int regname; /* register name (NUL if none) */ - int force_bin; /* 0, FORCE_BIN or FORCE_NOBIN */ - int read_edit; /* ++edit argument */ - int force_ff; /* ++ff= argument (index in cmd[]) */ - int force_enc; /* ++enc= argument (index in cmd[]) */ - int bad_char; /* BAD_KEEP, BAD_DROP or replacement byte */ - int useridx; /* user command index */ - char_u *errmsg; /* returned error message */ - char_u *(*getline)(int, void *, int); - void *cookie; /* argument for getline() */ - struct condstack *cstack; /* condition stack for ":if" etc. */ + char_u *arg; ///< argument of the command + char_u *nextcmd; ///< next command (NULL if none) + char_u *cmd; ///< the name of the command (except for :make) + char_u **cmdlinep; ///< pointer to pointer of allocated cmdline + cmdidx_T cmdidx; ///< the index for the command + long argt; ///< flags for the command + int skip; ///< don't execute the command, only parse it + int forceit; ///< TRUE if ! present + int addr_count; ///< the number of addresses given + linenr_T line1; ///< the first line number + linenr_T line2; ///< the second line number or count + int flags; ///< extra flags after count: EXFLAG_ + char_u *do_ecmd_cmd; ///< +command arg to be used in edited file + linenr_T do_ecmd_lnum; ///< the line number in an edited file + int append; ///< TRUE with ":w >>file" command + int usefilter; ///< TRUE with ":w !command" and ":r!command" + int amount; ///< number of '>' or '<' for shift command + int regname; ///< register name (NUL if none) + int force_bin; ///< 0, FORCE_BIN or FORCE_NOBIN + int read_edit; ///< ++edit argument + int force_ff; ///< ++ff= argument (index in cmd[]) + int force_enc; ///< ++enc= argument (index in cmd[]) + int bad_char; ///< BAD_KEEP, BAD_DROP or replacement byte + int useridx; ///< user command index + char_u *errmsg; ///< returned error message + LineGetter getline; ///< Function used to get the next line + void *cookie; ///< argument for getline() + struct condstack *cstack; ///< condition stack for ":if" etc. }; #define FORCE_BIN 1 /* ":edit ++bin file" */ @@ -1209,5 +175,4 @@ typedef struct { char_u *save_ei; /* saved value of 'eventignore' */ } cmdmod_T; -#endif -#endif +#endif // NVIM_EX_CMDS_DEFS_H diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 3eb9d1277e..ab7add1c5b 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -66,6 +66,7 @@ #include "nvim/version.h" #include "nvim/window.h" #include "nvim/os/os.h" +#include "nvim/ex_cmds_defs.h" static int quitmore = 0; static int ex_pressedreturn = FALSE; @@ -156,42 +157,9 @@ static int did_lcd; /* whether ":lcd" was produced for a session */ /* * Declare cmdnames[]. */ -#define DO_DECLARE_EXCMD -#include "nvim/ex_cmds_defs.h" - -/* - * Table used to quickly search for a command, based on its first character. - */ -static cmdidx_T cmdidxs[27] = -{ - CMD_append, - CMD_buffer, - CMD_change, - CMD_delete, - CMD_edit, - CMD_file, - CMD_global, - CMD_help, - CMD_insert, - CMD_join, - CMD_k, - CMD_list, - CMD_move, - CMD_next, - CMD_open, - CMD_print, - CMD_quit, - CMD_read, - CMD_substitute, - CMD_t, - CMD_undo, - CMD_vglobal, - CMD_write, - CMD_xit, - CMD_yank, - CMD_z, - CMD_bang -}; +#ifdef INCLUDE_GENERATED_DECLARATIONS +# include "ex_cmds_defs.generated.h" +#endif static char_u dollar_command[2] = {'$', 0}; @@ -7871,7 +7839,6 @@ makeopens ( char_u *dirnow /* Current directory name */ ) { - buf_T *buf; int only_save_windows = TRUE; int nr; int cnr = 1; @@ -7943,7 +7910,7 @@ makeopens ( return FAIL; /* Now put the other buffers into the buffer list */ - for (buf = firstbuf; buf != NULL; buf = buf->b_next) { + FOR_ALL_BUFFERS(buf) { if (!(only_save_windows && buf->b_nwindows == 0) && !(buf->b_help && !(ssop_flags & SSOP_HELP)) && buf->b_fname != NULL diff --git a/src/nvim/ex_docmd.h b/src/nvim/ex_docmd.h index cd3ef2738d..a5a4edbbbf 100644 --- a/src/nvim/ex_docmd.h +++ b/src/nvim/ex_docmd.h @@ -1,6 +1,8 @@ #ifndef NVIM_EX_DOCMD_H #define NVIM_EX_DOCMD_H +#include "nvim/ex_cmds_defs.h" + /* flags for do_cmdline() */ #define DOCMD_VERBOSE 0x01 /* included command in error message */ #define DOCMD_NOWAIT 0x02 /* don't call wait_return() and friends */ @@ -17,8 +19,6 @@ #define EXMODE_NORMAL 1 #define EXMODE_VIM 2 -typedef char_u *(*LineGetter)(int, void *, int); - #ifdef INCLUDE_GENERATED_DECLARATIONS # include "ex_docmd.h.generated.h" #endif diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 28048c933c..74f3edc8d9 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -1817,10 +1817,10 @@ getexmodeline ( p = (char_u *)line_ga.ga_data; p[line_ga.ga_len] = NUL; - indent = get_indent_str(p, 8); + indent = get_indent_str(p, 8, FALSE); indent += sw - indent % sw; add_indent: - while (get_indent_str(p, 8) < indent) { + while (get_indent_str(p, 8, FALSE) < indent) { char_u *s = skipwhite(p); ga_grow(&line_ga, 1); @@ -1858,11 +1858,11 @@ redraw: p[--line_ga.ga_len] = NUL; } else { p[line_ga.ga_len] = NUL; - indent = get_indent_str(p, 8); + indent = get_indent_str(p, 8, FALSE); --indent; indent -= indent % get_sw_value(curbuf); } - while (get_indent_str(p, 8) > indent) { + while (get_indent_str(p, 8, FALSE) > indent) { char_u *s = skipwhite(p); memmove(s - 1, s, line_ga.ga_len - (s - p) + 1); diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index e1f9454b52..2e932e9695 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -4345,11 +4345,10 @@ static int make_bom(char_u *buf, char_u *name) void shorten_fnames(int force) { char_u dirname[MAXPATHL]; - buf_T *buf; char_u *p; os_dirname(dirname, MAXPATHL); - for (buf = firstbuf; buf != NULL; buf = buf->b_next) { + FOR_ALL_BUFFERS(buf) { if (buf->b_fname != NULL && !bt_nofile(buf) && !path_with_url(buf->b_fname) @@ -6109,7 +6108,6 @@ void ex_doautoall(exarg_T *eap) { int retval; aco_save_T aco; - buf_T *buf; char_u *arg = eap->arg; int call_do_modelines = check_nomodeline(&arg); @@ -6120,7 +6118,7 @@ void ex_doautoall(exarg_T *eap) * gives problems when the autocommands make changes to the list of * buffers or windows... */ - for (buf = firstbuf; buf != NULL; buf = buf->b_next) { + FOR_ALL_BUFFERS(buf) { if (buf->b_ml.ml_mfp != NULL) { /* find a window for this buffer and save some values */ aucmd_prepbuf(&aco, buf); diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index e98bb2744c..6c772a8a66 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -2163,7 +2163,7 @@ static int vgetorpeek(int advance) while (col < curwin->w_cursor.col) { if (!vim_iswhite(ptr[col])) curwin->w_wcol = vcol; - vcol += lbr_chartabsize(ptr + col, + vcol += lbr_chartabsize(ptr, ptr + col, (colnr_T)vcol); if (has_mbyte) col += (*mb_ptr2len)(ptr + col); diff --git a/src/nvim/globals.h b/src/nvim/globals.h index a0cbedcc57..ad65f7e6fd 100644 --- a/src/nvim/globals.h +++ b/src/nvim/globals.h @@ -556,6 +556,9 @@ EXTERN buf_T *firstbuf INIT(= NULL); /* first buffer */ EXTERN buf_T *lastbuf INIT(= NULL); /* last buffer */ EXTERN buf_T *curbuf INIT(= NULL); /* currently active buffer */ +// Iterates over all buffers in the buffer list. +# define FOR_ALL_BUFFERS(buf) for (buf_T *buf = firstbuf; buf != NULL; buf = buf->b_next) + /* Flag that is set when switching off 'swapfile'. It means that all blocks * are to be loaded into memory. Shouldn't be global... */ EXTERN int mf_dont_release INIT(= FALSE); /* don't release blocks */ diff --git a/src/nvim/indent.c b/src/nvim/indent.c index d4c6b36177..9258ee93b6 100644 --- a/src/nvim/indent.c +++ b/src/nvim/indent.c @@ -10,8 +10,10 @@ #include "nvim/memory.h" #include "nvim/misc1.h" #include "nvim/misc2.h" +#include "nvim/move.h" #include "nvim/option.h" #include "nvim/regexp.h" +#include "nvim/screen.h" #include "nvim/search.h" #include "nvim/strings.h" #include "nvim/undo.h" @@ -24,14 +26,14 @@ // Count the size (in window cells) of the indent in the current line. int get_indent(void) { - return get_indent_str(get_cursor_line_ptr(), (int)curbuf->b_p_ts); + return get_indent_str(get_cursor_line_ptr(), (int)curbuf->b_p_ts, false); } // Count the size (in window cells) of the indent in line "lnum". int get_indent_lnum(linenr_T lnum) { - return get_indent_str(ml_get(lnum), (int)curbuf->b_p_ts); + return get_indent_str(ml_get(lnum), (int)curbuf->b_p_ts, false); } @@ -39,20 +41,27 @@ int get_indent_lnum(linenr_T lnum) // "buf". int get_indent_buf(buf_T *buf, linenr_T lnum) { - return get_indent_str(ml_get_buf(buf, lnum, false), (int)buf->b_p_ts); + return get_indent_str(ml_get_buf(buf, lnum, false), (int)buf->b_p_ts, false); } // Count the size (in window cells) of the indent in line "ptr", with // 'tabstop' at "ts". -int get_indent_str(char_u *ptr, int ts) +// If @param list is TRUE, count only screen size for tabs. +int get_indent_str(char_u *ptr, int ts, int list) { int count = 0; for (; *ptr; ++ptr) { // Count a tab for what it is worth. if (*ptr == TAB) { - count += ts - (count % ts); + if (!list || lcs_tab1) { // count a tab for what it is worth + count += ts - (count % ts); + } else { + // in list mode, when tab is not set, count screen char width for Tab: + // ^I + count += ptr2cells(ptr); + } } else if (*ptr == ' ') { // Count a space for one. count++; @@ -433,6 +442,50 @@ int get_number_indent(linenr_T lnum) return (int)col; } +/* + * Return appropriate space number for breakindent, taking influencing + * parameters into account. Window must be specified, since it is not + * necessarily always the current one. + */ +int get_breakindent_win(win_T *wp, char_u *line) { + static int prev_indent = 0; /* cached indent value */ + static int prev_ts = 0L; /* cached tabstop value */ + static char_u *prev_line = NULL; /* cached pointer to line */ + int bri = 0; + /* window width minus window margin space, i.e. what rests for text */ + const int eff_wwidth = wp->w_width + - ((wp->w_p_nu || wp->w_p_rnu) + && (vim_strchr(p_cpo, CPO_NUMCOL) == NULL) + ? number_width(wp) + 1 : 0); + + /* used cached indent, unless pointer or 'tabstop' changed */ + if (prev_line != line || prev_ts != wp->w_buffer->b_p_ts) + { + prev_line = line; + prev_ts = wp->w_buffer->b_p_ts; + prev_indent = get_indent_str(line, + (int)wp->w_buffer->b_p_ts, wp->w_p_list); + } + bri = prev_indent + wp->w_p_brishift; + + /* indent minus the length of the showbreak string */ + if (wp->w_p_brisbr) + bri -= vim_strsize(p_sbr); + + /* Add offset for number column, if 'n' is in 'cpoptions' */ + bri += win_col_off2(wp); + + /* never indent past left window margin */ + if (bri < 0) + bri = 0; + /* always leave at least bri_min characters on the left, + * if text width is sufficient */ + else if (bri > eff_wwidth - wp->w_p_brimin) + bri = (eff_wwidth - wp->w_p_brimin < 0) + ? 0 : eff_wwidth - wp->w_p_brimin; + + return bri; +} // When extra == 0: Return true if the cursor is before or on the first // non-blank in the line. @@ -608,10 +661,12 @@ int get_lisp_indent(void) if (vi_lisp && (get_indent() == 0)) { amount = 2; } else { + char_u *line = that; + amount = 0; while (*that && col) { - amount += lbr_chartabsize_adv(&that, (colnr_T)amount); + amount += lbr_chartabsize_adv(line, &that, (colnr_T)amount); col--; } @@ -628,7 +683,7 @@ int get_lisp_indent(void) firsttry = amount; while (vim_iswhite(*that)) { - amount += lbr_chartabsize(that, (colnr_T)amount); + amount += lbr_chartabsize(line, that, (colnr_T)amount); that++; } @@ -658,15 +713,15 @@ int get_lisp_indent(void) parencount--; } if ((*that == '\\') && (*(that + 1) != NUL)) { - amount += lbr_chartabsize_adv(&that, (colnr_T)amount); + amount += lbr_chartabsize_adv(line, &that, (colnr_T)amount); } - amount += lbr_chartabsize_adv(&that, (colnr_T)amount); + amount += lbr_chartabsize_adv(line, &that, (colnr_T)amount); } } while (vim_iswhite(*that)) { - amount += lbr_chartabsize(that, (colnr_T)amount); + amount += lbr_chartabsize(line, that, (colnr_T)amount); that++; } diff --git a/src/nvim/main.c b/src/nvim/main.c index 6b8c2f4d4d..1de4b04a07 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -744,7 +744,6 @@ main_loop ( /* Exit properly */ void getout(int exitval) { - buf_T *buf; win_T *wp; tabpage_T *tp, *next_tp; @@ -772,7 +771,7 @@ void getout(int exitval) if (wp->w_buffer == NULL) /* Autocmd must have close the buffer already, skip. */ continue; - buf = wp->w_buffer; + buf_T *buf = wp->w_buffer; if (buf->b_changedtick != -1) { apply_autocmds(EVENT_BUFWINLEAVE, buf->b_fname, buf->b_fname, FALSE, buf); @@ -785,13 +784,14 @@ void getout(int exitval) } /* Trigger BufUnload for buffers that are loaded */ - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) { if (buf->b_ml.ml_mfp != NULL) { apply_autocmds(EVENT_BUFUNLOAD, buf->b_fname, buf->b_fname, FALSE, buf); if (!buf_valid(buf)) /* autocmd may delete the buffer */ break; } + } apply_autocmds(EVENT_VIMLEAVEPRE, NULL, NULL, FALSE, curbuf); } diff --git a/src/nvim/mark.c b/src/nvim/mark.c index 90abbb6fbb..43469cab45 100644 --- a/src/nvim/mark.c +++ b/src/nvim/mark.c @@ -1337,7 +1337,6 @@ int removable(char_u *name) int write_viminfo_marks(FILE *fp_out) { int count; - buf_T *buf; int is_mark_set; int i; win_T *win; @@ -1346,12 +1345,13 @@ int write_viminfo_marks(FILE *fp_out) /* * Set b_last_cursor for the all buffers that have a window. */ - FOR_ALL_TAB_WINDOWS(tp, win) - set_last_cursor(win); + FOR_ALL_TAB_WINDOWS(tp, win) { + set_last_cursor(win); + } fputs(_("\n# History of marks within files (newest to oldest):\n"), fp_out); count = 0; - for (buf = firstbuf; buf != NULL; buf = buf->b_next) { + FOR_ALL_BUFFERS(buf) { /* * Only write something if buffer has been loaded and at least one * mark is set. @@ -1467,12 +1467,16 @@ void copy_viminfo_marks(vir_T *virp, FILE *fp_out, int count, int eof, int flags } } else { /* fp_out != NULL */ /* This is slow if there are many buffers!! */ - for (buf = firstbuf; buf != NULL; buf = buf->b_next) - if (buf->b_ffname != NULL) { - home_replace(NULL, buf->b_ffname, name_buf, LSIZE, TRUE); - if (fnamecmp(str, name_buf) == 0) + buf = NULL; + FOR_ALL_BUFFERS(bp) { + if (bp->b_ffname != NULL) { + home_replace(NULL, bp->b_ffname, name_buf, LSIZE, TRUE); + if (fnamecmp(str, name_buf) == 0) { + buf = bp; break; + } } + } /* * copy marks if the buffer has not been loaded diff --git a/src/nvim/memfile.c b/src/nvim/memfile.c index 6e8d8f9972..82369b739a 100644 --- a/src/nvim/memfile.c +++ b/src/nvim/memfile.c @@ -613,7 +613,6 @@ static bhdr_T *mf_release(memfile_T *mfp, int page_count) { bhdr_T *hp; int need_release; - buf_T *buf; /* don't release while in mf_close_file() */ if (mf_dont_release) @@ -632,11 +631,16 @@ static bhdr_T *mf_release(memfile_T *mfp, int page_count) */ if (mfp->mf_fd < 0 && need_release && p_uc) { /* find for which buffer this memfile is */ - for (buf = firstbuf; buf != NULL; buf = buf->b_next) - if (buf->b_ml.ml_mfp == mfp) + buf_T *buf = NULL; + FOR_ALL_BUFFERS(bp) { + if (bp->b_ml.ml_mfp == mfp) { + buf = bp; break; - if (buf != NULL && buf->b_may_swap) + } + } + if (buf != NULL && buf->b_may_swap) { ml_open_file(buf); + } } /* @@ -686,12 +690,11 @@ static bhdr_T *mf_release(memfile_T *mfp, int page_count) */ int mf_release_all(void) { - buf_T *buf; memfile_T *mfp; bhdr_T *hp; int retval = FALSE; - for (buf = firstbuf; buf != NULL; buf = buf->b_next) { + FOR_ALL_BUFFERS(buf) { mfp = buf->b_ml.ml_mfp; if (mfp != NULL) { /* If no swap file yet, may open one */ diff --git a/src/nvim/memline.c b/src/nvim/memline.c index a10fc2b8c5..229de4ae1c 100644 --- a/src/nvim/memline.c +++ b/src/nvim/memline.c @@ -466,11 +466,11 @@ void ml_setname(buf_T *buf) */ void ml_open_files(void) { - buf_T *buf; - - for (buf = firstbuf; buf != NULL; buf = buf->b_next) - if (!buf->b_p_ro || buf->b_changed) + FOR_ALL_BUFFERS(buf) { + if (!buf->b_p_ro || buf->b_changed) { ml_open_file(buf); + } + } } /* @@ -584,11 +584,10 @@ void ml_close(buf_T *buf, int del_file) */ void ml_close_all(int del_file) { - buf_T *buf; - - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) { ml_close(buf, del_file && ((buf->b_flags & BF_PRESERVED) == 0 || vim_strchr(p_cpo, CPO_PRESERVE) == NULL)); + } spell_delete_wordlist(); /* delete the internal wordlist */ vim_deltempdir(); /* delete created temp directory */ } @@ -599,11 +598,11 @@ void ml_close_all(int del_file) */ void ml_close_notmod(void) { - buf_T *buf; - - for (buf = firstbuf; buf != NULL; buf = buf->b_next) - if (!bufIsChanged(buf)) + FOR_ALL_BUFFERS(buf) { + if (!bufIsChanged(buf)) { ml_close(buf, TRUE); /* close all not-modified buffers */ + } + } } /* @@ -1617,9 +1616,7 @@ static int recov_file_names(char_u **names, char_u *path, int prepend_dot) */ void ml_sync_all(int check_file, int check_char) { - buf_T *buf; - - for (buf = firstbuf; buf != NULL; buf = buf->b_next) { + FOR_ALL_BUFFERS(buf) { if (buf->b_ml.ml_mfp == NULL || buf->b_ml.ml_mfp->mf_fname == NULL) continue; /* no file */ diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c index 6ba1e68d64..986374b352 100644 --- a/src/nvim/misc1.c +++ b/src/nvim/misc1.c @@ -194,7 +194,7 @@ open_line ( /* * count white space on current line */ - newindent = get_indent_str(saved_line, (int)curbuf->b_p_ts); + newindent = get_indent_str(saved_line, (int)curbuf->b_p_ts, FALSE); if (newindent == 0 && !(flags & OPENLINE_COM_LIST)) newindent = second_line_indent; /* for ^^D command in insert mode */ @@ -631,7 +631,7 @@ open_line ( if (curbuf->b_p_ai || do_si ) - newindent = get_indent_str(leader, (int)curbuf->b_p_ts); + newindent = get_indent_str(leader, (int)curbuf->b_p_ts, FALSE); /* Add the indent offset */ if (newindent + off < 0) { @@ -1306,6 +1306,7 @@ int plines_win_col(win_T *wp, linenr_T lnum, long column) char_u *s; int lines = 0; int width; + char_u *line; /* Check for filler lines above this buffer line. When folded the result * is one line anyway. */ @@ -1317,11 +1318,11 @@ int plines_win_col(win_T *wp, linenr_T lnum, long column) if (wp->w_width == 0) return lines + 1; - s = ml_get_buf(wp->w_buffer, lnum, FALSE); + line = s = ml_get_buf(wp->w_buffer, lnum, FALSE); col = 0; while (*s != NUL && --column >= 0) { - col += win_lbr_chartabsize(wp, s, (colnr_T)col, NULL); + col += win_lbr_chartabsize(wp, line, s, (colnr_T)col, NULL); mb_ptr_adv(s); } @@ -1333,7 +1334,7 @@ int plines_win_col(win_T *wp, linenr_T lnum, long column) * 'ts') -- webb. */ if (*s == TAB && (State & NORMAL) && (!wp->w_p_list || lcs_tab1)) - col += win_lbr_chartabsize(wp, s, (colnr_T)col, NULL) - 1; + col += win_lbr_chartabsize(wp, line, s, (colnr_T)col, NULL) - 1; /* * Add column offset for 'number', 'relativenumber', 'foldcolumn', etc. @@ -3329,8 +3330,6 @@ void prepare_to_exit(void) */ void preserve_exit(void) { - buf_T *buf; - // Prevent repeated calls into this method. if (really_exiting) { exit(2); @@ -3346,7 +3345,7 @@ void preserve_exit(void) ml_close_notmod(); /* close all not-modified buffers */ - for (buf = firstbuf; buf != NULL; buf = buf->b_next) { + FOR_ALL_BUFFERS(buf) { if (buf->b_ml.ml_mfp != NULL && buf->b_ml.ml_mfp->mf_fname != NULL) { OUT_STR("Vim: preserving files...\n"); screen_start(); /* don't know where cursor is now */ diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 0bf338947b..0b0a913a95 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -350,7 +350,8 @@ static void shift_block(oparg_T *oap, int amount) ++bd.textstart; } for (; vim_iswhite(*bd.textstart); ) { - incr = lbr_chartabsize_adv(&bd.textstart, (colnr_T)(bd.start_vcol)); + // TODO: is passing bd.textstart for start of the line OK? + incr = lbr_chartabsize_adv(bd.textstart, &bd.textstart, (colnr_T)(bd.start_vcol)); total += incr; bd.start_vcol += incr; } @@ -405,7 +406,7 @@ static void shift_block(oparg_T *oap, int amount) non_white_col = bd.start_vcol; while (vim_iswhite(*non_white)) { - incr = lbr_chartabsize_adv(&non_white, non_white_col); + incr = lbr_chartabsize_adv(bd.textstart, &non_white, non_white_col); non_white_col += incr; } @@ -429,7 +430,10 @@ static void shift_block(oparg_T *oap, int amount) if (bd.startspaces) verbatim_copy_width -= bd.start_char_vcols; while (verbatim_copy_width < destination_col) { - incr = lbr_chartabsize(verbatim_copy_end, verbatim_copy_width); + char_u *line = verbatim_copy_end; + + // TODO: is passing verbatim_copy_end for start of the line OK? + incr = lbr_chartabsize(line, verbatim_copy_end, verbatim_copy_width); if (verbatim_copy_width + incr > destination_col) break; verbatim_copy_width += incr; @@ -2824,7 +2828,7 @@ do_put ( oldlen = (int)STRLEN(oldp); for (ptr = oldp; vcol < col && *ptr; ) { /* Count a tab for what it's worth (if list mode not on) */ - incr = lbr_chartabsize_adv(&ptr, (colnr_T)vcol); + incr = lbr_chartabsize_adv(oldp, &ptr, (colnr_T)vcol); vcol += incr; } bd.textcol = (colnr_T)(ptr - oldp); @@ -2854,7 +2858,7 @@ do_put ( /* calculate number of spaces required to fill right side of block*/ spaces = y_width + 1; for (j = 0; j < yanklen; j++) - spaces -= lbr_chartabsize(&y_array[i][j], 0); + spaces -= lbr_chartabsize(NULL, &y_array[i][j], 0); if (spaces < 0) spaces = 0; @@ -4114,7 +4118,7 @@ static void block_prep(oparg_T *oap, struct block_def *bdp, linenr_T lnum, int i prev_pstart = line; while (bdp->start_vcol < oap->start_vcol && *pstart) { /* Count a tab for what it's worth (if list mode not on) */ - incr = lbr_chartabsize(pstart, (colnr_T)bdp->start_vcol); + incr = lbr_chartabsize(line, pstart, (colnr_T)bdp->start_vcol); bdp->start_vcol += incr; if (vim_iswhite(*pstart)) { bdp->pre_whitesp += incr; @@ -4163,7 +4167,9 @@ static void block_prep(oparg_T *oap, struct block_def *bdp, linenr_T lnum, int i while (bdp->end_vcol <= oap->end_vcol && *pend != NUL) { /* Count a tab for what it's worth (if list mode not on) */ prev_pend = pend; - incr = lbr_chartabsize_adv(&pend, (colnr_T)bdp->end_vcol); + // TODO: is passing prev_pend for start of the line OK? + // prehaps it should be "line" + incr = lbr_chartabsize_adv(prev_pend, &pend, (colnr_T)bdp->end_vcol); bdp->end_vcol += incr; } if (bdp->end_vcol <= oap->end_vcol diff --git a/src/nvim/option.c b/src/nvim/option.c index 6428ef1eb3..6eac1033c4 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -176,6 +176,8 @@ */ #define PV_LIST OPT_WIN(WV_LIST) # define PV_ARAB OPT_WIN(WV_ARAB) +# define PV_BRI OPT_WIN(WV_BRI) +# define PV_BRIOPT OPT_WIN(WV_BRIOPT) # define PV_DIFF OPT_WIN(WV_DIFF) # define PV_FDC OPT_WIN(WV_FDC) # define PV_FEN OPT_WIN(WV_FEN) @@ -471,6 +473,14 @@ static struct vimoption (char_u *)&p_breakat, PV_NONE, {(char_u *)" \t!@*-+;:,./?", (char_u *)0L} SCRIPTID_INIT}, + {"breakindent", "bri", P_BOOL|P_VI_DEF|P_VIM|P_RWIN, + (char_u *)VAR_WIN, PV_BRI, + {(char_u *)FALSE, (char_u *)0L} + SCRIPTID_INIT}, + {"breakindentopt", "briopt", P_STRING|P_ALLOCED|P_VI_DEF|P_RBUF|P_COMMA|P_NODUP, + (char_u *)VAR_WIN, PV_BRIOPT, + {(char_u *)"", (char_u *)NULL} + SCRIPTID_INIT}, {"browsedir", "bsdir",P_STRING|P_VI_DEF, (char_u *)NULL, PV_NONE, {(char_u *)0L, (char_u *)0L} @@ -3481,6 +3491,7 @@ static void didset_options(void) (void)compile_cap_prog(curwin->w_s); /* set cedit_key */ (void)check_cedit(); + briopt_check(); } /* @@ -3815,6 +3826,11 @@ did_set_string_option ( *p_pm == '.' ? p_pm + 1 : p_pm) == 0) errmsg = (char_u *)N_("E589: 'backupext' and 'patchmode' are equal"); } + /* 'breakindentopt' */ + else if (varp == &curwin->w_p_briopt) { + if (briopt_check() == FAIL) + errmsg = e_invarg; + } /* * 'isident', 'iskeyword', 'isprint or 'isfname' option: refill chartab[] * If the new option is invalid, use old value. 'lisp' option: refill @@ -6516,10 +6532,13 @@ void comp_col(void) void unset_global_local_option(char *name, void *from) { struct vimoption *p; - int opt_idx; buf_T *buf = (buf_T *)from; - opt_idx = findoption((uint8_t *)name); + int opt_idx = findoption((uint8_t *)name); + if (opt_idx < 0) { + EMSG2(_("E355: Unknown option: %s"), name); + return; + } p = &(options[opt_idx]); switch ((int)p->indir) @@ -6678,6 +6697,8 @@ static char_u *get_varp(struct vimoption *p) case PV_SCROLL: return (char_u *)&(curwin->w_p_scr); case PV_WRAP: return (char_u *)&(curwin->w_p_wrap); case PV_LBR: return (char_u *)&(curwin->w_p_lbr); + case PV_BRI: return (char_u *)&(curwin->w_p_bri); + case PV_BRIOPT: return (char_u *)&(curwin->w_p_briopt); case PV_SCBIND: return (char_u *)&(curwin->w_p_scb); case PV_CRBIND: return (char_u *)&(curwin->w_p_crb); case PV_COCU: return (char_u *)&(curwin->w_p_cocu); @@ -6785,6 +6806,8 @@ void copy_winopt(winopt_T *from, winopt_T *to) to->wo_wrap = from->wo_wrap; to->wo_wrap_save = from->wo_wrap_save; to->wo_lbr = from->wo_lbr; + to->wo_bri = from->wo_bri; + to->wo_briopt = vim_strsave(from->wo_briopt); to->wo_scb = from->wo_scb; to->wo_scb_save = from->wo_scb_save; to->wo_crb = from->wo_crb; @@ -6827,7 +6850,7 @@ void check_win_options(win_T *win) /* * Check for NULL pointers in a winopt_T and replace them with empty_option. */ -void check_winopt(winopt_T *wop) +static void check_winopt(winopt_T *wop) { check_string_option(&wop->wo_fdi); check_string_option(&wop->wo_fdm); @@ -6839,6 +6862,7 @@ void check_winopt(winopt_T *wop) check_string_option(&wop->wo_stl); check_string_option(&wop->wo_cc); check_string_option(&wop->wo_cocu); + check_string_option(&wop->wo_briopt); } /* @@ -6856,6 +6880,7 @@ void clear_winopt(winopt_T *wop) clear_string_option(&wop->wo_stl); clear_string_option(&wop->wo_cc); clear_string_option(&wop->wo_cocu); + clear_string_option(&wop->wo_briopt); } /* @@ -7674,7 +7699,6 @@ static void paste_option_changed(void) static int save_ru = 0; static int save_ri = 0; static int save_hkmap = 0; - buf_T *buf; if (p_paste) { /* @@ -7683,7 +7707,7 @@ static void paste_option_changed(void) */ if (!old_p_paste) { /* save options for each buffer */ - for (buf = firstbuf; buf != NULL; buf = buf->b_next) { + FOR_ALL_BUFFERS(buf) { buf->b_p_tw_nopaste = buf->b_p_tw; buf->b_p_wm_nopaste = buf->b_p_wm; buf->b_p_sts_nopaste = buf->b_p_sts; @@ -7707,7 +7731,7 @@ static void paste_option_changed(void) * already on. */ /* set options for each buffer */ - for (buf = firstbuf; buf != NULL; buf = buf->b_next) { + FOR_ALL_BUFFERS(buf) { buf->b_p_tw = 0; /* textwidth is 0 */ buf->b_p_wm = 0; /* wrapmargin is 0 */ buf->b_p_sts = 0; /* softtabstop is 0 */ @@ -7732,7 +7756,7 @@ static void paste_option_changed(void) */ else if (old_p_paste) { /* restore options for each buffer */ - for (buf = firstbuf; buf != NULL; buf = buf->b_next) { + FOR_ALL_BUFFERS(buf) { buf->b_p_tw = buf->b_p_tw_nopaste; buf->b_p_wm = buf->b_p_wm_nopaste; buf->b_p_sts = buf->b_p_sts_nopaste; @@ -8132,3 +8156,45 @@ void find_mps_values(int *initc, int *findc, int *backwards, int switchit) ++ptr; } } + +/* This is called when 'breakindentopt' is changed and when a window is + initialized */ +int briopt_check(void) +{ + char_u *p; + int bri_shift = 0; + long bri_min = 20; + bool bri_sbr = false; + + p = curwin->w_p_briopt; + while (*p != NUL) + { + if (STRNCMP(p, "shift:", 6) == 0 + && ((p[6] == '-' && VIM_ISDIGIT(p[7])) || VIM_ISDIGIT(p[6]))) + { + p += 6; + bri_shift = getdigits(&p); + } + else if (STRNCMP(p, "min:", 4) == 0 && VIM_ISDIGIT(p[4])) + { + p += 4; + bri_min = getdigits(&p); + } + else if (STRNCMP(p, "sbr", 3) == 0) + { + p += 3; + bri_sbr = true; + } + if (*p != ',' && *p != NUL) + return FAIL; + if (*p == ',') + ++p; + } + + curwin->w_p_brishift = bri_shift; + curwin->w_p_brimin = bri_min; + curwin->w_p_brisbr = bri_sbr; + + return OK; +} + diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index d862ab2761..555e9166d6 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -726,6 +726,8 @@ enum { , WV_COCU , WV_COLE , WV_CRBIND + , WV_BRI + , WV_BRIOPT , WV_DIFF , WV_FDC , WV_FEN diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 03c59bf584..811f265902 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -106,6 +106,7 @@ #include "nvim/farsi.h" #include "nvim/fileio.h" #include "nvim/fold.h" +#include "nvim/indent.h" #include "nvim/getchar.h" #include "nvim/main.h" #include "nvim/mbyte.h" @@ -2196,6 +2197,7 @@ win_line ( char_u extra[18]; /* line number and 'fdc' must fit in here */ int n_extra = 0; /* number of extra chars */ char_u *p_extra = NULL; /* string of extra chars, plus NUL */ + char_u *p_extra_free = NULL; /* p_extra needs to be freed */ int c_extra = NUL; /* extra chars, all the same */ int extra_attr = 0; /* attributes when n_extra != 0 */ static char_u *at_end_str = (char_u *)""; /* used for p_extra when @@ -2283,7 +2285,8 @@ win_line ( # define WL_FOLD WL_CMDLINE + 1 /* 'foldcolumn' */ # define WL_SIGN WL_FOLD + 1 /* column for signs */ #define WL_NR WL_SIGN + 1 /* line number */ -# define WL_SBR WL_NR + 1 /* 'showbreak' or 'diff' */ +# define WL_BRI WL_NR + 1 /* 'breakindent' */ +# define WL_SBR WL_BRI + 1 /* 'showbreak' or 'diff' */ #define WL_LINE WL_SBR + 1 /* text in the line */ int draw_state = WL_START; /* what to draw next */ @@ -2540,7 +2543,7 @@ win_line ( if (v > 0) { char_u *prev_ptr = ptr; while (vcol < v && *ptr != NUL) { - c = win_lbr_chartabsize(wp, ptr, (colnr_T)vcol, NULL); + c = win_lbr_chartabsize(wp, line, ptr, (colnr_T)vcol, NULL); vcol += c; prev_ptr = ptr; mb_ptr_adv(ptr); @@ -2817,6 +2820,34 @@ win_line ( } } + if (wp->w_p_brisbr && draw_state == WL_BRI - 1 + && n_extra == 0 && *p_sbr != NUL) { + // draw indent after showbreak value + draw_state = WL_BRI; + } else if (wp->w_p_brisbr && draw_state == WL_SBR && n_extra == 0) { + // after the showbreak, draw the breakindent + draw_state = WL_BRI - 1; + } + + // draw 'breakindent': indent wrapped text accodringly + if (draw_state == WL_BRI - 1 && n_extra == 0) { + draw_state = WL_BRI; + if (wp->w_p_bri && n_extra == 0 && row != startrow && filler_lines == 0) { + char_attr = 0; // was: hl_attr(HLF_AT); + + if (diff_hlf != (hlf_T)0) + char_attr = hl_attr(diff_hlf); + + p_extra = NULL; + c_extra = ' '; + n_extra = get_breakindent_win(wp, ml_get_buf(wp->w_buffer, lnum, FALSE)); + /* Correct end of highlighted area for 'breakindent', + required wen 'linebreak' is also set. */ + if (tocol == vcol) + tocol += n_extra; + } + } + if (draw_state == WL_SBR - 1 && n_extra == 0) { draw_state = WL_SBR; if (filler_todo > 0) { @@ -3078,6 +3109,10 @@ win_line ( } --n_extra; } else { + if (p_extra_free != NULL) { + free(p_extra_free); + p_extra_free = NULL; + } /* * Get a character from the line itself. */ @@ -3378,17 +3413,20 @@ win_line ( /* * Found last space before word: check for line break. */ - if (wp->w_p_lbr && vim_isbreak(c) && !vim_isbreak(*ptr) - && !wp->w_p_list) { - n_extra = win_lbr_chartabsize(wp, ptr - ( - has_mbyte ? mb_l : - 1), (colnr_T)vcol, NULL) - 1; + if (wp->w_p_lbr && vim_isbreak(c) && !vim_isbreak(*ptr)) { + char_u *p = ptr - ( + has_mbyte ? mb_l : + 1); + // TODO: is passing p for start of the line OK? + n_extra = win_lbr_chartabsize(wp, line, p, (colnr_T)vcol, NULL) - 1; c_extra = ' '; if (vim_iswhite(c)) { if (c == TAB) /* See "Tab alignment" below. */ FIX_FOR_BOGUSCOLS; - c = ' '; + if (!wp->w_p_list) { + c = ' '; + } } } @@ -3419,9 +3457,36 @@ win_line ( * into "ScreenLines". */ if (c == TAB && (!wp->w_p_list || lcs_tab1)) { + int tab_len = 0; /* tab amount depends on current column */ - n_extra = (int)wp->w_buffer->b_p_ts + tab_len = (int)wp->w_buffer->b_p_ts - vcol % (int)wp->w_buffer->b_p_ts - 1; + if (!wp->w_p_lbr || !wp->w_p_list) { + n_extra = tab_len; + } else { + char_u *p; + int len = n_extra; + int i; + int saved_nextra = n_extra; + + /* if n_extra > 0, it gives the number of chars to use for + * a tab, else we need to calculate the width for a tab */ + len = (tab_len * mb_char2len(lcs_tab2)); + if (n_extra > 0) { + len += n_extra - tab_len; + } + c = lcs_tab1; + p = xmalloc(len + 1); + memset(p, ' ', len); + p[len] = NUL; + p_extra_free = p; + for (i = 0; i < tab_len; i++) { + mb_char2bytes(lcs_tab2, p); + p += mb_char2len(lcs_tab2); + n_extra += mb_char2len(lcs_tab2) - (saved_nextra > 0 ? 1: 0); + } + p_extra = p_extra_free; + } /* Tab alignment should be identical regardless of * 'conceallevel' value. So tab compensates of all * previous concealed characters, and thus resets vcol_off @@ -3432,8 +3497,12 @@ win_line ( mb_utf8 = FALSE; /* don't draw as UTF-8 */ if (wp->w_p_list) { c = lcs_tab1; - c_extra = lcs_tab2; - n_attr = n_extra + 1; + if (wp->w_p_lbr) { + c_extra = NUL; /* using p_extra from above */ + } else { + c_extra = lcs_tab2; + } + n_attr = tab_len + 1; extra_attr = hl_attr(HLF_8); saved_attr2 = char_attr; /* save current attr */ mb_c = c; @@ -3493,11 +3562,25 @@ win_line ( mb_utf8 = FALSE; /* don't draw as UTF-8 */ } else if (c != NUL) { p_extra = transchar(c); + if (n_extra == 0) { + n_extra = byte2cells(c); + } if ((dy_flags & DY_UHEX) && wp->w_p_rl) rl_mirror(p_extra); /* reverse "<12>" */ - n_extra = byte2cells(c) - 1; c_extra = NUL; - c = *p_extra++; + if (wp->w_p_lbr) { + char_u *p; + + c = *p_extra; + p = xmalloc(n_extra + 1); + memset(p, ' ', n_extra); + STRNCPY(p, p_extra + 1, STRLEN(p_extra) - 1); + p[n_extra] = NUL; + p_extra_free = p_extra = p; + } else { + n_extra = byte2cells(c) - 1; + c = *p_extra++; + } if (!attr_pri) { n_attr = n_extra + 1; extra_attr = hl_attr(HLF_8); diff --git a/src/nvim/spell.c b/src/nvim/spell.c index 17093571c0..d277d71d99 100644 --- a/src/nvim/spell.c +++ b/src/nvim/spell.c @@ -4131,11 +4131,11 @@ void spell_delete_wordlist(void) void spell_free_all(void) { slang_T *slang; - buf_T *buf; // Go through all buffers and handle 'spelllang'. <VN> - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) { ga_clear(&buf->b_s.b_langp); + } while (first_lang != NULL) { slang = first_lang; diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index 21f2928593..92fd47ff6b 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -5,6 +5,7 @@ export SHELL := sh VIMPROG := ../../../build/bin/nvim +SCRIPTSOURCE := ../../../runtime SCRIPTS := test_autoformat_join.out \ test_eval.out \ @@ -29,7 +30,10 @@ SCRIPTS := test_autoformat_join.out \ test91.out test92.out test93.out test94.out test95.out \ test96.out test97.out test98.out test99.out test100.out \ test101.out test102.out test103.out test104.out test105.out \ - test106.out test107.out + test106.out test107.out \ + test_options.out \ + test_listlbr.out test_listlbr_utf8.out \ + test_breakindent.out SCRIPTS_GUI := test16.out @@ -86,7 +90,7 @@ $(SCRIPTS) $(SCRIPTS_GUI): $(VIMPROG) test1.out RM_ON_RUN := test.out X* viminfo RM_ON_START := tiny.vim small.vim mbyte.vim mzscheme.vim lua.vim test.ok -RUN_VIM := $(TOOL) $(VIMPROG) -u unix.vim -U NONE --noplugin -s dotest.in +RUN_VIM := VIMRUNTIME=$(SCRIPTSOURCE); export VIMRUNTIME; $(TOOL) $(VIMPROG) -u unix.vim -U NONE --noplugin -s dotest.in clean: -rm -rf *.out \ diff --git a/src/nvim/testdir/test105.in b/src/nvim/testdir/test105.in index 73d92e899d..bfb4b65fbb 100644 --- a/src/nvim/testdir/test105.in +++ b/src/nvim/testdir/test105.in @@ -7,7 +7,7 @@ STARTTEST :set shellslash :let tab="\t" :command -nargs=1 Put :let expr=<q-args> | $put =expr.tab.strtrans(string(eval(expr))) -:let $HOME=fnamemodify('.', ':p:h:h:h:h') +:let $HOME=fnamemodify('.', ':p:h:h:h') :Put fnamemodify('.', ':p' )[-1:] :Put fnamemodify('.', ':p:h' )[-1:] :Put fnamemodify('test.out', ':p' )[-1:] @@ -23,7 +23,7 @@ STARTTEST :Put fnamemodify('abc.fb2.tar.gz', ':r' ) :Put fnamemodify('abc.fb2.tar.gz', ':r:r' ) :Put fnamemodify('abc.fb2.tar.gz', ':r:r:r' ) -:Put substitute(fnamemodify('abc.fb2.tar.gz', ':p:r:r'), '.*\(src/nvim/testdir/.*\)', '\1', '') +:Put substitute(fnamemodify('abc.fb2.tar.gz', ':p:r:r'), '.*\(nvim/testdir/.*\)', '\1', '') :Put fnamemodify('abc.fb2.tar.gz', ':e' ) :Put fnamemodify('abc.fb2.tar.gz', ':e:e' ) :Put fnamemodify('abc.fb2.tar.gz', ':e:e:e' ) diff --git a/src/nvim/testdir/test105.ok b/src/nvim/testdir/test105.ok index be1eca8f8f..0b30ee4281 100644 --- a/src/nvim/testdir/test105.ok +++ b/src/nvim/testdir/test105.ok @@ -3,8 +3,8 @@ fnamemodify('.', ':p:h' )[-1:] 'r' fnamemodify('test.out', ':p' )[-1:] 't' fnamemodify('test.out', ':.' ) 'test.out' fnamemodify('../testdir/a', ':.' ) 'a' -fnamemodify('test.out', ':~' ) '~/src/nvim/testdir/test.out' -fnamemodify('../testdir/a', ':~' ) '~/src/nvim/testdir/a' +fnamemodify('test.out', ':~' ) '~/nvim/testdir/test.out' +fnamemodify('../testdir/a', ':~' ) '~/nvim/testdir/a' fnamemodify('../testdir/a', ':t' ) 'a' fnamemodify('.', ':p:t' ) '' fnamemodify('test.out', ':p:t' ) 'test.out' @@ -13,7 +13,7 @@ fnamemodify('test.out', ':p:t:e' ) 'out' fnamemodify('abc.fb2.tar.gz', ':r' ) 'abc.fb2.tar' fnamemodify('abc.fb2.tar.gz', ':r:r' ) 'abc.fb2' fnamemodify('abc.fb2.tar.gz', ':r:r:r' ) 'abc' -substitute(fnamemodify('abc.fb2.tar.gz', ':p:r:r'), '.*\(src/nvim/testdir/.*\)', '\1', '') 'src/nvim/testdir/abc.fb2' +substitute(fnamemodify('abc.fb2.tar.gz', ':p:r:r'), '.*\(nvim/testdir/.*\)', '\1', '') 'nvim/testdir/abc.fb2' fnamemodify('abc.fb2.tar.gz', ':e' ) 'gz' fnamemodify('abc.fb2.tar.gz', ':e:e' ) 'tar.gz' fnamemodify('abc.fb2.tar.gz', ':e:e:e' ) 'fb2.tar.gz' diff --git a/src/nvim/testdir/test_breakindent.in b/src/nvim/testdir/test_breakindent.in new file mode 100644 index 0000000000..8f40e4f7e5 --- /dev/null +++ b/src/nvim/testdir/test_breakindent.in @@ -0,0 +1,79 @@ +Test for breakindent + +STARTTEST +:so small.vim +:if !exists("+breakindent") | e! test.ok | w! test.out | qa! | endif +:10new|:vsp|:vert resize 20 +:put =\"\tabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP\" +:set ts=4 sw=4 sts=4 breakindent +:fu! ScreenChar(width) +: let c='' +: for i in range(1,a:width) +: let c.=nr2char(screenchar(line('.'), i)) +: endfor +: let c.="\n" +: for i in range(1,a:width) +: let c.=nr2char(screenchar(line('.')+1, i)) +: endfor +: let c.="\n" +: for i in range(1,a:width) +: let c.=nr2char(screenchar(line('.')+2, i)) +: endfor +: return c +:endfu +:fu DoRecordScreen() +: wincmd l +: $put =printf(\"\n%s\", g:test) +: $put =g:line1 +: wincmd p +:endfu +:let g:test="Test 1: Simple breakindent" +:let line1=ScreenChar(8) +:call DoRecordScreen() +:let g:test="Test 2: Simple breakindent + sbr=>>" +:set sbr=>> +:let line1=ScreenChar(8) +:call DoRecordScreen() +:let g:test ="Test 3: Simple breakindent + briopt:sbr" +:set briopt=sbr,min:0 sbr=++ +:let line1=ScreenChar(8) +:call DoRecordScreen() +:let g:test ="Test 4: Simple breakindent + min width: 18" +:set sbr= briopt=min:18 +:let line1=ScreenChar(8) +:call DoRecordScreen() +:let g:test =" Test 5: Simple breakindent + shift by 2" +:set briopt=shift:2,min:0 +:let line1=ScreenChar(8) +:call DoRecordScreen() +:let g:test=" Test 6: Simple breakindent + shift by -1" +:set briopt=shift:-1,min:0 +:let line1=ScreenChar(8) +:call DoRecordScreen() +:let g:test=" Test 7: breakindent + shift by +1 + nu + sbr=? briopt:sbr" +:set briopt=shift:1,sbr,min:0 nu sbr=? nuw=4 +:let line1=ScreenChar(10) +:call DoRecordScreen() +:let g:test=" Test 8: breakindent + shift:1 + nu + sbr=# list briopt:sbr" +:set briopt=shift:1,sbr,min:0 nu sbr=# list +:let line1=ScreenChar(10) +:call DoRecordScreen() +:let g:test=" Test 9: breakindent + shift by +1 + 'nu' + sbr=# list" +:set briopt-=sbr +:let line1=ScreenChar(10) +:call DoRecordScreen() +:let g:test=" Test 10: breakindent + shift by +1 + 'nu' + sbr=~ cpo+=n" +:set cpo+=n sbr=~ nu nuw=4 nolist briopt=sbr,min:0 +:let line1=ScreenChar(10) +:call DoRecordScreen() +:wincmd p +:let g:test="\n Test 11: strdisplaywidth when breakindent is on" +:set cpo-=n sbr=>> nu nuw=4 nolist briopt= ts=4 +:let text=getline(2) "skip leading tab when calculating text width +:let width = strlen(text[1:])+indent(2)*4+strlen(&sbr)*3 " text wraps 3 times +:$put =g:test +:$put =printf(\"strdisplaywidth: %d == calculated: %d\", strdisplaywidth(text), width) +:%w! test.out +:qa! +ENDTEST +dummy text diff --git a/src/nvim/testdir/test_breakindent.ok b/src/nvim/testdir/test_breakindent.ok new file mode 100644 index 0000000000..723cb25012 --- /dev/null +++ b/src/nvim/testdir/test_breakindent.ok @@ -0,0 +1,55 @@ + + abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP + +Test 1: Simple breakindent + abcd + qrst + GHIJ + +Test 2: Simple breakindent + sbr=>> + abcd + >>qr + >>EF + +Test 3: Simple breakindent + briopt:sbr + abcd +++ qrst +++ GHIJ + +Test 4: Simple breakindent + min width: 18 + abcd + qrstuv + IJKLMN + + Test 5: Simple breakindent + shift by 2 + abcd + qr + EF + + Test 6: Simple breakindent + shift by -1 + abcd + qrstu + HIJKL + + Test 7: breakindent + shift by +1 + nu + sbr=? briopt:sbr + 2 ab +? m +? x + + Test 8: breakindent + shift:1 + nu + sbr=# list briopt:sbr + 2 ^Iabcd +# opq +# BCD + + Test 9: breakindent + shift by +1 + 'nu' + sbr=# list + 2 ^Iabcd + #op + #AB + + Test 10: breakindent + shift by +1 + 'nu' + sbr=~ cpo+=n + 2 ab +~ mn +~ yz + + Test 11: strdisplaywidth when breakindent is on +strdisplaywidth: 46 == calculated: 64 diff --git a/src/nvim/testdir/test_listlbr.in b/src/nvim/testdir/test_listlbr.in new file mode 100644 index 0000000000..0cce4c23a5 --- /dev/null +++ b/src/nvim/testdir/test_listlbr.in @@ -0,0 +1,52 @@ +Test for linebreak and list option (non-utf8) + +STARTTEST +:so small.vim +:if !exists("+linebreak") | e! test.ok | w! test.out | qa! | endif +:10new|:vsp|:vert resize 20 +:put =\"\tabcdef hijklmn\tpqrstuvwxyz_1060ABCDEFGHIJKLMNOP \" +:norm! zt +:set ts=4 sw=4 sts=4 linebreak sbr=+ wrap +:fu! ScreenChar(width) +: let c='' +: for j in range(1,4) +: for i in range(1,a:width) +: let c.=nr2char(screenchar(j, i)) +: endfor +: let c.="\n" +: endfor +: return c +:endfu +:fu! DoRecordScreen() +: wincmd l +: $put =printf(\"\n%s\", g:test) +: $put =g:line +: wincmd p +:endfu +:let g:test="Test 1: set linebreak" +:redraw! +:let line=ScreenChar(winwidth(0)) +:call DoRecordScreen() +:let g:test="Test 2: set linebreak + set list" +:set linebreak list listchars= +:redraw! +:let line=ScreenChar(winwidth(0)) +:call DoRecordScreen() +:let g:test ="Test 3: set linebreak nolist" +:set nolist linebreak +:redraw! +:let line=ScreenChar(winwidth(0)) +:call DoRecordScreen() +:let g:test ="Test 4: set linebreak with tab and 1 line as long as screen: should break!" +:set nolist linebreak ts=8 +:let line="1\t".repeat('a', winwidth(0)-2) +:$put =line +:$ +:norm! zt +:redraw! +:let line=ScreenChar(winwidth(0)) +:call DoRecordScreen() +:%w! test.out +:qa! +ENDTEST +dummy text diff --git a/src/nvim/testdir/test_listlbr.ok b/src/nvim/testdir/test_listlbr.ok new file mode 100644 index 0000000000..be323d4dc7 --- /dev/null +++ b/src/nvim/testdir/test_listlbr.ok @@ -0,0 +1,27 @@ + + abcdef hijklmn pqrstuvwxyz_1060ABCDEFGHIJKLMNOP + +Test 1: set linebreak + abcdef ++hijklmn ++pqrstuvwxyz_1060ABC ++DEFGHIJKLMNOP + +Test 2: set linebreak + set list +^Iabcdef hijklmn^I ++pqrstuvwxyz_1060ABC ++DEFGHIJKLMNOP + + +Test 3: set linebreak nolist + abcdef ++hijklmn ++pqrstuvwxyz_1060ABC ++DEFGHIJKLMNOP +1 aaaaaaaaaaaaaaaaaa + +Test 4: set linebreak with tab and 1 line as long as screen: should break! +1 ++aaaaaaaaaaaaaaaaaa +~ +~ diff --git a/src/nvim/testdir/test_listlbr_utf8.in b/src/nvim/testdir/test_listlbr_utf8.in new file mode 100644 index 0000000000..ba12adae05 --- /dev/null +++ b/src/nvim/testdir/test_listlbr_utf8.in @@ -0,0 +1,52 @@ +Test for linebreak and list option in utf-8 mode + +STARTTEST +:so small.vim +:if !exists("+linebreak") | e! test.ok | w! test.out | qa! | endif +:so mbyte.vim +:if &enc !=? 'utf-8'|:e! test.ok|:w! test.out|qa!|endif +:10new|:vsp|:vert resize 20 +:put =\"\tabcdef hijklmn\tpqrstuvwxyz\u00a01060ABCDEFGHIJKLMNOP \" +:norm! zt +:set ts=4 sw=4 sts=4 linebreak sbr=+ wrap +:fu! ScreenChar(width) +: let c='' +: for j in range(1,4) +: for i in range(1,a:width) +: let c.=nr2char(screenchar(j, i)) +: endfor +: let c.="\n" +: endfor +: return c +:endfu +:fu! DoRecordScreen() +: wincmd l +: $put =printf(\"\n%s\", g:test) +: $put =g:line +: wincmd p +:endfu +:let g:test ="Test 1: set linebreak + set list + fancy listchars" +:exe "set linebreak list listchars=nbsp:\u2423,tab:\u2595\u2014,trail:\u02d1,eol:\ub6" +:redraw! +:let line=ScreenChar(winwidth(0)) +:call DoRecordScreen() +:" +:let g:test ="Test 2: set nolinebreak list" +:set list nolinebreak +:redraw! +:let line=ScreenChar(winwidth(0)) +:call DoRecordScreen() +:" +:let g:test ="Test 3: set linebreak nolist" +:$put =\"\t*mask = nil;\" +:$ +:norm! zt +:set nolist linebreak +:redraw! +:let line=ScreenChar(winwidth(0)) +:call DoRecordScreen() +:" +:%w! test.out +:qa! +ENDTEST +dummy text diff --git a/src/nvim/testdir/test_listlbr_utf8.ok b/src/nvim/testdir/test_listlbr_utf8.ok new file mode 100644 index 0000000000..634cf3906d --- /dev/null +++ b/src/nvim/testdir/test_listlbr_utf8.ok @@ -0,0 +1,21 @@ + + abcdef hijklmn pqrstuvwxyz 1060ABCDEFGHIJKLMNOP + +Test 1: set linebreak + set list + fancy listchars +▕———abcdef ++hijklmn▕——— ++pqrstuvwxyz␣1060ABC ++DEFGHIJKLMNOPˑ¶ + +Test 2: set nolinebreak list +▕———abcdef hijklmn▕— ++pqrstuvwxyz␣1060ABC ++DEFGHIJKLMNOPˑ¶ +¶ + *mask = nil; + +Test 3: set linebreak nolist + *mask = nil; +~ +~ +~ diff --git a/src/nvim/testdir/test_options.in b/src/nvim/testdir/test_options.in new file mode 100644 index 0000000000..bf1232a223 --- /dev/null +++ b/src/nvim/testdir/test_options.in @@ -0,0 +1,17 @@ +Test for ":options". + +STARTTEST +:so small.vim +:let caught = 'ok' +:try + :options +:catch + :let caught = v:throwpoint . "\n" . v:exception +:endtry +:buf 1 +:$put =caught +:/^result/,$w! test.out +:qa! +ENDTEST + +result diff --git a/src/nvim/testdir/test_options.ok b/src/nvim/testdir/test_options.ok new file mode 100644 index 0000000000..a2e1494a1f --- /dev/null +++ b/src/nvim/testdir/test_options.ok @@ -0,0 +1,2 @@ +result +ok diff --git a/src/nvim/version.c b/src/nvim/version.c index cbfffc93ad..b164f94bb1 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -207,7 +207,7 @@ static int included_patches[] = { //391, //390, //389, - //388, + 388, //387, //386, //385, @@ -224,8 +224,8 @@ static int included_patches[] = { //374, //373, //372, - //371, - //370, + 371, + 370, //369, //368, //367, @@ -242,22 +242,22 @@ static int included_patches[] = { //356 NA //355, //354, - //353, - //352, + 353, + 352, //351, //350, //349, //348, //347, - //346, + 346, //345, //344, //343, //342 NA //341, //340 NA - //339, - //338, + 339, + 338, //337, //336, 335, @@ -266,11 +266,11 @@ static int included_patches[] = { //332 NA 331, //330, - //329, + 329, 328, 327, //326 NA - //325, + 325, //324, 323, //322 NA @@ -278,7 +278,7 @@ static int included_patches[] = { //320, //319 NA 318, - //317, + 317, //316 NA 315, 314, @@ -299,7 +299,7 @@ static int included_patches[] = { //299 NA 298, //297, - //296, + 296, 295, 294, 293, @@ -364,7 +364,7 @@ static int included_patches[] = { 234, 233, 232, - //231, + 231, 230, 229, //228 NA @@ -375,7 +375,7 @@ static int included_patches[] = { //223 NA //222 NA 221, - //220, + 220, 219, 218, //217 NA @@ -406,11 +406,11 @@ static int included_patches[] = { 192, 191, //190 NA - //189, + //189 NA //188 NA 187, 186, - //185, + //185 NA 184, //183 NA //182 NA @@ -419,7 +419,7 @@ static int included_patches[] = { //179 NA 178, //177 NA - //176, + //176 NA //175 NA //174 NA 173, diff --git a/src/nvim/window.c b/src/nvim/window.c index 52401a12ee..3499b14688 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -3396,12 +3396,19 @@ static void win_enter_ext(win_T *wp, bool undo_sync, int curwin_invalid, int tri return; } - /* sync undo before leaving the current buffer */ - if (undo_sync && curbuf != wp->w_buffer) + // sync undo before leaving the current buffer + if (undo_sync && curbuf != wp->w_buffer) { u_sync(FALSE); - /* may have to copy the buffer options when 'cpo' contains 'S' */ - if (wp->w_buffer != curbuf) + } + + // Might need to scroll the old window before switching, e.g., when the + // cursor was moved. + update_topline(); + + // may have to copy the buffer options when 'cpo' contains 'S' + if (wp->w_buffer != curbuf) { buf_copy_options(wp->w_buffer, BCO_ENTER | BCO_NOHELP); + } if (!curwin_invalid) { prevwin = curwin; /* remember for CTRL-W p */ curwin->w_redr_status = TRUE; @@ -3569,7 +3576,6 @@ win_free ( ) { int i; - buf_T *buf; wininfo_T *wip; handle_unregister_window(wp); @@ -3582,13 +3588,6 @@ win_free ( * gui_mch_destroy_scrollbar() may trigger a FocusGained event. */ block_autocmds(); - - - - - - - clear_winopt(&wp->w_onebuf_opt); clear_winopt(&wp->w_allbuf_opt); @@ -3607,10 +3606,11 @@ win_free ( /* Remove the window from the b_wininfo lists, it may happen that the * freed memory is re-used for another window. */ - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) { for (wip = buf->b_wininfo; wip != NULL; wip = wip->wi_next) if (wip->wi_win == wp) wip->wi_win = NULL; + } clear_matches(wp); @@ -3730,8 +3730,11 @@ void win_alloc_lines(win_T *wp) */ void win_free_lsize(win_T *wp) { - free(wp->w_lines); - wp->w_lines = NULL; + // TODO: why would wp be NULL here? + if (wp != NULL) { + free(wp->w_lines); + wp->w_lines = NULL; + } } /* @@ -4484,7 +4487,12 @@ void win_new_height(win_T *wp, int height) if (wp->w_height > 0) { if (wp == curwin) { - validate_cursor(); // w_wrow needs to be valid + // w_wrow needs to be valid. When setting 'laststatus' this may + // call win_new_height() recursively. + validate_cursor(); + } + if (wp->w_height != prev_height) { + return; // Recursive call already changed the size, bail out. } if (wp->w_wrow != wp->w_prev_fraction_row) { set_fraction(wp); |