summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2015-04-21 13:40:14 +0100
committerMaxime Coste <frrrwww@gmail.com>2015-04-21 13:40:14 +0100
commit4bb1e0a8780afd93d5148e900ef1eb03a37789cd (patch)
treea3debbdf79e9dc6131b078e7fce144a07319e701 /src
parent1d40827da3af3c112a3a63ba1676d66cd5511802 (diff)
Support -buffer * to iterate over all buffers in :eval or :exec
Diffstat (limited to 'src')
-rw-r--r--src/commands.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/commands.cc b/src/commands.cc
index 0d75d61f..8f6fff70 100644
--- a/src/commands.cc
+++ b/src/commands.cc
@@ -1160,9 +1160,7 @@ void context_wrap(const ParametersParser& parser, Context& context, Func func)
ClientManager& cm = ClientManager::instance();
if (auto bufnames = parser.get_switch("buffer"))
{
- for (auto& name : split(*bufnames, ','))
- {
- Buffer& buffer = BufferManager::instance().get_buffer(name);
+ auto context_wrap_for_buffer = [&](Buffer& buffer) {
InputHandler input_handler{{ buffer, Selection{} },
Context::Flags::Transient};
Context& c = input_handler.context();
@@ -1172,7 +1170,13 @@ void context_wrap(const ParametersParser& parser, Context& context, Func func)
ScopedDisable keymaps_disable(c.keymaps_support(), disable_keymaps);
func(parser, c);
- }
+ };
+ if (*bufnames == "*")
+ for (auto buffer : BufferManager::instance())
+ context_wrap_for_buffer(*buffer);
+ else
+ for (auto& name : split(*bufnames, ','))
+ context_wrap_for_buffer(BufferManager::instance().get_buffer(name));
return;
}