I'm writing a vim function to set hard tabs and refactor indents in a whole file.This is the function:function RefInd()    :set tabstop=4 softtabstop=0 noexpandtab shiftwidth=4    gg=GendfunctionAnd this is the error:Error executing the function RefInd:Line 2:E492: Not an editor command: ^Igg=GPress ENTER or type command to continueAny help?
Function to refactor indents and tabs
vimscript;indentation;functions
The problem is that gg, = and G are normal mode commands, as opposed to ex commands which are used within a script.Writing normal gg=G should solve your problem.As @Carpetsmoker has pointed out in his comment, using normal! instead of normal might be prudent to avoid running user-defined mappings by accident.See also :help :normal.