summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2012-06-12 18:27:57 +0000
committerMaxime Coste <frrrwww@gmail.com>2012-06-12 18:27:57 +0000
commitbc359d7c902a8131801fc78a415dc0a0b396807a (patch)
tree3f3b3af70264e38a0ef98423d93e4e9e80a12812 /src
parent20315eac859168238ad5228a910df499a0510164 (diff)
BufCreate hook is always called for every buffer, BufNew is called when creating a new file
Diffstat (limited to 'src')
-rw-r--r--src/buffer.cc4
-rw-r--r--src/rc/cpp.kak2
2 files changed, 4 insertions, 2 deletions
diff --git a/src/buffer.cc b/src/buffer.cc
index a1f943e8..59ece2ae 100644
--- a/src/buffer.cc
+++ b/src/buffer.cc
@@ -34,9 +34,11 @@ Buffer::Buffer(const String& name, Type type,
apply_modification(Modification::make_insert(begin(), initial_content));
if (type == Type::NewFile)
- m_hook_manager.run_hook("BufCreate", name, Context(*this));
+ m_hook_manager.run_hook("BufNew", name, Context(*this));
else if (type == Type::File)
m_hook_manager.run_hook("BufOpen", name, Context(*this));
+
+ m_hook_manager.run_hook("BufCreate", name, Context(*this));
}
Buffer::~Buffer()
diff --git a/src/rc/cpp.kak b/src/rc/cpp.kak
index 28db130e..41f4ebcc 100644
--- a/src/rc/cpp.kak
+++ b/src/rc/cpp.kak
@@ -11,7 +11,7 @@ hook global WinCreate .*\.(c|cc|cpp|cxx|C|h|hh|hpp|hxx|H) \
addfilter cleanup_whitespaces; \
hook window InsertEnd .* exec xs\h+(?=\n)<ret>d
-hook global BufCreate .*\.(h|hh|hpp|hxx|H) \
+hook global BufNew .*\.(h|hh|hpp|hxx|H) \
exec ggi<c-r>%<ret><esc>ggxs\.<ret>c_<esc><space>A_INCLUDED<esc>xyppI#ifndef<space><esc>jI#define<space><esc>jI#endif<space>//<space><esc>O<esc>
def alt edit \