aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/shada.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-08-09 17:13:44 +0800
committerGitHub <noreply@github.com>2022-08-09 17:13:44 +0800
commitcd14efd281c260c92936f05bf5f91780f8912f81 (patch)
tree29b7778ae35f57f8c260f5e34dbb38a050929285 /src/nvim/shada.c
parenta5e846b9969b1dfbd7e92f437f3ac7905039b84f (diff)
downloadrneovim-cd14efd281c260c92936f05bf5f91780f8912f81.tar.gz
rneovim-cd14efd281c260c92936f05bf5f91780f8912f81.tar.bz2
rneovim-cd14efd281c260c92936f05bf5f91780f8912f81.zip
vim-patch:8.1.1823: command line history code is spread out (#19688)
Problem: Command line history code is spread out. Solution: Put the code in a new file. (Yegappan Lakshmanan, closes vim/vim#4779) Also graduate the +cmdline_hist feature. https://github.com/vim/vim/commit/d7663c22c6c1ff0f86b81371586fbc851d3a3e9e
Diffstat (limited to 'src/nvim/shada.c')
-rw-r--r--src/nvim/shada.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/nvim/shada.c b/src/nvim/shada.c
index 6e80b550d8..ee5322752f 100644
--- a/src/nvim/shada.c
+++ b/src/nvim/shada.c
@@ -16,11 +16,12 @@
#include "nvim/ascii.h"
#include "nvim/buffer.h"
#include "nvim/buffer_defs.h"
+#include "nvim/cmdhist.h"
#include "nvim/eval/decode.h"
#include "nvim/eval/encode.h"
#include "nvim/eval/typval.h"
+#include "nvim/ex_cmds.h"
#include "nvim/ex_docmd.h"
-#include "nvim/ex_getln.h"
#include "nvim/fileio.h"
#include "nvim/garray.h"
#include "nvim/globals.h"
@@ -2451,6 +2452,27 @@ static inline void find_removable_bufs(khash_t(bufset) *removable_bufs)
}
}
+/// Translate a history type number to the associated character
+static int hist_type2char(const int type)
+ FUNC_ATTR_CONST
+{
+ switch (type) {
+ case HIST_CMD:
+ return ':';
+ case HIST_SEARCH:
+ return '/';
+ case HIST_EXPR:
+ return '=';
+ case HIST_INPUT:
+ return '@';
+ case HIST_DEBUG:
+ return '>';
+ default:
+ abort();
+ }
+ return NUL;
+}
+
/// Write ShaDa file
///
/// @param[in] sd_writer Structure containing file writer definition.