diff options
55 files changed, 124 insertions, 395 deletions
diff --git a/runtime/autoload/tutor.vim b/runtime/autoload/tutor.vim index d2881f7f34..4d5a10a97c 100644 --- a/runtime/autoload/tutor.vim +++ b/runtime/autoload/tutor.vim @@ -2,6 +2,12 @@ " Setup: {{{1 function! tutor#SetupVim() + if &columns < 90 + set columns=90 + endif + if !exists('g:did_load_ftplugin') || g:did_load_ftplugin != 1 + filetype plugin on + endif if has('syntax') if !exists('g:syntax_on') || g:syntax_on == 0 syntax on @@ -336,6 +342,7 @@ function! tutor#TutorCmd(tutor_name) let l:to_open = l:tutors[l:tutor_to_open-1] endif + call tutor#SetupVim() exe "edit ".l:to_open endfunction diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 02fe971f6a..bbf3da8de7 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -5303,9 +5303,9 @@ A jump table for the options with a short description can be found at |Q_op|. % When included, save and restore the buffer list. If Vim is started with a file name argument, the buffer list is not restored. If Vim is started without a file name argument, the - buffer list is restored from the shada file. Buffers - without a file name and buffers for help files are not written - to the shada file. + buffer list is restored from the shada file. Quickfix + ('buftype'), unlisted ('buflisted'), unnamed and buffers on + removable media (|shada-r|) are not saved. When followed by a number, the number specifies the maximum number of buffers that are stored. Without a number all buffers are stored. diff --git a/runtime/ftplugin/tutor.vim b/runtime/ftplugin/tutor.vim index 0a28d7def4..1579753170 100644 --- a/runtime/ftplugin/tutor.vim +++ b/runtime/ftplugin/tutor.vim @@ -21,8 +21,9 @@ setlocal iskeyword=@,-,_ setlocal foldmethod=expr setlocal foldexpr=tutor#TutorFolds() -setlocal foldcolumn=3 +setlocal foldcolumn=1 setlocal foldlevel=4 +setlocal nowrap setlocal statusline=%{toupper(expand('%:t:r'))}\ tutorial%= setlocal statusline+=%{tutor#InfoText()} diff --git a/runtime/tutor/en/vim-01-beginner.tutor b/runtime/tutor/en/vim-01-beginner.tutor index f791e727e7..47d4ed06a1 100644 --- a/runtime/tutor/en/vim-01-beginner.tutor +++ b/runtime/tutor/en/vim-01-beginner.tutor @@ -7,6 +7,12 @@ IMPORTANT to remember that this tutor is set up to teach by use. That means that you need to do the exercises to learn them properly. If you only read the text, you will soon forget what is most important! +For now, make sure that your Shift-Lock key is NOT depressed and press the `j`{normal} +key enough times to move the cursor so that Lesson 0 completely fills the +screen. + +# Lesson 0 + NOTE: The commands in the lessons will modify the text, but those changes won't be saved. Don't worry about messing things up; just remember that pressing [<Esc>](<Esc>) and then [u](u) will undo the latest change. @@ -30,9 +36,7 @@ or press a sequence of keys Text within <'s and >'s (like `<Enter>`{normal}) describes a key to press instead of text to type. -Now, make sure that your Shift-Lock key is NOT depressed and press the `j`{normal} -key enough times to move the cursor so that Lesson 1.1 completely fills the -screen. +Now, move to the next lesson (remember, use j). ## Lesson 1.1: MOVING THE CURSOR diff --git a/src/nvim/ascii.h b/src/nvim/ascii.h index cce52c5250..2b3e94d5a0 100644 --- a/src/nvim/ascii.h +++ b/src/nvim/ascii.h @@ -1,10 +1,3 @@ -/* - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - */ - #ifndef NVIM_ASCII_H #define NVIM_ASCII_H diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index fb1aeb7ba8..7978dc8969 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -1,12 +1,4 @@ /* - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.md for an overview of the Vim source code. - */ - -/* * buffer.c: functions for dealing with the buffer structure */ diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 08b587df8a..8dc2844d8e 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -1,12 +1,4 @@ /* - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.md for an overview of the Vim source code. - */ - -/* * edit.c: functions for Insert mode */ diff --git a/src/nvim/eval.c b/src/nvim/eval.c index cec7c91c03..f104098dbf 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -1,13 +1,4 @@ /* - * - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.md for an overview of the Vim source code. - */ - -/* * eval.c: Expression evaluation. */ diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index f69910eb99..3f19421a75 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -1,12 +1,4 @@ /* - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.md for an overview of the Vim source code. - */ - -/* * ex_cmds.c: some functions for command line commands */ diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index bb629fad76..87a6283310 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -1,12 +1,4 @@ /* - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.md for an overview of the Vim source code. - */ - -/* * ex_cmds2.c: some more functions for command line commands */ diff --git a/src/nvim/ex_cmds_defs.h b/src/nvim/ex_cmds_defs.h index 4065cc2fdc..10d2eb688e 100644 --- a/src/nvim/ex_cmds_defs.h +++ b/src/nvim/ex_cmds_defs.h @@ -1,9 +1,3 @@ -/* - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - */ #ifndef NVIM_EX_CMDS_DEFS_H #define NVIM_EX_CMDS_DEFS_H diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index b50c7330d3..4b5844c5bd 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -1,12 +1,4 @@ /* - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.md for an overview of the Vim source code. - */ - -/* * ex_docmd.c: functions for executing an Ex command line. */ diff --git a/src/nvim/ex_eval.c b/src/nvim/ex_eval.c index 773005e72b..bf67047ae8 100644 --- a/src/nvim/ex_eval.c +++ b/src/nvim/ex_eval.c @@ -1,12 +1,4 @@ /* - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.md for an overview of the Vim source code. - */ - -/* * ex_eval.c: functions for Ex command line for the +eval feature. */ #include <assert.h> diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index c9a324b49f..33157864c0 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -1,12 +1,4 @@ /* - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.md for an overview of the Vim source code. - */ - -/* * ex_getln.c: Functions for entering and editing an Ex command line. */ diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index 4aa4d4c399..5ac133a0c3 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -1,12 +1,4 @@ /* - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.md for an overview of the Vim source code. - */ - -/* * fileio.c: read from and write to a file */ diff --git a/src/nvim/fold.c b/src/nvim/fold.c index 29921bc816..2e32e78062 100644 --- a/src/nvim/fold.c +++ b/src/nvim/fold.c @@ -1,11 +1,4 @@ -/* vim: set fdm=marker fdl=1 fdc=3 - * - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.md for an overview of the Vim source code. - */ +// vim: set fdm=marker fdl=1 fdc=3 /* * fold.c: code for folding diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index 3692fa27aa..44d6c086e7 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -1,12 +1,4 @@ /* - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.md for an overview of the Vim source code. - */ - -/* * getchar.c * * functions related with getting a character from the user/mapping/redo/... diff --git a/src/nvim/globals.h b/src/nvim/globals.h index 7c42238d20..d06cf6bfda 100644 --- a/src/nvim/globals.h +++ b/src/nvim/globals.h @@ -1,10 +1,3 @@ -/* - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - */ - #ifndef NVIM_GLOBALS_H #define NVIM_GLOBALS_H @@ -55,6 +48,57 @@ # endif #endif +#ifdef WIN32 +# define _PATHSEPSTR "\\" +#else +# define _PATHSEPSTR "/" +#endif + +#ifndef FILETYPE_FILE +# define FILETYPE_FILE "filetype.vim" +#endif + +#ifndef FTPLUGIN_FILE +# define FTPLUGIN_FILE "ftplugin.vim" +#endif + +#ifndef INDENT_FILE +# define INDENT_FILE "indent.vim" +#endif + +#ifndef FTOFF_FILE +# define FTOFF_FILE "ftoff.vim" +#endif + +#ifndef FTPLUGOF_FILE +# define FTPLUGOF_FILE "ftplugof.vim" +#endif + +#ifndef INDOFF_FILE +# define INDOFF_FILE "indoff.vim" +#endif + +#define DFLT_ERRORFILE "errors.err" + +#ifndef SYS_VIMRC_FILE +# define SYS_VIMRC_FILE "$VIM" _PATHSEPSTR "sysinit.vim" +#endif + +#ifndef DFLT_HELPFILE +# define DFLT_HELPFILE "$VIMRUNTIME" _PATHSEPSTR "doc" _PATHSEPSTR "help.txt" +#endif + +#ifndef SYNTAX_FNAME +# define SYNTAX_FNAME "$VIMRUNTIME" _PATHSEPSTR "syntax" _PATHSEPSTR "%s.vim" +#endif + +#ifndef EXRC_FILE +# define EXRC_FILE ".exrc" +#endif + +#ifndef VIMRC_FILE +# define VIMRC_FILE ".nvimrc" +#endif /* Values for "starting" */ #define NO_SCREEN 2 /* no screen updating yet */ diff --git a/src/nvim/hardcopy.c b/src/nvim/hardcopy.c index 9f7431ee7d..ab8959239b 100644 --- a/src/nvim/hardcopy.c +++ b/src/nvim/hardcopy.c @@ -1,12 +1,4 @@ /* - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.md for an overview of the Vim source code. - */ - -/* * hardcopy.c: printing to paper */ diff --git a/src/nvim/if_cscope.c b/src/nvim/if_cscope.c index 578ae5de1e..3585c26ca2 100644 --- a/src/nvim/if_cscope.c +++ b/src/nvim/if_cscope.c @@ -4,9 +4,8 @@ * * The basic idea/structure of cscope for Vim was borrowed from Nvi. There * might be a few lines of code that look similar to what Nvi has. - * - * See README.md for an overview of the Vim source code. */ + #include <stdbool.h> #include <assert.h> diff --git a/src/nvim/keymap.c b/src/nvim/keymap.c index 85380ba173..04d6cbf5e3 100644 --- a/src/nvim/keymap.c +++ b/src/nvim/keymap.c @@ -1,4 +1,4 @@ -/************************************************************************ +/* * functions that use lookup tables for various things, generally to do with * special key codes. */ diff --git a/src/nvim/keymap.h b/src/nvim/keymap.h index d2d96c6149..766362d145 100644 --- a/src/nvim/keymap.h +++ b/src/nvim/keymap.h @@ -1,10 +1,3 @@ -/* - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - */ - #ifndef NVIM_KEYMAP_H #define NVIM_KEYMAP_H diff --git a/src/nvim/macros.h b/src/nvim/macros.h index d42997650c..26ab5a7de7 100644 --- a/src/nvim/macros.h +++ b/src/nvim/macros.h @@ -1,17 +1,6 @@ #ifndef NVIM_MACROS_H #define NVIM_MACROS_H -/* - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - */ - -/* - * macros.h: macro definitions for often used code - */ - #ifndef MIN # define MIN(X, Y) ((X) < (Y) ? (X) : (Y)) #endif diff --git a/src/nvim/main.c b/src/nvim/main.c index 203aeb8d69..cef10d12d5 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -1,11 +1,3 @@ -/* - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.md for an overview of the Vim source code. - */ - #define EXTERN #include <assert.h> #include <stdint.h> @@ -1864,5 +1856,3 @@ static void check_swap_exists_action(void) getout(1); handle_swap_exists(NULL); } - - diff --git a/src/nvim/mark.c b/src/nvim/mark.c index 38a76a45e6..e2f212340c 100644 --- a/src/nvim/mark.c +++ b/src/nvim/mark.c @@ -1,12 +1,4 @@ /* - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.md for an overview of the Vim source code. - */ - -/* * mark.c: functions for setting marks and jumping to them */ diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c index fc7199e3a6..b02c18c53b 100644 --- a/src/nvim/mbyte.c +++ b/src/nvim/mbyte.c @@ -1,13 +1,6 @@ /* - * VIM - Vi IMproved by Bram Moolenaar - * Multibyte extensions partly by Sung-Hoon Baek - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.md for an overview of the Vim source code. - */ -/* * mbyte.c: Code specifically for handling multi-byte characters. + * Multibyte extensions partly by Sung-Hoon Baek * * The encoding used in the core is set with 'encoding'. When 'encoding' is * changed, the following four variables are set (for speed). diff --git a/src/nvim/memfile.c b/src/nvim/memfile.c index b2783736e1..3df4cbc4a3 100644 --- a/src/nvim/memfile.c +++ b/src/nvim/memfile.c @@ -1,11 +1,3 @@ -/* - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.md for an overview of the Vim source code. - */ - /// An abstraction to handle blocks of memory which can be stored in a file. /// This is the implementation of a sort of virtual memory. /// diff --git a/src/nvim/memline.c b/src/nvim/memline.c index e822a58273..0ba8dd98d0 100644 --- a/src/nvim/memline.c +++ b/src/nvim/memline.c @@ -1,11 +1,3 @@ -/* - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.md for an overview of the Vim source code. - */ - /* for debugging */ /* #define CHECK(c, s) if (c) EMSG(s) */ #define CHECK(c, s) diff --git a/src/nvim/menu.c b/src/nvim/menu.c index 3859ba5ec8..91a72abfc5 100644 --- a/src/nvim/menu.c +++ b/src/nvim/menu.c @@ -1,14 +1,6 @@ /* - * VIM - Vi IMproved by Bram Moolenaar - * GUI/Motif support by Robert Webb - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.md for an overview of the Vim source code. - */ - -/* * Code for menus. Used for the GUI and 'wildmenu'. + * GUI/Motif support by Robert Webb */ #include <assert.h> diff --git a/src/nvim/message.c b/src/nvim/message.c index 52e2a286c3..66b8b9b5d2 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -1,12 +1,4 @@ /* - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.md for an overview of the Vim source code. - */ - -/* * message.c: functions for displaying messages on the command line */ diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c index 0ba6929686..96ef6cbaef 100644 --- a/src/nvim/misc1.c +++ b/src/nvim/misc1.c @@ -1,12 +1,4 @@ /* - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.md for an overview of the Vim source code. - */ - -/* * misc1.c: functions that didn't seem to fit elsewhere */ diff --git a/src/nvim/misc2.c b/src/nvim/misc2.c index d72a8f17e0..c615e0689f 100644 --- a/src/nvim/misc2.c +++ b/src/nvim/misc2.c @@ -1,12 +1,4 @@ /* - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.md for an overview of the Vim source code. - */ - -/* * misc2.c: Various functions. */ #include <assert.h> diff --git a/src/nvim/move.c b/src/nvim/move.c index b44d3f2fd9..eb55397511 100644 --- a/src/nvim/move.c +++ b/src/nvim/move.c @@ -1,11 +1,4 @@ /* - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.md for an overview of the Vim source code. - */ -/* * move.c: Functions for moving the cursor and scrolling text. * * There are two ways to move the cursor: diff --git a/src/nvim/normal.c b/src/nvim/normal.c index a0d2c7903d..ad53e9bf24 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -1,11 +1,4 @@ /* - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.md for an overview of the Vim source code. - */ -/* * normal.c: Contains the main routine for processing characters in command * mode. Communicates closely with the code in ops.c to handle * the operators. diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 6693ca23c8..956b9c7758 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -1,12 +1,4 @@ /* - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.md for an overview of the Vim source code. - */ - -/* * ops.c: implementation of various operators: op_shift, op_delete, op_tilde, * op_change, op_yank, do_put, do_join */ diff --git a/src/nvim/option.c b/src/nvim/option.c index 8b4aab88a3..f5080c7a91 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -1,12 +1,4 @@ /* - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.md for an overview of the Vim source code. - */ - -/* * Code to handle user-settable options. This is all pretty much table- * driven. Checklist for adding a new option: * - Put it in the options array below (copy an existing entry). diff --git a/src/nvim/os/os_defs.h b/src/nvim/os/os_defs.h index 55a2d5513e..7d77899287 100644 --- a/src/nvim/os/os_defs.h +++ b/src/nvim/os/os_defs.h @@ -39,32 +39,6 @@ # define MAXPATHL 1024 #endif -#ifndef FILETYPE_FILE -# define FILETYPE_FILE "filetype.vim" -#endif - -#ifndef FTPLUGIN_FILE -# define FTPLUGIN_FILE "ftplugin.vim" -#endif - -#ifndef INDENT_FILE -# define INDENT_FILE "indent.vim" -#endif - -#ifndef FTOFF_FILE -# define FTOFF_FILE "ftoff.vim" -#endif - -#ifndef FTPLUGOF_FILE -# define FTPLUGOF_FILE "ftplugof.vim" -#endif - -#ifndef INDOFF_FILE -# define INDOFF_FILE "indoff.vim" -#endif - -#define DFLT_ERRORFILE "errors.err" - // Command-processing buffer. Use large buffers for all platforms. #define CMDBUFFSIZE 1024 diff --git a/src/nvim/os/unix_defs.h b/src/nvim/os/unix_defs.h index b1511d4b56..e3ba3262f4 100644 --- a/src/nvim/os/unix_defs.h +++ b/src/nvim/os/unix_defs.h @@ -9,7 +9,6 @@ # include <sys/param.h> #endif - #define TEMP_DIR_NAMES {"$TMPDIR", "/tmp", ".", "~"} #define TEMP_FILE_PATH_MAXLEN 256 @@ -18,21 +17,4 @@ // Special wildcards that need to be handled by the shell. #define SPECIAL_WILDCHAR "`'{" -// Unix system-dependent file names -#ifndef SYS_VIMRC_FILE -# define SYS_VIMRC_FILE "$VIM/sysinit.vim" -#endif -#ifndef DFLT_HELPFILE -# define DFLT_HELPFILE "$VIMRUNTIME/doc/help.txt" -#endif -#ifndef SYNTAX_FNAME -# define SYNTAX_FNAME "$VIMRUNTIME/syntax/%s.vim" -#endif -#ifndef EXRC_FILE -# define EXRC_FILE ".exrc" -#endif -#ifndef VIMRC_FILE -# define VIMRC_FILE ".nvimrc" -#endif - #endif // NVIM_OS_UNIX_DEFS_H diff --git a/src/nvim/os/win_defs.h b/src/nvim/os/win_defs.h index bfd431c9c6..32960dfbe9 100644 --- a/src/nvim/os/win_defs.h +++ b/src/nvim/os/win_defs.h @@ -6,17 +6,6 @@ #define TEMP_DIR_NAMES {"$TMP", "$TEMP", "$USERPROFILE", ""} #define TEMP_FILE_PATH_MAXLEN _MAX_PATH -// Defines needed to fix the build on Windows: -// - DFLT_DIR -// - DFLT_BDIR -// - DFLT_VDIR -// - EXRC_FILE -// - VIMRC_FILE -// - SYNTAX_FNAME -// - DFLT_HELPFILE -// - SYS_VIMRC_FILE -// - SPECIAL_WILDCHAR - #define USE_CRNL #ifdef _MSC_VER diff --git a/src/nvim/os_unix.c b/src/nvim/os_unix.c index ddb799f23d..62b264046c 100644 --- a/src/nvim/os_unix.c +++ b/src/nvim/os_unix.c @@ -1,12 +1,4 @@ /* - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.md for an overview of the Vim source code. - */ - -/* * os_unix.c -- code for all flavors of Unix (BSD, SYSV, SVR4, POSIX, ...) * * A lot of this file was originally written by Juergen Weigert and later diff --git a/src/nvim/path.c b/src/nvim/path.c index a14ba38508..877ef1565a 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -1,4 +1,3 @@ - #include <assert.h> #include <inttypes.h> #include <stdbool.h> diff --git a/src/nvim/popupmnu.c b/src/nvim/popupmnu.c index 10012a9775..001740943f 100644 --- a/src/nvim/popupmnu.c +++ b/src/nvim/popupmnu.c @@ -1,7 +1,7 @@ /// @file popupmnu.c /// /// Popup menu (PUM) -// + #include <assert.h> #include <inttypes.h> #include <stdbool.h> diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index 8be010c560..8e6ae46a3b 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -1,12 +1,4 @@ /* - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.md for an overview of the Vim source code. - */ - -/* * quickfix.c: functions for quickfix mode, using a file with error messages */ diff --git a/src/nvim/screen.c b/src/nvim/screen.c index bea09fd804..9fdb476748 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -1,12 +1,4 @@ /* - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.md for an overview of the Vim source code. - */ - -/* * screen.c: code for displaying on the screen * * Output to the screen (console, terminal emulator or GUI window) is minimized diff --git a/src/nvim/search.c b/src/nvim/search.c index 89c96fe31e..cb461c9ef2 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -1,11 +1,4 @@ /* - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.md for an overview of the Vim source code. - */ -/* * search.c: code for normal mode searching commands */ diff --git a/src/nvim/shada.c b/src/nvim/shada.c index 231dad07e5..e21c6f17fe 100644 --- a/src/nvim/shada.c +++ b/src/nvim/shada.c @@ -43,6 +43,7 @@ #include "nvim/path.h" #include "nvim/fileio.h" #include "nvim/strings.h" +#include "nvim/quickfix.h" #include "nvim/lib/khash.h" #include "nvim/lib/kvec.h" @@ -2484,8 +2485,11 @@ static ShaDaWriteResult shada_write(ShaDaWriteDef *const sd_writer, // Write buffer list if (find_shada_parameter('%') != NULL) { size_t buf_count = 0; +#define IGNORE_BUF(buf)\ + (buf->b_ffname == NULL || !buf->b_p_bl || bt_quickfix(buf) \ + || in_bufset(&removable_bufs, buf)) FOR_ALL_BUFFERS(buf) { - if (buf->b_ffname != NULL && !in_bufset(&removable_bufs, buf)) { + if (!IGNORE_BUF(buf)) { buf_count++; } } @@ -2503,7 +2507,7 @@ static ShaDaWriteResult shada_write(ShaDaWriteDef *const sd_writer, }; size_t i = 0; FOR_ALL_BUFFERS(buf) { - if (buf->b_ffname == NULL || in_bufset(&removable_bufs, buf)) { + if (IGNORE_BUF(buf)) { continue; } buflist_entry.data.buffer_list.buffers[i] = (struct buffer_list_buffer) { @@ -2519,6 +2523,7 @@ static ShaDaWriteResult shada_write(ShaDaWriteDef *const sd_writer, goto shada_write_exit; } xfree(buflist_entry.data.buffer_list.buffers); +#undef IGNORE_BUF } // Write some of the variables diff --git a/src/nvim/spell.c b/src/nvim/spell.c index a5b66ad220..420e8e2b70 100644 --- a/src/nvim/spell.c +++ b/src/nvim/spell.c @@ -1,9 +1,3 @@ -// VIM - Vi IMproved by Bram Moolenaar -// -// Do ":help uganda" in Vim to read copying and usage conditions. -// Do ":help credits" in Vim to see a list of people who contributed. -// See README.md for an overview of the Vim source code. - // spell.c: code for spell checking // // The spell checking mechanism uses a tree (aka trie). Each node in the tree diff --git a/src/nvim/strings.c b/src/nvim/strings.c index 4bd394cb44..00dcf3cf46 100644 --- a/src/nvim/strings.c +++ b/src/nvim/strings.c @@ -1,4 +1,3 @@ - #include <inttypes.h> #include <stdbool.h> #include <string.h> diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index f65b21a40b..24422c71fb 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -1,12 +1,4 @@ /* - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.md for an overview of the Vim source code. - */ - -/* * syntax.c: code for syntax highlighting */ diff --git a/src/nvim/tag.c b/src/nvim/tag.c index 1b3fda8aca..d832924efd 100644 --- a/src/nvim/tag.c +++ b/src/nvim/tag.c @@ -1,12 +1,4 @@ /* - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.md for an overview of the Vim source code. - */ - -/* * Code to handle tags and the tag stack */ diff --git a/src/nvim/types.h b/src/nvim/types.h index afd684925a..bfe8be2091 100644 --- a/src/nvim/types.h +++ b/src/nvim/types.h @@ -1,10 +1,3 @@ -/* - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - */ - #ifndef NVIM_TYPES_H #define NVIM_TYPES_H diff --git a/src/nvim/undo.c b/src/nvim/undo.c index 6c87f01746..a4396520bb 100644 --- a/src/nvim/undo.c +++ b/src/nvim/undo.c @@ -1,12 +1,4 @@ /* - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.md for an overview of the Vim source code. - */ - -/* * undo.c: multi level undo facility * * The saved lines are stored in a list of lists (one for each buffer): diff --git a/src/nvim/vim.h b/src/nvim/vim.h index 48d53369de..fa00d9efcf 100644 --- a/src/nvim/vim.h +++ b/src/nvim/vim.h @@ -1,10 +1,3 @@ -/* - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - */ - #ifndef NVIM_VIM_H #define NVIM_VIM_H diff --git a/src/nvim/window.c b/src/nvim/window.c index 8ac50b2731..16ff7dfb14 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -1,11 +1,3 @@ -/* - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read a list of people who contributed. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.md for an overview of the Vim source code. - */ - #include <assert.h> #include <inttypes.h> #include <stdbool.h> diff --git a/test/functional/shada/buffers_spec.lua b/test/functional/shada/buffers_spec.lua index fd0c5e9a39..fd4809e01a 100644 --- a/test/functional/shada/buffers_spec.lua +++ b/test/functional/shada/buffers_spec.lua @@ -1,7 +1,7 @@ -- ShaDa buffer list saving/reading support local helpers = require('test.functional.helpers') -local nvim_command, funcs, eq = - helpers.command, helpers.funcs, helpers.eq +local nvim_command, funcs, eq, curbufmeths = + helpers.command, helpers.funcs, helpers.eq, helpers.curbufmeths local shada_helpers = require('test.functional.shada.helpers') local reset, set_additional_cmd, clear = @@ -48,4 +48,43 @@ describe('ShaDa support code', function() eq(1, funcs.bufnr('$')) eq('', funcs.bufname(1)) end) + + it('does not dump unlisted buffer', function() + set_additional_cmd('set shada+=%') + reset() + nvim_command('edit ' .. testfilename) + nvim_command('edit ' .. testfilename_2) + curbufmeths.set_option('buflisted', false) + nvim_command('qall') + reset() + eq(2, funcs.bufnr('$')) + eq('', funcs.bufname(1)) + eq(testfilename, funcs.bufname(2)) + end) + + it('does not dump quickfix buffer', function() + set_additional_cmd('set shada+=%') + reset() + nvim_command('edit ' .. testfilename) + nvim_command('edit ' .. testfilename_2) + curbufmeths.set_option('buftype', 'quickfix') + nvim_command('qall') + reset() + eq(2, funcs.bufnr('$')) + eq('', funcs.bufname(1)) + eq(testfilename, funcs.bufname(2)) + end) + + it('does not dump unnamed buffers', function() + set_additional_cmd('set shada+=% hidden') + reset() + curbufmeths.set_line(0, 'foo') + nvim_command('enew') + curbufmeths.set_line(0, 'bar') + eq(2, funcs.bufnr('$')) + nvim_command('qall!') + reset() + eq(1, funcs.bufnr('$')) + eq('', funcs.bufname(1)) + end) end) |