I am trying to use vim 7.2 (on Windows XP) to indent automatically and format some VHDL and Matlab codes. For this I am trying to use the command "gg = G". However, this does not work properly. The code has no indentation at all.
To give you an example, I had the following source code, which was already indented correctly:
% This function is based on the code_g_generator() function
function [v_code] = get_code(n_code_number)
% There is no need to clear the persistent variables in this function
mlock
%% Initialize the internal variables
persistent n_fifo_top;
if isempty(n_fifo_top)
n_fifo_top = 1;
end
N_MEMORY_SIZE = 4;
if n_code_number > 4
c_saved_code_fifo = {-1*ones(1, N_MEMORY_SIZE)};
end
If I use the command "gg = G", I get:
% This function is based on the code_g_generator() function
function [v_code] = get_code(n_code_number)
% There is no need to clear the persistent variables in this function
mlock
%% Initialize the internal variables
persistent n_fifo_top;
if isempty(n_fifo_top)
n_fifo_top = 1;
end
N_MEMORY_SIZE = 4;
if n_code_number > 4
c_saved_code_fifo = {-1*ones(1, N_MEMORY_SIZE)};
end
As you can see, in this example, Vim does not correctly postpone code after the first "if" block. For other files, similar problems arise (although not necessarily in the first if block).
VHDL files have similar problems.
autoindent, smartindent cindent. , , "", " ", "indtytytytytytytytytyty" "indent " . , . , ? "matlab" matlab "vhdl" vhdl, . "set indentexpr?" "GetMatlabIndent (v: lnum)" matlab "GetVHDLindent()" vhdl.
( , - vim, ), VIM ( VIM). ( , .vimrc, , ).
?