aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2015-10-23 13:58:02 +0300
committerZyX <kp-pav@yandex.ru>2015-10-23 14:47:59 +0300
commit7a1090eef54800c42086610b5ed9b373ce8af3ec (patch)
treee9fd646a44f1125971084acc016310359a942d1e
parentea2fe5255202b7fe169c5196a3a47138eaf947ba (diff)
downloadrneovim-7a1090eef54800c42086610b5ed9b373ce8af3ec.tar.gz
rneovim-7a1090eef54800c42086610b5ed9b373ce8af3ec.tar.bz2
rneovim-7a1090eef54800c42086610b5ed9b373ce8af3ec.zip
shada: Run set_last_cursor before writing shada file
-rw-r--r--runtime/doc/motion.txt3
-rw-r--r--runtime/doc/starting.txt2
-rw-r--r--src/nvim/shada.c9
3 files changed, 13 insertions, 1 deletions
diff --git a/runtime/doc/motion.txt b/runtime/doc/motion.txt
index 2e8f0801dc..3757a46fe2 100644
--- a/runtime/doc/motion.txt
+++ b/runtime/doc/motion.txt
@@ -877,7 +877,8 @@ was made yet in the current file.
for each opened file.
Only one position is remembered per buffer, not one
for each window. As long as the buffer is visible in
- a window the position won't be changed.
+ a window the position won't be changed. Mark is also
+ reset when |:wshada| is run.
*'^* *`^*
'^ `^ To the position where the cursor was the last time
diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt
index 84bd70db62..6ee95a94f4 100644
--- a/runtime/doc/starting.txt
+++ b/runtime/doc/starting.txt
@@ -1169,6 +1169,8 @@ running) you have additional options:
cannot write ShaDa file!" check that no old temp files
were left behind (e.g. ~/.nvim/shada/main.shada.tmp*).
+ Note: Executing :wshada will reset all |'quote| marks.
+
*:wv* *:wviminfo*
:wv[iminfo][!] [file] Deprecated alias to |:wshada| command.
diff --git a/src/nvim/shada.c b/src/nvim/shada.c
index 523f8db6f0..93a40fa736 100644
--- a/src/nvim/shada.c
+++ b/src/nvim/shada.c
@@ -2433,6 +2433,15 @@ static ShaDaWriteResult shada_write(ShaDaWriteDef *const sd_writer,
msgpack_packer *const packer = msgpack_packer_new(sd_writer,
&msgpack_sd_writer_write);
+ // Set b_last_cursor for all the buffers that have a window.
+ //
+ // It is needed to correctly save '"' mark on exit. Has a side effect of
+ // setting '"' mark in all windows on :wshada to the current cursor
+ // position (basically what :wviminfo used to do).
+ FOR_ALL_TAB_WINDOWS(tp, wp) {
+ set_last_cursor(wp);
+ }
+
FOR_ALL_BUFFERS(buf) {
if (buf->b_ffname != NULL && shada_removable((char *) buf->b_ffname)) {
int kh_ret;