# Repeat Function for Vim ## Metadata **Status**:: #x **Zettel**:: #zettel/fleeting **Created**:: [[2023-07-29]] **Topic**:: [[♯ Vim]] ## Synopsis > [!help] repeat({expr}, {count}) > > Repeat {expr} {count} times and return the concatenated > result. Example: > > :let separator = repeat('-', 80) > > When {count} is zero or negative the result is empty. > > When {expr} is a |List| or a |Blob| the result is {expr} > concatenated {count} times. Example: > > :let longlist = repeat(['a', 'b'], 3) > > Results in ['a', 'b', 'a', 'b', 'a', 'b']. > > Can also be used as a |method|: > > mylist-> repeat(count) Neovim ```lua print(vim.inspect(vim.api.nvim_call_function("repeat", {{'-'}, 2}))) print(vim.inspect(vim.fn.repeat({'-'}, 2))) ```