aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/buffer.c1
-rw-r--r--src/nvim/buffer_defs.h2
-rw-r--r--src/nvim/ex_cmds.c2
-rw-r--r--src/nvim/normal.c2
4 files changed, 7 insertions, 0 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 24ba43676a..ec86663f00 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -1618,6 +1618,7 @@ void enter_buffer(buf_T *buf)
if (!curbuf->b_help && curwin->w_p_spell && *curwin->w_s->b_p_spl != NUL) {
(void)did_set_spelllang(curwin);
}
+ curbuf->b_last_used = time(NULL);
redraw_later(NOT_VALID);
}
diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h
index 2460159fc0..3dbd3ea121 100644
--- a/src/nvim/buffer_defs.h
+++ b/src/nvim/buffer_defs.h
@@ -543,6 +543,8 @@ struct file_buffer {
long b_mtime_read; // last change time when reading
uint64_t b_orig_size; // size of original file in bytes
int b_orig_mode; // mode of original file
+ time_t b_last_used; // time when the buffer was last used; used
+ // for viminfo
fmark_T b_namedm[NMARKS]; // current named marks (mark.c)
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 1cd95f2ed9..f18395e6cc 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -2670,6 +2670,8 @@ int do_ecmd(
msg_scrolled_ign = FALSE;
}
+ curbuf->b_last_used = time(NULL);
+
if (command != NULL)
do_cmdline(command, NULL, NULL, DOCMD_VERBOSE);
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index 58993426dd..76de60cf4f 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -1260,6 +1260,8 @@ static void normal_redraw(NormalState *s)
maketitle();
}
+ curbuf->b_last_used = time(NULL);
+
// Display message after redraw. If an external message is still visible,
// it contains the kept message already.
if (keep_msg != NULL && !msg_ext_is_visible()) {