BufCreate hook is always called for every buffer, BufNew is called when creating a new file
This commit is contained in:
parent
20315eac85
commit
bc359d7c90
|
@ -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()
|
||||
|
|
|
@ -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 \
|
||||
|
|
Loading…
Reference in New Issue
Block a user