aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/fileio.c
diff options
context:
space:
mode:
authorGregory Anders <8965202+gpanders@users.noreply.github.com>2022-04-25 08:44:18 -0600
committerGitHub <noreply@github.com>2022-04-25 08:44:18 -0600
commit2dddc86a42a77bd099a031165e57add84b9b0e82 (patch)
tree3c94c7606c30e172d6dd28f375d9e4c2c422bc1c /src/nvim/fileio.c
parent440b65c338a7ab18e4ed2256d411cf0d3ce698c4 (diff)
downloadrneovim-2dddc86a42a77bd099a031165e57add84b9b0e82.tar.gz
rneovim-2dddc86a42a77bd099a031165e57add84b9b0e82.tar.bz2
rneovim-2dddc86a42a77bd099a031165e57add84b9b0e82.zip
fix: show autocmd output when F is in shortmess (#18251)
The default value of including F in 'shortmess' has the unfortunate side effect of hiding output from autocommands. This is a common source of confusion and often leads people to think their autocommands are not working when they are. There is a small snippet in the docs for 'shortmess' indicating that the F flag suppresses autocmd output, but it's not easy to find if you don't already know to look for it. This commit removes that behavior of the F flag to make it only suppress file info when opening a new file.
Diffstat (limited to 'src/nvim/fileio.c')
-rw-r--r--src/nvim/fileio.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index 282e25e10e..25c99af41b 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -176,7 +176,7 @@ void filemess(buf_T *buf, char_u *name, char_u *s, int attr)
///
/// @return FAIL for failure, NOTDONE for directory (failure), or OK
int readfile(char_u *fname, char_u *sfname, linenr_T from, linenr_T lines_to_skip,
- linenr_T lines_to_read, exarg_T *eap, int flags)
+ linenr_T lines_to_read, exarg_T *eap, int flags, bool silent)
{
int fd = 0;
int newfile = (flags & READ_NEW);
@@ -472,10 +472,12 @@ int readfile(char_u *fname, char_u *sfname, linenr_T from, linenr_T lines_to_ski
return FAIL;
}
}
- if (dir_of_file_exists(fname)) {
- filemess(curbuf, sfname, (char_u *)new_file_message(), 0);
- } else {
- filemess(curbuf, sfname, (char_u *)_("[New DIRECTORY]"), 0);
+ if (!silent) {
+ if (dir_of_file_exists(fname)) {
+ filemess(curbuf, sfname, (char_u *)new_file_message(), 0);
+ } else {
+ filemess(curbuf, sfname, (char_u *)_("[New DIRECTORY]"), 0);
+ }
}
// Even though this is a new file, it might have been
// edited before and deleted. Get the old marks.
@@ -658,7 +660,7 @@ int readfile(char_u *fname, char_u *sfname, linenr_T from, linenr_T lines_to_ski
// Autocommands may add lines to the file, need to check if it is empty
wasempty = (curbuf->b_ml.ml_flags & ML_EMPTY);
- if (!recoverymode && !filtering && !(flags & READ_DUMMY)) {
+ if (!recoverymode && !filtering && !(flags & READ_DUMMY) && !silent) {
if (!read_stdin && !read_buffer) {
filemess(curbuf, sfname, (char_u *)"", 0);
}
@@ -1788,7 +1790,7 @@ failed:
return OK; // an interrupt isn't really an error
}
- if (!filtering && !(flags & READ_DUMMY)) {
+ if (!filtering && !(flags & READ_DUMMY) && !silent) {
add_quoted_fname((char *)IObuff, IOSIZE, curbuf, (const char *)sfname);
c = false;
@@ -5191,7 +5193,7 @@ void buf_reload(buf_T *buf, int orig_mode, bool reload_options)
curbuf->b_flags |= BF_CHECK_RO; // check for RO again
keep_filetype = true; // don't detect 'filetype'
if (readfile(buf->b_ffname, buf->b_fname, (linenr_T)0, (linenr_T)0,
- (linenr_T)MAXLNUM, &ea, flags) != OK) {
+ (linenr_T)MAXLNUM, &ea, flags, false) != OK) {
if (!aborting()) {
semsg(_("E321: Could not reload \"%s\""), buf->b_fname);
}