diff options
37 files changed, 684 insertions, 312 deletions
diff --git a/.gitignore b/.gitignore index 70899dfa8d..ed452c03a9 100644 --- a/.gitignore +++ b/.gitignore @@ -67,3 +67,5 @@ local.mk /runtime/doc/doctags /runtime/doc/errors.log +# clint errors, generated by `make lint` +errors.json diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index 38d53249d1..ffba29efc7 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -759,7 +759,7 @@ OptionSet After setting an option. The pattern is Note: It's a bad idea, to reset an option during this autocommand, since this will probably break plugins. You can always use - |noa| to prevent triggering this autocommand. + |:noa| to prevent triggering this autocommand. Could be used, to check for existence of the 'backupdir' and 'undodir' options and create directories, if they don't exist yet. diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt index d85d41a295..ddf5b110cd 100644 --- a/runtime/doc/cmdline.txt +++ b/runtime/doc/cmdline.txt @@ -482,6 +482,8 @@ followed by another Vim command: :argdo :autocmd :bufdo + :cdo + :cfdo :command :cscope :debug @@ -492,6 +494,8 @@ followed by another Vim command: :help :helpfind :lcscope + :ldo + :lfdo :make :normal :promptfind diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt index ffa3f1d673..4fdc963f9c 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -795,7 +795,8 @@ USING THE ARGUMENT LIST autocommand event is disabled by adding it to 'eventignore'. This considerably speeds up editing each file. - Also see |:windo|, |:tabdo| and |:bufdo|. + Also see |:windo|, |:tabdo|, |:bufdo|, |:cdo|, |:ldo|, + |:cfdo| and |:lfdo|. Example: > :args *.c @@ -1144,7 +1145,7 @@ If you want to always use ":confirm", set the 'confirm' option. |:diffsplit|, |:diffpatch|, |:pedit|, |:redir|, |:source|, |:update|, |:visual|, |:vsplit|, and |:qall| if 'confirm' is set. - {only in Win32, Athena, Motif, GTK and Mac GUI} + {only in Win32, Motif, GTK and Mac GUI} When ":browse" is not possible you get an error message. If the |+browse| feature is missing or the {command} doesn't support browsing, the {command} is diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 8e40186a15..8864909e71 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -3232,7 +3232,7 @@ foreground() Move the Vim window to the foreground. Useful when sent from On Win32 systems this might not work, the OS does not always allow a window to bring itself to the foreground. Use |remote_foreground()| instead. - {only in the Win32, Athena, Motif and GTK GUI versions and the + {only in the Win32, Motif and GTK GUI versions and the Win32 console version} @@ -5161,7 +5161,7 @@ remote_foreground({server}) *remote_foreground()* Note: This does not restore the window if it was minimized, like foreground() does. This function is not available in the |sandbox|. - {only in the Win32, Athena, Motif and GTK GUI versions and the + {only in the Win32, Motif and GTK GUI versions and the Win32 console version} @@ -6945,7 +6945,6 @@ folding Compiled with |folding| support. footer Compiled with GUI footer support. |gui-footer| gettext Compiled with message translation |multi-lang| gui Compiled with GUI enabled. -gui_athena Compiled with Athena GUI. gui_gnome Compiled with Gnome support (gui_gtk is also defined). gui_gtk Compiled with GTK+ GUI (any version). gui_gtk2 Compiled with GTK+ 2 GUI (gui_gtk is also defined). @@ -6953,7 +6952,6 @@ gui_mac Compiled with Macintosh GUI. gui_motif Compiled with Motif GUI. gui_running Vim is running in the GUI, or it will start soon. gui_win32 Compiled with MS Windows Win32 GUI. -gui_win32s idem, and Win32s system being used (Windows 3.1) iconv Can use iconv() for conversion. insert_expand Compiled with support for CTRL-X expansion commands in Insert mode. diff --git a/runtime/doc/gui.txt b/runtime/doc/gui.txt index c74c31d1fa..1b0db53d6d 100644 --- a/runtime/doc/gui.txt +++ b/runtime/doc/gui.txt @@ -208,18 +208,6 @@ takes too much time or you don't like the cursor jumping to another line, include the 'h' flag in 'guioptions'. Then the scrolling is limited by the text of the current cursor line. - *athena-intellimouse* -If you have an Intellimouse and an X server that supports using the wheel, -then you can use the wheel to scroll the text up and down in gvim. This works -with XFree86 4.0 and later, and with some older versions when you add patches. -See |scroll-mouse-wheel|. - -For older versions of XFree86 you must patch your X server. The following -page has a bit of information about using the Intellimouse on Linux as well as -links to the patches and X server binaries (may not have the one you need -though): - http://www.inria.fr/koala/colas/mouse-wheel-scroll/ - ============================================================================== 3. Mouse Control *gui-mouse* diff --git a/runtime/doc/gui_w32.txt b/runtime/doc/gui_w32.txt index eef0aaefb6..6b022782d2 100644 --- a/runtime/doc/gui_w32.txt +++ b/runtime/doc/gui_w32.txt @@ -47,10 +47,6 @@ If you want Vim to start with a maximized window, add this command to your vimrc or gvimrc file: > au GUIEnter * simalt ~x < - *gui-w32s* -There is a specific version of gvim.exe that runs under the Win32s subsystem -of Windows 3.1 or 3.11. See |win32s|. - ============================================================================== 2. Vim as default editor *vim-default-editor* @@ -281,10 +277,6 @@ syntax on W95 & NT: > :!start [/min] {command} The optional "/min" causes the window to be minimized. -On Win32s, you will have to go to another window instead. Don't forget that -you must tell Windows 3.1x to keep executing a DOS command in the background -while you switch back to Vim. - ============================================================================== 5. Special colors *win32-colors* @@ -293,7 +285,7 @@ On Win32, the normal DOS colors can be used. See |dos-colors|. Additionally the system configured colors can also be used. These are known by the names Sys_XXX, where XXX is the appropriate system color name, from the following list (see the Win32 documentation for full descriptions). Case is -ignored. Note: On Win32s not all of these colors are supported. +ignored. Sys_3DDKShadow Sys_3DFace Sys_BTNFace Sys_3DHilight Sys_3DHighlight Sys_BTNHilight diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt index 75c986efcd..c98f43f324 100644 --- a/runtime/doc/index.txt +++ b/runtime/doc/index.txt @@ -1128,6 +1128,8 @@ tag command action ~ |:cc| :cc go to specific error |:cclose| :ccl[ose] close quickfix window |:cd| :cd change directory +|:cdo| :cdo execute command in each valid error list entry +|:cfdo| :cfdo execute command in each file in error list |:center| :ce[nter] format lines at the center |:cexpr| :cex[pr] read errors from expr and jump to first |:cfile| :cf[ile] read file with error messages and jump to first @@ -1285,6 +1287,8 @@ tag command action ~ |:lchdir| :lch[dir] change directory locally |:lclose| :lcl[ose] close location window |:lcscope| :lcs[cope] like ":cscope" but uses location list +|:ldo| :ld[o] execute command in valid location list entries +|:lfdo| :lfd[o] execute command in each file in location list |:left| :le[ft] left align lines |:leftabove| :lefta[bove] make split window appear left or above |:let| :let assign a value to a variable or option diff --git a/runtime/doc/mbyte.txt b/runtime/doc/mbyte.txt index 2e3a0141ac..a084cd72d2 100644 --- a/runtime/doc/mbyte.txt +++ b/runtime/doc/mbyte.txt @@ -43,16 +43,6 @@ features. Unfortunately, every system has its own way to deal with multibyte languages and it is quite complicated. -COMPILING - -If you already have a compiled Vim program, check if the |+multi_byte| feature -is included. The |:version| command can be used for this. - -If +multi_byte is not included, you should compile Vim with "normal", "big" or -"huge" features. You can further tune what features are included. See the -INSTALL files in the source directory. - - LOCALE First of all, you must make sure your current locale is set correctly. If @@ -629,52 +619,6 @@ If you use a wrong "font" argument you will get an error message. Also make sure that you set 'guifontset' before setting fonts for highlight groups. - -USING RESOURCE FILES - -Instead of specifying 'guifontset', you can set X11 resources and Vim will -pick them up. This is only for people who know how X resource files work. - -For Motif and Athena insert these three lines in your $HOME/.Xdefaults file: - - Vim.font: |base_font_name_list| - Vim*fontSet: |base_font_name_list| - Vim*fontList: your_language_font - -Note: Vim.font is for text area. - Vim*fontSet is for menu. - Vim*fontList is for menu (for Motif GUI) - -For example, when you are using Japanese and a 14 dots font, > - - Vim.font: -misc-fixed-medium-r-normal--14-* - Vim*fontSet: -misc-fixed-medium-r-normal--14-* - Vim*fontList: -misc-fixed-medium-r-normal--14-* -< -or: > - - Vim*font: k14,r14 - Vim*fontSet: k14,r14 - Vim*fontList: k14,r14 -< -To have them take effect immediately you will have to do > - - xrdb -merge ~/.Xdefaults - -Otherwise you will have to stop and restart the X server before the changes -take effect. - - -The GTK+ version of GUI Vim does not use .Xdefaults, use ~/.gtkrc instead. -The default mostly works OK. But for the menus you might have to change -it. Example: > - - style "default" - { - fontset="-*-*-medium-r-normal--14-*-*-*-c-*-*-*" - } - widget_class "*" style "default" - ============================================================================== 6. Fonts on MS-Windows *mbyte-fonts-MSwin* @@ -1201,7 +1145,7 @@ internally. Vim has comprehensive UTF-8 support. It works well in: - xterm with utf-8 support enabled -- Athena, Motif and GTK GUI +- Motif and GTK GUI - MS-Windows GUI - several other platforms diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 229e020daf..610a1964f9 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -635,9 +635,9 @@ A jump table for the options with a short description can be found at |Q_op|. (or Vim is run inside an xterm invoked with "-cjkwidth" option.), this option should be set to "double" to match the width perceived by Vim with the width of glyphs in the font. Perhaps it also has - to be set to "double" under CJK Windows 9x/ME or Windows 2k/XP - when the system locale is set to one of CJK locales. See Unicode - Standard Annex #11 (http://www.unicode.org/reports/tr11). + to be set to "double" under CJK Windows XP when the system locale is + set to one of CJK locales. + See Unicode Standard Annex #11 (http://www.unicode.org/reports/tr11). Vim may set this option automatically at startup time when Vim is compiled with the |+termresponse| feature and if |t_u7| is set to the @@ -1110,8 +1110,7 @@ A jump table for the options with a short description can be found at |Q_op|. *'browsedir'* *'bsdir'* 'browsedir' 'bsdir' string (default: "last") global - {only for Motif, Athena, GTK, Mac and - Win32 GUI} + {only for Motif, GTK, Mac and Win32 GUI} Which directory to use for the file browser: last Use same directory as with last file browser, where a file was opened or saved. @@ -3102,7 +3101,7 @@ A jump table for the options with a short description can be found at |Q_op|. *'guioptions'* *'go'* 'guioptions' 'go' string (default "egmrLT" (MS-Windows), - "aegimrLT" (GTK, Motif and Athena)) + "aegimrLT" (GTK and Motif)) global {only available when compiled with GUI enabled} This option only has an effect in the GUI version of Vim. It is a @@ -3163,10 +3162,9 @@ A jump table for the options with a short description can be found at |Q_op|. *'go-g'* 'g' Grey menu items: Make menu items that are not active grey. If 'g' is not included inactive menu items are not shown at all. - Exception: Athena will always use grey menu items. *'go-T'* - 'T' Include Toolbar. Currently only in Win32, GTK+, Motif, - and Athena GUIs. + 'T' Include Toolbar. Currently only in Win32, GTK+, and + Motif GUIs. *'go-r'* 'r' Right-hand scrollbar is always present. *'go-R'* @@ -3541,8 +3539,6 @@ A jump table for the options with a short description can be found at |Q_op|. |i_CTRL-^|. The value is set to 1 when setting 'keymap' to a valid keymap name. It is also used for the argument of commands like "r" and "f". - The value 0 may not work correctly with Athena and Motif with some XIM - methods. Use 'imdisable' to disable XIM then. *'imsearch'* *'ims'* 'imsearch' 'ims' number (default 0, 2 when an input method is supported) @@ -3558,8 +3554,6 @@ A jump table for the options with a short description can be found at |Q_op|. |c_CTRL-^|. The value is set to 1 when it is not -1 and setting the 'keymap' option to a valid keymap name. - The value 0 may not work correctly with Athena and Motif with some XIM - methods. Use 'imdisable' to disable XIM then. *'imstatusfunc'* *'imsf'* 'imstatusfunc' 'imsf' string (default "") diff --git a/runtime/doc/os_dos.txt b/runtime/doc/os_dos.txt index 1c80f4d7a5..1601d65ffd 100644 --- a/runtime/doc/os_dos.txt +++ b/runtime/doc/os_dos.txt @@ -52,12 +52,9 @@ Will find "c:\user\piet\_vimrc" and the runtime files in "e:\vim\vim54". See |$VIM| and |$VIMRUNTIME| for more information. -Under Windows 95, you can set $VIM in your C:\autoexec.bat file. For -example: > - set VIM=D:\vim -Under Windows NT, you can set environment variables for each user separately -under "Start/Settings/Control Panel->System", or through the properties in the -menu of "My Computer", under the Environment Tab. +You can set environment variables for each user separately under +"Start/Settings/Control Panel->System", or through the properties in the menu +of "My Computer", under the Environment Tab. ============================================================================== 2. Using backslashes *dos-backslash* @@ -246,16 +243,6 @@ the CTRL-C until it tries to read a key. ============================================================================== 8. Temp files *dos-temp-files* -Only for the 16 bit and 32 bit DOS version: -Vim puts temporary files (for filtering) in the first of these directories -that exists and in which Vim can create a file: - $TMP - $TEMP - C:\TMP - C:\TEMP - current directory - -For the Win32 version (both console and GUI): Vim uses standard Windows functions to obtain a temporary file name (for filtering). The first of these directories that exists and in which Vim can create a file is used: @@ -266,10 +253,10 @@ create a file is used: ============================================================================== 9. Shell option default *dos-shell* -The default for the 'sh' ('shell') option is "command.com" on Windows 95 and -"cmd.exe" on Windows NT. If SHELL is defined, Vim uses SHELL instead, and if -SHELL is not defined but COMSPEC is, Vim uses COMSPEC. Vim starts external -commands with "<shell> /c <command_name>". Typing CTRL-Z starts a new command +The default for the 'sh' ('shell') option is "cmd.exe" on Windows. +If SHELL is defined, Vim uses SHELL instead, and if SHELL is not defined +but COMSPEC is, Vim uses COMSPEC. Vim starts external commands with +"<shell> /c <command_name>". Typing CTRL-Z starts a new command subshell. Return to Vim with "exit". |'shell'| |CTRL-Z| If you are running a third-party shell, you may need to set the diff --git a/runtime/doc/os_win32.txt b/runtime/doc/os_win32.txt index 603dbcddce..57a6ad9f3a 100644 --- a/runtime/doc/os_win32.txt +++ b/runtime/doc/os_win32.txt @@ -7,7 +7,7 @@ *win32* *Win32* *MS-Windows* This file documents the idiosyncrasies of the Win32 version of Vim. -The Win32 version of Vim works on Windows NT, XP, Vista and Windows 7. +The Win32 version of Vim works on Windows XP, Vista and Windows 7. There are both console and GUI versions. The 32 bit version also runs on 64 bit MS-Windows systems. @@ -16,8 +16,7 @@ The 32 bit version also runs on 64 bit MS-Windows systems. 2. Startup |win32-startup| 3. Restore screen contents |win32-restore| 4. Using the mouse |win32-mouse| -5. Running under Windows 3.1 |win32-win3.1| -6. Win32 mini FAQ |win32-faq| +5. Win32 mini FAQ |win32-faq| Additionally, there are a number of common Win32 and DOS items: File locations |dos-locations| @@ -34,7 +33,6 @@ Win32 GUI |gui-w32| Credits: The Win32 version was written by George V. Reilly <george@reilly.org>. -The original Windows NT port was done by Roger Knobbe <RogerK@wonderware.com>. The GUI version was made by George V. Reilly and Robert Webb. ============================================================================== @@ -98,35 +96,7 @@ When the mouse doesn't work, try disabling the "Quick Edit Mode" feature of the console. ============================================================================== -5. Running under Windows 3.1 *win32-win3.1* - - *win32s* *windows-3.1* -There is a special version of Gvim that runs under Windows 3.1 and 3.11. You -need the gvim.exe that was compiled with Visual C++ 4.1. - -To run the Win32 version under Windows 3.1, you need to install Win32s. You -might have it already from another Win32 application which you have installed. -If Vim doesn't seem to be running properly, get the latest version: 1.30c. -You can find it at: - - http://support.microsoft.com/download/support/mslfiles/pw1118.exe - -(Microsoft moved it again, we don't know where it is now :-( ). - -The reason for having two versions of gvim.exe is that the Win32s version was -compiled with VC++ 4.1. This is the last version of VC++ that supports Win32s -programs. VC++ 5.0 is better, so that one was used for the Win32 version. -Apart from that, there is no difference between the programs. If you are in a -mixed environment, you can use the gvim.exe for Win32s on both. - -The Win32s version works the same way as the Win32 version under 95/NT. When -running under Win32s the following differences apply: -- You cannot use long file names, because Windows 3.1 doesn't support them! -- When executing an external command, it doesn't return an exit code. After - doing ":make" you have to do ":cn" yourself. - -============================================================================== -6. Win32 mini FAQ *win32-faq* +5. Win32 mini FAQ *win32-faq* Q. How do I change the font? A. In the GUI version, you can use the 'guifont' option. Example: > @@ -134,14 +104,6 @@ A. In the GUI version, you can use the 'guifont' option. Example: > < In the console version, you need to set the font of the console itself. You cannot do this from within Vim. -Q. How do I type dead keys on Windows NT? -A. Dead keys work on NT 3.51. Just type them as you would in any other - application. - On NT 4.0, you need to make sure that the default locale (set in the - Keyboard part of the Control Panel) is the same as the currently active - locale. Otherwise the NT code will get confused and crash! This is a NT - 4.0 problem, not really a Vim problem. - Q. I'm using Vim to edit a symbolically linked file on a Unix NFS file server. When I write the file, Vim does not "write through" the symlink. Instead, it deletes the symbolic link and creates a new file in its place. Why? @@ -176,28 +138,6 @@ A. Basically what you need is to put a tee program that will copy its input :set shellpipe=\|\ tee < to your _vimrc. -Q. I'm storing files on a remote machine that works with VisionFS, and files - disappear! -A. VisionFS can't handle certain dot (.) three letter extension file names. - SCO declares this behavior required for backwards compatibility with 16bit - DOS/Windows environments. The two commands below demonstrate the behavior: -> - echo Hello > file.bat~ - dir > file.bat -< - The result is that the "dir" command updates the "file.bat~" file, instead - of creating a new "file.bat" file. This same behavior is exhibited in Vim - when editing an existing file named "foo.bat" because the default behavior - of Vim is to create a temporary file with a '~' character appended to the - name. When the file is written, it winds up being deleted. - - Solution: Add this command to your _vimrc file: > - :set backupext=.temporary - -Q. How do I change the blink rate of the cursor? -A. You can't! This is a limitation of the NT console. NT 5.0 is reported to - be able to set the blink rate for all console windows at the same time. - *:!start* Q. How can I run an external command or program asynchronously? A. When using :! to run an external command, you can run it with "start": > @@ -240,28 +180,6 @@ A. You have two possible solutions depending on what you want: < The first command runs notepad minimized and the second one runs it normally. -Q. I'm using Win32s, and when I try to run an external command like "make", - Vim doesn't wait for it to finish! Help! -A. The problem is that a 32-bit application (Vim) can't get notification from - Windows that a 16-bit application (your DOS session) has finished. Vim - includes a work-around for this, but you must set up your DOS commands to - run in a window, not full-screen. Unfortunately the default when you - install Windows is full-screen. To change this: - 1) Start PIF editor (in the Main program group). - 2) Open the file "_DEFAULT.PIF" in your Windows directory. - 3) Changes the display option from "Full Screen" to "Windowed". - 4) Save and exit. - - To test, start Vim and type > - :!dir C:\<CR>". -< You should see a DOS box window appear briefly with the directory listing. - -Q. I use Vim under Win32s and NT. In NT, I can define the console to default to - 50 lines, so that I get a 80x50 shell when I ':sh'. Can I do the same in - W3.1x, or am I stuck with 80x25? -A. Edit SYSTEM.INI and add 'ScreenLines=50' to the [NonWindowsApp] section. DOS - prompts and external DOS commands will now run in a 50-line window. - *windows-icon* Q. I don't like the Vim icon, can I change it? A. Yes, place your favorite icon in bitmaps/vim.ico in a directory of diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt index 8c428e44ef..399933b512 100644 --- a/runtime/doc/quickfix.txt +++ b/runtime/doc/quickfix.txt @@ -291,6 +291,100 @@ use this code: > au QuickfixCmdPost make call QfMakeConv() +EXECUTE A COMMAND IN ALL THE BUFFERS IN QUICKFIX OR LOCATION LIST: + *:cdo* +:cdo[!] {cmd} Execute {cmd} in each valid entry in the quickfix list. + It works like doing this: > + :cfirst + :{cmd} + :cnext + :{cmd} + etc. +< When the current file can't be |abandon|ed and the [!] + is not present, the command fails. + When an error is detected on one buffer, further + buffers will not be visited. + The last buffer (or where an error occurred) becomes + the current buffer. + {cmd} can contain '|' to concatenate several commands. + Only valid entries in the quickfix list are used. + Note: While this command is executing, the Syntax + autocommand event is disabled by adding it to + 'eventignore'. This considerably speeds up editing + each buffer. + Also see |:bufdo|, |:tabdo|, |:argdo|, |:windo|, + |:ldo|, |:cfdo| and |:lfdo|. + + *:cfdo* +:cfdo[!] {cmd} Execute {cmd} in each file in the quickfix list. + It works like doing this: > + :cfirst + :{cmd} + :cnfile + :{cmd} + etc. +< When the current file can't be |abandon|ed and the [!] + is not present, the command fails. + When an error is detected on one buffer, further + buffers will not be visited. + The last buffer (or where an error occurred) becomes + the current buffer. + {cmd} can contain '|' to concatenate several commands. + Only valid entries in the quickfix list are used. + Note: While this command is executing, the Syntax + autocommand event is disabled by adding it to + 'eventignore'. This considerably speeds up editing + each buffer. + Also see |:bufdo|, |:tabdo|, |:argdo|, |:windo|, + |:cdo|, |:ldo| and |:lfdo|. + + *:ldo* +:ld[o][!] {cmd} Execute {cmd} in each valid entry in the location list + for the current window. + It works like doing this: > + :lfirst + :{cmd} + :lnext + :{cmd} + etc. +< When the current file can't be |abandon|ed and the [!] + is not present, the command fails. + When an error is detected on one buffer, further + buffers will not be visited. + The last buffer (or where an error occurred) becomes + the current buffer. + {cmd} can contain '|' to concatenate several commands. + Only valid entries in the location list are used. + Note: While this command is executing, the Syntax + autocommand event is disabled by adding it to + 'eventignore'. This considerably speeds up editing + each buffer. + Also see |:bufdo|, |:tabdo|, |:argdo|, |:windo|, + |:cdo|, |:cfdo| and |:lfdo|. + + *:lfdo* +:lfdo[!] {cmd} Execute {cmd} in each file in the location list for + the current window. + It works like doing this: > + :lfirst + :{cmd} + :lnfile + :{cmd} + etc. +< When the current file can't be |abandon|ed and the [!] + is not present, the command fails. + When an error is detected on one buffer, further + buffers will not be visited. + The last buffer (or where an error occurred) becomes + the current buffer. + {cmd} can contain '|' to concatenate several commands. + Only valid entries in the location list are used. + Note: While this command is executing, the Syntax + autocommand event is disabled by adding it to + 'eventignore'. This considerably speeds up editing + each buffer. + Also see |:bufdo|, |:tabdo|, |:argdo|, |:windo|, + |:cdo|, |:ldo| and |:cfdo|. ============================================================================= 2. The error window *quickfix-window* diff --git a/runtime/doc/rileft.txt b/runtime/doc/rileft.txt index b4d9347470..e4e495bb18 100644 --- a/runtime/doc/rileft.txt +++ b/runtime/doc/rileft.txt @@ -106,9 +106,6 @@ o Does not support reverse insert and rightleft modes on the command-line. o Somewhat slower in right-to-left mode, because right-to-left motion is emulated inside Vim, not by the controlling terminal. -o When the Athena GUI is used, the bottom scrollbar works in the wrong - direction. This is difficult to fix. - o When both 'rightleft' and 'revins' are on: 'textwidth' does not work. Lines do not wrap at all; you just get a single, long line. diff --git a/runtime/doc/scroll.txt b/runtime/doc/scroll.txt index 8626a1a7f6..0b3d45e969 100644 --- a/runtime/doc/scroll.txt +++ b/runtime/doc/scroll.txt @@ -245,7 +245,7 @@ dragging the scrollbar of the current window. How many lines are scrolled depends on your mouse driver. If the scroll action causes input focus problems, see |intellimouse-wheel-problems|. -For the X11 GUIs (Motif, Athena and GTK) scrolling the wheel generates key +For the X11 GUIs (Motif and GTK) scrolling the wheel generates key presses <ScrollWheelUp>, <ScrollWheelDown>, <ScrollWheelLeft> and <ScrollWheelRight>. For example, if you push the scroll wheel upwards a <ScrollWheelUp> key press is generated causing the window to scroll upwards diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 33547b2012..9d510f4be1 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -4678,7 +4678,7 @@ font={font-name} *highlight-font* When setting the font for the "Normal" group, this becomes the default font (until the 'guifont' option is changed; the last one set is used). - The following only works with Motif and Athena, not with other GUIs: + The following only works with Motif not with other GUIs: When setting the font for the "Menu" group, the menus will be changed. When setting the font for the "Tooltip" group, the tooltips will be changed. @@ -4866,11 +4866,6 @@ Menu Current font, background and foreground colors of the menus. Also used for the toolbar. Applicable highlight arguments: font, guibg, guifg. - NOTE: For Motif and Athena the font argument actually - specifies a fontset at all times, no matter if 'guifontset' is - empty, and as such it is tied to the current |:language| when - set. - *hl-Scrollbar* Scrollbar Current background and foreground of the main window's scrollbars. @@ -4880,11 +4875,6 @@ Scrollbar Current background and foreground of the main window's Tooltip Current font, background and foreground of the tooltips. Applicable highlight arguments: font, guibg, guifg. - NOTE: For Motif and Athena the font argument actually - specifies a fontset at all times, no matter if 'guifontset' is - empty, and as such it is tied to the current |:language| when - set. - ============================================================================== 13. Linking groups *:hi-link* *:highlight-link* *E412* *E413* diff --git a/runtime/doc/tabpage.txt b/runtime/doc/tabpage.txt index 44e770dc12..84eceee34f 100644 --- a/runtime/doc/tabpage.txt +++ b/runtime/doc/tabpage.txt @@ -234,7 +234,8 @@ LOOPING OVER TAB PAGES: current tab page. {cmd} can contain '|' to concatenate several commands. {cmd} must not open or close tab pages or reorder them. - Also see |:windo|, |:argdo| and |:bufdo|. + Also see |:windo|, |:argdo|, |:bufdo|, |:cdo|, |:ldo|, |:cfdo| + and |:lfdo|. ============================================================================== 3. Other items *tab-page-other* diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt index 117e977e0d..d810e1ab37 100644 --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -333,8 +333,6 @@ N *+find_in_path* include file searches: |[I|, |:isearch|, N *+folding* |folding| *+footer* |gui-footer| N *+gettext* message translations |multi-lang| - *+GUI_Athena* Unix only: Athena |GUI| - *+GUI_neXtaw* Unix only: neXtaw |GUI| *+GUI_GTK* Unix only: GTK+ |GUI| *+GUI_Motif* Unix only: Motif |GUI| *+iconv* Compiled with the |iconv()| function diff --git a/runtime/doc/vi_diff.txt b/runtime/doc/vi_diff.txt index 7b61dbe6d7..9d3a2f5118 100644 --- a/runtime/doc/vi_diff.txt +++ b/runtime/doc/vi_diff.txt @@ -57,15 +57,9 @@ argument when starting Vim. Support for different systems. Vim can be used on: - - All Unix systems (it works on all systems it was tested on, although - the GUI and Perl interface may not work everywhere). - - MS-DOS in real-mode (no additional drivers required). - - In protected mode on Windows 3.1 and MS-DOS (DPMI driver required). - - Windows 95 and Windows NT, with support for long file names. - - Macintosh - Note that on some systems features need to be disabled to reduce - resource usage, esp. on MS-DOS. For some outdated systems you need to - use an older Vim version. + - Modern Unix systems (*BSD, Linux, etc.) + - Windows (XP SP 2 or greater) + - OS X Multi level undo. |undo| 'u' goes backward in time, 'CTRL-R' goes forward again. Set option @@ -83,7 +77,7 @@ Graphical User Interface (GUI). |gui| Included support for GUI: menu's, mouse, scrollbars, etc. You can define your own menus. Better support for CTRL/SHIFT/ALT keys in combination with special keys and mouse. Supported for various - platforms, such as X11 (with Motif and Athena interfaces), GTK, Win32 + platforms, such as X11 (with a Motif interface), GTK, Win32 (Windows 95 and later), and Macintosh. Multiple windows and buffers. |windows.txt| @@ -347,9 +341,8 @@ Printing. |printing| Mouse support. |mouse-using| The mouse is supported in the GUI version, in an xterm for Unix, for - BSDs with sysmouse, for Linux with gpm, for MS-DOS, and Win32. It - can be used to position the cursor, select the visual area, paste a - register, etc. + BSDs with sysmouse, for Linux with gpm, and for Win32. It can be used + to position the cursor, select the visual area, paste a register, etc. Usage of key names. |<>| |key-notation| Special keys now all have a name like <Up>, <End>, etc. diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt index 1b902c908c..56f57c21c5 100644 --- a/runtime/doc/windows.txt +++ b/runtime/doc/windows.txt @@ -702,7 +702,8 @@ can also get to them with the buffer list commands, like ":bnext". the current window. {cmd} can contain '|' to concatenate several commands. {cmd} must not open or close windows or reorder them. - Also see |:tabdo|, |:argdo| and |:bufdo|. + Also see |:tabdo|, |:argdo|, |:bufdo|, |:cdo|, |:ldo|, + |:cfdo| and |:lfdo|. *:bufdo* :[range]bufdo[!] {cmd} Execute {cmd} in each buffer in the buffer list or if @@ -728,7 +729,8 @@ can also get to them with the buffer list commands, like ":bnext". autocommand event is disabled by adding it to 'eventignore'. This considerably speeds up editing each buffer. - Also see |:tabdo|, |:argdo| and |:windo|. + Also see |:tabdo|, |:argdo|, |:windo|, |:cdo|, |:ldo|, + |:cfdo| and |:lfdo|. Examples: > diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index d902234ef7..29cff5a2b2 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -1989,7 +1989,7 @@ do_ecmd ( char_u *free_fname = NULL; int retval = FAIL; long n; - linenr_T lnum; + pos_T orig_pos; linenr_T topline = 0; int newcol = -1; int solcol = -1; @@ -2351,7 +2351,7 @@ do_ecmd ( * Careful: open_buffer() and apply_autocmds() may change the current * buffer and window. */ - lnum = curwin->w_cursor.lnum; + orig_pos = curwin->w_cursor; topline = curwin->w_topline; if (!oldbuf) { /* need to read the file */ swap_exists_action = SEA_DIALOG; @@ -2379,11 +2379,9 @@ do_ecmd ( } check_arg_idx(curwin); - /* - * If autocommands change the cursor position or topline, we should - * keep it. - */ - if (curwin->w_cursor.lnum != lnum) { + // If autocommands change the cursor position or topline, we should keep + // it. Also when it moves within a line. + if (!equalpos(curwin->w_cursor, orig_pos)) { newlnum = curwin->w_cursor.lnum; newcol = curwin->w_cursor.col; } diff --git a/src/nvim/ex_cmds.lua b/src/nvim/ex_cmds.lua index b7a3505c99..702abf3cf0 100644 --- a/src/nvim/ex_cmds.lua +++ b/src/nvim/ex_cmds.lua @@ -34,6 +34,7 @@ local ADDR_ARGUMENTS = 2 local ADDR_LOADED_BUFFERS = 3 local ADDR_BUFFERS = 4 local ADDR_TABS = 5 +local ADDR_QUICKFIX = 6 -- The following table is described in ex_cmds_defs.h file. return { @@ -374,6 +375,12 @@ return { func='ex_cd', }, { + command='cdo', + flags=bit.bor(BANG, NEEDARG, EXTRA, NOTRLCOM, RANGE, NOTADR, DFLALL), + addr_type=ADDR_QUICKFIX, + func='ex_listdo', + }, + { command='center', flags=bit.bor(TRLBAR, RANGE, WHOLEFOLD, EXTRA, CMDWIN, MODIFY), addr_type=ADDR_LINES, @@ -391,6 +398,14 @@ return { addr_type=ADDR_LINES, func='ex_cfile', }, + -- Even though 'cfdo' is alphabetically lower than 'cfile', it is after + -- 'cfile' in this cmd list to support the existing ":cf" abbreviation. + { + command='cfdo', + flags=bit.bor(BANG, NEEDARG, EXTRA, NOTRLCOM, RANGE, NOTADR, DFLALL), + addr_type=ADDR_QUICKFIX, + func='ex_listdo', + }, { command='cfirst', flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR, BANG), @@ -1286,6 +1301,12 @@ return { func='do_cscope', }, { + command='ldo', + flags=bit.bor(BANG, NEEDARG, EXTRA, NOTRLCOM, RANGE, NOTADR, DFLALL), + addr_type=ADDR_QUICKFIX, + func='ex_listdo', + }, + { command='left', flags=bit.bor(TRLBAR, RANGE, WHOLEFOLD, EXTRA, CMDWIN, MODIFY), addr_type=ADDR_LINES, @@ -1315,6 +1336,14 @@ return { addr_type=ADDR_LINES, func='ex_cfile', }, + -- Even though 'lfdo' is alphabetically lower than 'lfile', it is after + -- 'lfile' in this cmd list to support the existing ":lf" abbreviation. + { + command='lfdo', + flags=bit.bor(BANG, NEEDARG, EXTRA, NOTRLCOM, RANGE, NOTADR, DFLALL), + addr_type=ADDR_QUICKFIX, + func='ex_listdo', + }, { command='lfirst', flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR, BANG), diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index 87a6283310..57153cf5a1 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -1868,7 +1868,7 @@ void ex_argdelete(exarg_T *eap) } /* - * ":argdo", ":windo", ":bufdo", ":tabdo" + * ":argdo", ":windo", ":bufdo", ":tabdo", ":cdo", ":ldo", ":cfdo" and ":lfdo" */ void ex_listdo(exarg_T *eap) { @@ -1879,7 +1879,6 @@ void ex_listdo(exarg_T *eap) char_u *save_ei = NULL; char_u *p_shm_save; - if (eap->cmdidx != CMD_windo && eap->cmdidx != CMD_tabdo) /* Don't do syntax HL autocommands. Skipping the syntax file is a * great speed improvement. */ @@ -1914,7 +1913,10 @@ void ex_listdo(exarg_T *eap) default: break; } + buf_T *buf = curbuf; + size_t qf_size = 0; + /* set pcmark now */ if (eap->cmdidx == CMD_bufdo) { /* Advance to the first listed buffer after "eap->line1". */ @@ -1929,6 +1931,22 @@ void ex_listdo(exarg_T *eap) if (buf != NULL) { goto_buffer(eap, DOBUF_FIRST, FORWARD, buf->b_fnum); } + } else if (eap->cmdidx == CMD_cdo || eap->cmdidx == CMD_ldo || + eap->cmdidx == CMD_cfdo || eap->cmdidx == CMD_lfdo) { + qf_size = qf_get_size(eap); + assert(eap->line1 >= 0); + if (qf_size == 0 || (size_t)eap->line1 > qf_size) { + buf = NULL; + } else { + ex_cc(eap); + + buf = curbuf; + i = eap->line1 - 1; + if (eap->addr_count <= 0) { + // Default to all quickfix/location list entries. + eap->line2 = qf_size; + } + } } else { setpcmark(); } @@ -2009,9 +2027,27 @@ void ex_listdo(exarg_T *eap) set_option_value((char_u *)"shm", 0L, p_shm_save, 0); xfree(p_shm_save); - /* If autocommands took us elsewhere, quit here */ - if (curbuf->b_fnum != next_fnum) + // If autocommands took us elsewhere, quit here. + if (curbuf->b_fnum != next_fnum) { + break; + } + } + + if (eap->cmdidx == CMD_cdo || eap->cmdidx == CMD_ldo || + eap->cmdidx == CMD_cfdo || eap->cmdidx == CMD_lfdo) { + assert(i >= 0); + if ((size_t)i >= qf_size || i >= eap->line2) { break; + } + + size_t qf_idx = qf_get_cur_idx(eap); + + ex_cnext(eap); + + // If jumping to the next quickfix entry fails, quit here. + if (qf_get_cur_idx(eap) == qf_idx) { + break; + } } if (eap->cmdidx == CMD_windo) { diff --git a/src/nvim/ex_cmds_defs.h b/src/nvim/ex_cmds_defs.h index 10d2eb688e..f46d1e6d47 100644 --- a/src/nvim/ex_cmds_defs.h +++ b/src/nvim/ex_cmds_defs.h @@ -72,6 +72,7 @@ #define ADDR_LOADED_BUFFERS 3 #define ADDR_BUFFERS 4 #define ADDR_TABS 5 +#define ADDR_QUICKFIX 6 typedef struct exarg exarg_T; diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 59bda9345e..fad497928c 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -1531,9 +1531,12 @@ static char_u * do_one_cmd(char_u **cmdlinep, lnum = CURRENT_TAB_NR; ea.line2 = lnum; break; + case ADDR_QUICKFIX: + ea.line2 = qf_get_cur_valid_idx(&ea); + break; } ea.cmd = skipwhite(ea.cmd); - lnum = get_address(&ea.cmd, ea.addr_type, ea.skip, ea.addr_count == 0); + lnum = get_address(&ea, &ea.cmd, ea.addr_type, ea.skip, ea.addr_count == 0); if (ea.cmd == NULL) /* error detected */ goto doend; if (lnum == MAXLNUM) { @@ -1582,6 +1585,13 @@ static char_u * do_one_cmd(char_u **cmdlinep, ea.line2 = ARGCOUNT; } break; + case ADDR_QUICKFIX: + ea.line1 = 1; + ea.line2 = qf_get_size(&ea); + if (ea.line2 == 0) { + ea.line2 = 1; + } + break; } ++ea.addr_count; } @@ -1962,6 +1972,12 @@ static char_u * do_one_cmd(char_u **cmdlinep, ea.line2 = ARGCOUNT; } break; + case ADDR_QUICKFIX: + ea.line2 = qf_get_size(&ea); + if (ea.line2 == 0) { + ea.line2 = 1; + } + break; } } @@ -2945,6 +2961,8 @@ set_one_cmd_context ( case CMD_botright: case CMD_browse: case CMD_bufdo: + case CMD_cdo: + case CMD_cfdo: case CMD_confirm: case CMD_debug: case CMD_folddoclosed: @@ -2954,7 +2972,9 @@ set_one_cmd_context ( case CMD_keepjumps: case CMD_keepmarks: case CMD_keeppatterns: + case CMD_ldo: case CMD_leftabove: + case CMD_lfdo: case CMD_lockmarks: case CMD_noautocmd: case CMD_noswapfile: @@ -3367,7 +3387,8 @@ skip_range ( * * Return MAXLNUM when no Ex address was found. */ -static linenr_T get_address(char_u **ptr, +static linenr_T get_address(exarg_T *eap, + char_u **ptr, int addr_type, // flag: one of ADDR_LINES, ... int skip, // only skip the address, don't use it int to_other_file // flag: may jump to other file @@ -3405,6 +3426,9 @@ static linenr_T get_address(char_u **ptr, case ADDR_TABS: lnum = CURRENT_TAB_NR; break; + case ADDR_QUICKFIX: + lnum = qf_get_cur_valid_idx(eap); + break; } break; @@ -3436,6 +3460,12 @@ static linenr_T get_address(char_u **ptr, case ADDR_TABS: lnum = LAST_TAB_NR; break; + case ADDR_QUICKFIX: + lnum = qf_get_size(eap); + if (lnum == 0) { + lnum = 1; + } + break; } break; @@ -3578,6 +3608,9 @@ static linenr_T get_address(char_u **ptr, case ADDR_TABS: lnum = CURRENT_TAB_NR; break; + case ADDR_QUICKFIX: + lnum = qf_get_cur_valid_idx(eap); + break; } } @@ -3702,6 +3735,12 @@ static char_u *invalid_range(exarg_T *eap) return (char_u *)_(e_invrange); } break; + case ADDR_QUICKFIX: + assert(eap->line2 >= 0); + if (eap->line2 != 1 && (size_t)eap->line2 > qf_get_size(eap)) { + return (char_u *)_(e_invrange); + } + break; } } return NULL; @@ -4589,6 +4628,7 @@ static struct { {ADDR_TABS, "tabs"}, {ADDR_BUFFERS, "buffers"}, {ADDR_WINDOWS, "windows"}, + {ADDR_QUICKFIX, "quickfix"}, {-1, NULL} }; @@ -7013,9 +7053,7 @@ static void ex_put(exarg_T *eap) */ static void ex_copymove(exarg_T *eap) { - long n; - - n = get_address(&eap->arg, eap->addr_type, FALSE, FALSE); + long n = get_address(eap, &eap->arg, eap->addr_type, false, false); if (eap->arg == NULL) { /* error detected */ eap->nextcmd = NULL; return; diff --git a/src/nvim/if_cscope.c b/src/nvim/if_cscope.c index 3585c26ca2..64323896d6 100644 --- a/src/nvim/if_cscope.c +++ b/src/nvim/if_cscope.c @@ -861,17 +861,16 @@ err_closing: csinfo[i].hProc = pi.hProcess; CloseHandle(pi.hThread); - /* TODO - tidy up after failure to create files on pipe handles. */ - if (((fd = _open_osfhandle((OPEN_OH_ARGTYPE)stdin_wr, - _O_TEXT|_O_APPEND)) < 0) - || ((csinfo[i].to_fp = _fdopen(fd, "w")) == NULL)) + // TODO(neovim): tidy up after failure to create files on pipe handles. + if (((fd = _open_osfhandle((intptr_t)stdin_wr, _O_TEXT|_O_APPEND)) < 0) + || ((csinfo[i].to_fp = _fdopen(fd, "w")) == NULL)) { PERROR(_("cs_create_connection: fdopen for to_fp failed")); - if (((fd = _open_osfhandle((OPEN_OH_ARGTYPE)stdout_rd, - _O_TEXT|_O_RDONLY)) < 0) - || ((csinfo[i].fr_fp = _fdopen(fd, "r")) == NULL)) + } + if (((fd = _open_osfhandle((intptr_t)stdout_rd, _O_TEXT|_O_RDONLY)) < 0) + || ((csinfo[i].fr_fp = _fdopen(fd, "r")) == NULL)) { PERROR(_("cs_create_connection: fdopen for fr_fp failed")); - - /* Close handles for file descriptors inherited by the cscope process */ + } + // Close handles for file descriptors inherited by the cscope process. CloseHandle(stdin_rd); CloseHandle(stdout_wr); @@ -1146,22 +1145,6 @@ static void clear_csinfo(size_t i) csinfo[i].to_fp = NULL; } -#ifndef UNIX -static char *GetWin32Error(void) -{ - char *msg = NULL; - FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM, - NULL, GetLastError(), 0, (LPSTR)&msg, 0, NULL); - if (msg != NULL) { - /* remove trailing \r\n */ - char *pcrlf = strstr(msg, "\r\n"); - if (pcrlf != NULL) - *pcrlf = '\0'; - } - return msg; -} -#endif - /* * PRIVATE: cs_insert_filelist * diff --git a/src/nvim/os/win_defs.h b/src/nvim/os/win_defs.h index aad9672ba7..9f9e5e277c 100644 --- a/src/nvim/os/win_defs.h +++ b/src/nvim/os/win_defs.h @@ -3,6 +3,7 @@ #include <windows.h> #include <sys/stat.h> +#include <stdio.h> #define TEMP_DIR_NAMES {"$TMP", "$TEMP", "$USERPROFILE", ""} #define TEMP_FILE_PATH_MAXLEN _MAX_PATH @@ -18,6 +19,12 @@ # ifndef restrict # define restrict __restrict # endif +# ifndef STDOUT_FILENO +# define STDOUT_FILENO _fileno(stdout) +# endif +# ifndef STDERR_FILENO +# define STDERR_FILENO _fileno(stderr) +# endif # ifndef S_IXUSR # define S_IXUSR S_IEXEC # endif diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index 8e6ae46a3b..3abf43cb8c 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -1202,7 +1202,7 @@ static void qf_clean_dir_stack(struct dir_stack_T **stackptr) /* * Check in which directory of the directory stack the given file can be * found. - * Returns a pointer to the directory name or NULL if not found + * Returns a pointer to the directory name or NULL if not found. * Cleans up intermediate directory entries. * * TODO: How to solve the following problem? @@ -2571,9 +2571,159 @@ static char_u *get_mef_name(void) return name; } +/// Returns the number of valid entries in the current quickfix/location list. +size_t qf_get_size(exarg_T *eap) + FUNC_ATTR_NONNULL_ALL +{ + qf_info_T *qi = &ql_info; + if (eap->cmdidx == CMD_ldo || eap->cmdidx == CMD_lfdo) { + // Location list. + qi = GET_LOC_LIST(curwin); + if (qi == NULL) { + return 0; + } + } + + int prev_fnum = 0; + size_t sz = 0; + qfline_T *qfp; + size_t i; + assert(qi->qf_lists[qi->qf_curlist].qf_count >= 0); + for (i = 0, qfp = qi->qf_lists[qi->qf_curlist].qf_start; + i < (size_t)qi->qf_lists[qi->qf_curlist].qf_count && qfp != NULL; + i++, qfp = qfp->qf_next) { + if (!qfp->qf_valid) { + continue; + } + + if (eap->cmdidx == CMD_cdo || eap->cmdidx == CMD_ldo) { + // Count all valid entries. + sz++; + } else if (qfp->qf_fnum > 0 && qfp->qf_fnum != prev_fnum) { + // Count the number of files. + sz++; + prev_fnum = qfp->qf_fnum; + } + } + + return sz; +} + +/// Returns the current index of the quickfix/location list. +/// Returns 0 if there is an error. +size_t qf_get_cur_idx(exarg_T *eap) + FUNC_ATTR_NONNULL_ALL +{ + qf_info_T *qi = &ql_info; + + if (eap->cmdidx == CMD_ldo || eap->cmdidx == CMD_lfdo) { + // Location list. + qi = GET_LOC_LIST(curwin); + if (qi == NULL) { + return 0; + } + } + + assert(qi->qf_lists[qi->qf_curlist].qf_index >= 0); + return (size_t)qi->qf_lists[qi->qf_curlist].qf_index; +} + +/// Returns the current index in the quickfix/location list, +/// counting only valid entries. +/// Returns 1 if there are no valid entries. +int qf_get_cur_valid_idx(exarg_T *eap) + FUNC_ATTR_NONNULL_ALL +{ + qf_info_T *qi = &ql_info; + + if (eap->cmdidx == CMD_ldo || eap->cmdidx == CMD_lfdo) { + // Location list. + qi = GET_LOC_LIST(curwin); + if (qi == NULL) { + return 1; + } + } + + qf_list_T *qfl = &qi->qf_lists[qi->qf_curlist]; + + // Check if the list has valid errors. + if (qfl->qf_count <= 0 || qfl->qf_nonevalid) { + return 1; + } + + int prev_fnum = 0; + int eidx = 0; + qfline_T *qfp; + size_t i; + assert(qfl->qf_index >= 0); + for (i = 1, qfp = qfl->qf_start; + i <= (size_t)qfl->qf_index && qfp != NULL; + i++, qfp = qfp->qf_next) { + if (!qfp->qf_valid) { + continue; + } + + if (eap->cmdidx == CMD_cfdo || eap->cmdidx == CMD_lfdo) { + if (qfp->qf_fnum > 0 && qfp->qf_fnum != prev_fnum) { + // Count the number of files. + eidx++; + prev_fnum = qfp->qf_fnum; + } + } else { + eidx++; + } + } + + return eidx != 0 ? eidx : 1; +} + +/// Get the 'n'th valid error entry in the quickfix or location list. +/// +/// Used by :cdo, :ldo, :cfdo and :lfdo commands. +/// For :cdo and :ldo, returns the 'n'th valid error entry. +/// For :cfdo and :lfdo, returns the 'n'th valid file entry. +static size_t qf_get_nth_valid_entry(qf_info_T *qi, size_t n, bool fdo) + FUNC_ATTR_NONNULL_ALL +{ + qf_list_T *qfl = &qi->qf_lists[qi->qf_curlist]; + + // Check if the list has valid errors. + if (qfl->qf_count <= 0 || qfl->qf_nonevalid) { + return 1; + } + + int prev_fnum = 0; + size_t eidx = 0; + size_t i; + qfline_T *qfp; + assert(qfl->qf_count >= 0); + for (i = 1, qfp = qfl->qf_start; + i <= (size_t)qfl->qf_count && qfp != NULL; + i++, qfp = qfp->qf_next) { + if (qfp->qf_valid) { + if (fdo) { + if (qfp->qf_fnum > 0 && qfp->qf_fnum != prev_fnum) { + // Count the number of files. + eidx++; + prev_fnum = qfp->qf_fnum; + } + } else { + eidx++; + } + } + + if (eidx == n) { + break; + } + } + + return i <= (size_t)qfl->qf_count ? i : 1; +} + /* * ":cc", ":crewind", ":cfirst" and ":clast". * ":ll", ":lrewind", ":lfirst" and ":llast". + * ":cdo", ":ldo", ":cfdo" and ":lfdo". */ void ex_cc(exarg_T *eap) { @@ -2582,7 +2732,10 @@ void ex_cc(exarg_T *eap) if (eap->cmdidx == CMD_ll || eap->cmdidx == CMD_lrewind || eap->cmdidx == CMD_lfirst - || eap->cmdidx == CMD_llast) { + || eap->cmdidx == CMD_llast + || eap->cmdidx == CMD_llast + || eap->cmdidx == CMD_ldo + || eap->cmdidx == CMD_lfdo) { qi = GET_LOC_LIST(curwin); if (qi == NULL) { EMSG(_(e_loclist)); @@ -2590,21 +2743,42 @@ void ex_cc(exarg_T *eap) } } - qf_jump(qi, 0, - eap->addr_count > 0 - ? (int)eap->line2 - : (eap->cmdidx == CMD_cc || eap->cmdidx == CMD_ll) - ? 0 - : (eap->cmdidx == CMD_crewind || eap->cmdidx == CMD_lrewind - || eap->cmdidx == CMD_cfirst || eap->cmdidx == CMD_lfirst) - ? 1 - : 32767, - eap->forceit); + int errornr; + if (eap->addr_count > 0) { + errornr = (int)eap->line2; + } else if (eap->cmdidx == CMD_cc || eap->cmdidx == CMD_ll) { + errornr = 0; + } else if (eap->cmdidx == CMD_crewind || eap->cmdidx == CMD_lrewind + || eap->cmdidx == CMD_cfirst || eap->cmdidx == CMD_lfirst) { + errornr = 1; + } else { + errornr = 32767; + } + + // For cdo and ldo commands, jump to the nth valid error. + // For cfdo and lfdo commands, jump to the nth valid file entry. + if (eap->cmdidx == CMD_cdo || eap->cmdidx == CMD_ldo || + eap->cmdidx == CMD_cfdo || eap->cmdidx == CMD_lfdo) { + size_t n; + if (eap->addr_count > 0) { + assert(eap->line1 >= 0); + n = (size_t)eap->line1; + } else { + n = 1; + } + size_t valid_entry = qf_get_nth_valid_entry(qi, n, + eap->cmdidx == CMD_cfdo || eap->cmdidx == CMD_lfdo); + assert(valid_entry <= INT_MAX); + errornr = (int)valid_entry; + } + + qf_jump(qi, 0, errornr, eap->forceit); } /* * ":cnext", ":cnfile", ":cNext" and ":cprevious". * ":lnext", ":lNext", ":lprevious", ":lnfile", ":lNfile" and ":lpfile". + * ":cdo", ":ldo", ":cfdo" and ":lfdo". */ void ex_cnext(exarg_T *eap) { @@ -2615,7 +2789,10 @@ void ex_cnext(exarg_T *eap) || eap->cmdidx == CMD_lprevious || eap->cmdidx == CMD_lnfile || eap->cmdidx == CMD_lNfile - || eap->cmdidx == CMD_lpfile) { + || eap->cmdidx == CMD_lpfile + || eap->cmdidx == CMD_lpfile + || eap->cmdidx == CMD_ldo + || eap->cmdidx == CMD_lfdo) { qi = GET_LOC_LIST(curwin); if (qi == NULL) { EMSG(_(e_loclist)); @@ -2623,15 +2800,26 @@ void ex_cnext(exarg_T *eap) } } - qf_jump(qi, (eap->cmdidx == CMD_cnext || eap->cmdidx == CMD_lnext) + int errornr; + if (eap->addr_count > 0 && + (eap->cmdidx != CMD_cdo && eap->cmdidx != CMD_ldo && + eap->cmdidx != CMD_cfdo && eap->cmdidx != CMD_lfdo)) { + errornr = (int)eap->line2; + } else { + errornr = 1; + } + + qf_jump(qi, (eap->cmdidx == CMD_cnext || eap->cmdidx == CMD_lnext + || eap->cmdidx == CMD_cdo || eap->cmdidx == CMD_ldo) ? FORWARD - : (eap->cmdidx == CMD_cnfile || eap->cmdidx == CMD_lnfile) + : (eap->cmdidx == CMD_cnfile || eap->cmdidx == CMD_lnfile + || eap->cmdidx == CMD_cfdo || eap->cmdidx == CMD_lfdo) ? FORWARD_FILE : (eap->cmdidx == CMD_cpfile || eap->cmdidx == CMD_lpfile || eap->cmdidx == CMD_cNfile || eap->cmdidx == CMD_lNfile) ? BACKWARD_FILE : BACKWARD, - eap->addr_count > 0 ? (int)eap->line2 : 1, eap->forceit); + errornr, eap->forceit); } /* diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index 8c3e99c624..1a414a8847 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -29,6 +29,7 @@ SCRIPTS := test_eval.out \ test_charsearch.out \ test_close_count.out \ test_command_count.out \ + test_cdo.out \ SCRIPTS_GUI := test16.out diff --git a/src/nvim/testdir/test_breakindent.in b/src/nvim/testdir/test_breakindent.in index b05aef7f8d..5a8e580c4a 100644 --- a/src/nvim/testdir/test_breakindent.in +++ b/src/nvim/testdir/test_breakindent.in @@ -101,7 +101,7 @@ fygjyl:let line2 = @0 :$put =line2 :" :let g:test="Test 14: breakindent + visual blockwise delete #1" -:set all& breakindent +:set all& breakindent shada+=nX-test-breakindent.shada :30vnew :normal! 3a1234567890 :normal! a abcde diff --git a/src/nvim/testdir/test_cdo.in b/src/nvim/testdir/test_cdo.in new file mode 100644 index 0000000000..fb80ea1164 --- /dev/null +++ b/src/nvim/testdir/test_cdo.in @@ -0,0 +1,107 @@ +Tests for the :cdo, :cfdo, :ldo and :lfdo commands + +STARTTEST +:so small.vim +:if !has('quickfix') | e! test.ok | wq! test.out | endif + +:call writefile(["Line1", "Line2", "Line3"], 'Xtestfile1') +:call writefile(["Line1", "Line2", "Line3"], 'Xtestfile2') +:call writefile(["Line1", "Line2", "Line3"], 'Xtestfile3') + +:function RunTests(cchar) +: let nl="\n" + +: enew +: " Try with an empty list +: exe a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" + +: " Populate the list and then try +: exe a:cchar . "getexpr ['non-error 1', 'Xtestfile1:1:3:Line1', 'non-error 2', 'Xtestfile2:2:2:Line2', 'non-error 3', 'Xtestfile3:3:1:Line3']" +: exe a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" + +: " Run command only on selected error lines +: enew +: exe "2,3" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" +: " Boundary condition tests +: enew +: exe "1,1" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" +: enew +: exe "3" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" +: " Range test commands +: enew +: exe "%" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" +: enew +: exe "1,$" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" +: enew +: exe a:cchar . 'prev' +: exe "." . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" +: " Invalid error lines test +: enew +: exe "27" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" +: exe "4,5" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" + +: " Run commands from an unsaved buffer +: let v:errmsg='' +: enew +: setlocal modified +: exe "2,2" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" +: if v:errmsg =~# 'No write since last change' +: let g:result .= 'Unsaved file change test passed' . nl +: else +: let g:result .= 'Unsaved file change test failed' . nl +: endif + +: " If the executed command fails, then the operation should be aborted +: enew! +: let subst_count = 0 +: exe a:cchar . "do s/Line/xLine/ | let subst_count += 1" +: if subst_count == 1 && getline('.') == 'xLine1' +: let g:result .= 'Abort command on error test passed' . nl +: else +: let g:result .= 'Abort command on error test failed' . nl +: endif + +: exe "2,2" . a:cchar . "do! let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" + +: " List with no valid error entries +: edit! +2 Xtestfile1 +: exe a:cchar . "getexpr ['non-error 1', 'non-error 2', 'non-error 3']" +: exe a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" +: exe "2" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" +: let v:errmsg='' +: exe "%" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" +: exe "1,$" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" +: exe "." . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" +: let g:result .= v:errmsg + +: " List with only one valid entry +: exe a:cchar . "getexpr ['Xtestfile3:3:1:Line3']" +: exe a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" + +: " Tests for :cfdo and :lfdo commands +: exe a:cchar . "getexpr ['non-error 1', 'Xtestfile1:1:3:Line1', 'Xtestfile1:2:1:Line2', 'non-error 2', 'Xtestfile2:2:2:Line2', 'non-error 3', 'Xtestfile3:2:3:Line2', 'Xtestfile3:3:1:Line3']" +: exe a:cchar . "fdo let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" +: exe "3" . a:cchar . "fdo let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" +: exe "2,3" . a:cchar . "fdo let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" +: exe "%" . a:cchar . "fdo let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" +: exe "1,$" . a:cchar . "fdo let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" +: exe a:cchar . 'pfile' +: exe "." . a:cchar . "fdo let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" + +: " List with only one valid entry +: exe a:cchar . "getexpr ['Xtestfile2:2:5:Line2']" +: exe a:cchar . "fdo let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" +:endfunction + +:let result='' +:" Tests for the :cdo quickfix list command +:call RunTests('c') +:let result .= "\n" +:" Tests for the :ldo location list command +:call RunTests('l') + +:edit! test.out +:0put =result +:wq! +ENDTEST + diff --git a/src/nvim/testdir/test_cdo.ok b/src/nvim/testdir/test_cdo.ok new file mode 100644 index 0000000000..ddcff4bbb8 --- /dev/null +++ b/src/nvim/testdir/test_cdo.ok @@ -0,0 +1,66 @@ +Xtestfile1 1L 3C +Xtestfile2 2L 2C +Xtestfile3 3L 1C +Xtestfile2 2L 2C +Xtestfile3 3L 1C +Xtestfile1 1L 3C +Xtestfile3 3L 1C +Xtestfile1 1L 3C +Xtestfile2 2L 2C +Xtestfile3 3L 1C +Xtestfile1 1L 3C +Xtestfile2 2L 2C +Xtestfile3 3L 1C +Xtestfile2 2L 2C +Unsaved file change test passed +Abort command on error test passed +Xtestfile2 2L 2C +Xtestfile3 3L 1C +Xtestfile1 1L 3C +Xtestfile2 2L 2C +Xtestfile3 2L 3C +Xtestfile3 2L 3C +Xtestfile2 2L 2C +Xtestfile3 2L 3C +Xtestfile1 1L 3C +Xtestfile2 2L 2C +Xtestfile3 2L 3C +Xtestfile1 1L 3C +Xtestfile2 2L 2C +Xtestfile3 2L 3C +Xtestfile2 2L 2C +Xtestfile2 2L 5C + +Xtestfile1 1L 3C +Xtestfile2 2L 2C +Xtestfile3 3L 1C +Xtestfile2 2L 2C +Xtestfile3 3L 1C +Xtestfile1 1L 3C +Xtestfile3 3L 1C +Xtestfile1 1L 3C +Xtestfile2 2L 2C +Xtestfile3 3L 1C +Xtestfile1 1L 3C +Xtestfile2 2L 2C +Xtestfile3 3L 1C +Xtestfile2 2L 2C +Unsaved file change test passed +Abort command on error test passed +Xtestfile2 2L 2C +Xtestfile3 3L 1C +Xtestfile1 1L 3C +Xtestfile2 2L 2C +Xtestfile3 2L 3C +Xtestfile3 2L 3C +Xtestfile2 2L 2C +Xtestfile3 2L 3C +Xtestfile1 1L 3C +Xtestfile2 2L 2C +Xtestfile3 2L 3C +Xtestfile1 1L 3C +Xtestfile2 2L 2C +Xtestfile3 2L 3C +Xtestfile2 2L 2C +Xtestfile2 2L 5C + diff --git a/src/nvim/testdir/test_eval.in b/src/nvim/testdir/test_eval.in index b2b982a434..54cdb03ba2 100644 --- a/src/nvim/testdir/test_eval.in +++ b/src/nvim/testdir/test_eval.in @@ -2,12 +2,18 @@ Test for various eval features. vim: set ft=vim : Note: system clipboard is saved, changed and restored. +clipboard contents +something else + STARTTEST :so small.vim :set noswapfile :lang C :fun AppendRegContents(reg) - call append('$', printf('%s: type %s; value: %s (%s), expr: %s (%s)', a:reg, getregtype(a:reg), getreg(a:reg), string(getreg(a:reg, 0, 1)), getreg(a:reg, 1), string(getreg(a:reg, 1, 1)))) + call AppendRegParts(a:reg, getregtype(a:reg), getreg(a:reg), string(getreg(a:reg, 0, 1)), getreg(a:reg, 1), string(getreg(a:reg, 1, 1))) +:endfun +:fun AppendRegParts(reg, type, cont, strcont, cont1, strcont1) + call append('$', printf('%s: type %s; value: %s (%s), expr: %s (%s)', a:reg, a:type, a:cont, a:strcont, a:cont1, a:strcont1)) endfun :command -nargs=? AR :call AppendRegContents(<q-args>) :fun SetReg(...) @@ -121,18 +127,23 @@ call SetReg('/', ["abc/\n"]) call SetReg('=', ['"abc/"']) call SetReg('=', ["\"abc/\n\""]) $put ='{{{1 System clipboard' +if has('clipboard') " Save and restore system clipboard. " If no connection to X-Server is possible, test should succeed. -:let _clipreg = ['+', getreg('+'), getregtype('+')] -:let _clipopt = &cb -:let &cb='unnamedplus' -:1y -:AR + -:tabdo :windo :echo "hi" -:3y -:AR + -:let &cb=_clipopt -:call call('setreg', _clipreg) +let _clipreg = ['*', getreg('*'), getregtype('*')] +let _clipopt = &cb +let &cb='unnamed' +5y +AR * +tabdo :windo :echo "hi" +6y +AR * +let &cb=_clipopt +call call('setreg', _clipreg) +else + call AppendRegParts('*', 'V', "clipboard contents\n", "['clipboard contents']", "clipboard contents\n", "['clipboard contents']") + call AppendRegParts('*', 'V', "something else\n", "['something else']", "something else\n", "['something else']") +endif $put ='{{{1 Errors' call ErrExe('call setreg()') call ErrExe('call setreg(1)') diff --git a/src/nvim/testdir/test_eval.ok b/src/nvim/testdir/test_eval.ok Binary files differindex 2cdb8f5da8..cf7a5cd418 100644 --- a/src/nvim/testdir/test_eval.ok +++ b/src/nvim/testdir/test_eval.ok diff --git a/src/nvim/version.c b/src/nvim/version.c index 33c310a8b2..b097ac4702 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -135,7 +135,7 @@ static int included_patches[] = { // 861 NA // 860, // 859, - // 858, + 858, // 857, // 856, // 855 NA @@ -318,7 +318,7 @@ static int included_patches[] = { // 678 NA // 677 NA // 676 NA - // 675, + 675, // 674 NA 673, // 672, @@ -381,15 +381,15 @@ static int included_patches[] = { 615, // 614, // 613, - // 612, + 612, // 611 NA // 610 NA 609, - // 608, + 608, // 607, 606, // 605, - // 604, + 604, // 603, 602, 601, diff --git a/test/functional/legacy/fixeol_spec.lua b/test/functional/legacy/fixeol_spec.lua index 578178d707..2d1824c8cd 100644 --- a/test/functional/legacy/fixeol_spec.lua +++ b/test/functional/legacy/fixeol_spec.lua @@ -1,7 +1,7 @@ -- Tests for 'fixeol' local helpers = require('test.functional.helpers') -local feed, insert, source = helpers.feed, helpers.insert, helpers.source +local feed = helpers.feed local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect describe('fixeol', function() diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt index c7053e6a93..7f582d3199 100644 --- a/third-party/CMakeLists.txt +++ b/third-party/CMakeLists.txt @@ -77,7 +77,7 @@ set(LIBUV_SHA256 db5d46318e18330c696d954747036e1be8e2346411d4f30236d7e2f499f0cfa set(MSGPACK_URL https://github.com/msgpack/msgpack-c/archive/cpp-1.0.0.tar.gz) set(MSGPACK_SHA256 afda64ca445203bb7092372b822bae8b2539fdcebbfc3f753f393628c2bcfe7d) -set(LUAJIT_URL http://luajit.org/download/LuaJIT-2.0.4.tar.gz) +set(LUAJIT_URL https://github.com/neovim/deps/raw/master/src/LuaJIT-2.0.4.tar.gz) set(LUAJIT_SHA256 620fa4eb12375021bef6e4f237cbd2dd5d49e56beb414bee052c746beef1807d) set(LUAROCKS_URL https://github.com/keplerproject/luarocks/archive/5d8a16526573b36d5b22aa74866120c998466697.tar.gz) |