mirror of
https://github.com/neovim/neovim.git
synced 2025-10-03 00:18:33 +00:00
vim-patch:8.1.0401: can't get swap name of another buffer
Problem: Can't get swap name of another buffer.
Solution: Add swapname(). (Ozaki Kiichi, closes vim/vim#3441)
110bd60985
This commit is contained in:
@@ -16430,6 +16430,20 @@ static void f_swapinfo(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
get_b0_dict(tv_get_string(argvars), rettv->vval.v_dict);
|
||||
}
|
||||
|
||||
/// "swapname(expr)" function
|
||||
static void f_swapname(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
{
|
||||
rettv->v_type = VAR_STRING;
|
||||
buf_T *buf = tv_get_buf(&argvars[0], false);
|
||||
if (buf == NULL
|
||||
|| buf->b_ml.ml_mfp == NULL
|
||||
|| buf->b_ml.ml_mfp->mf_fname == NULL) {
|
||||
rettv->vval.v_string = NULL;
|
||||
} else {
|
||||
rettv->vval.v_string = vim_strsave(buf->b_ml.ml_mfp->mf_fname);
|
||||
}
|
||||
}
|
||||
|
||||
/// "synID(lnum, col, trans)" function
|
||||
static void f_synID(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
{
|
||||
|
Reference in New Issue
Block a user