小编did*_*bom的帖子

如何在vim中修复损坏的自动缩进

我试图使用vim 7.2(在Windows XP上)自动缩进和格式化一些VHDL和Matlab代码.为此,我尝试使用"gg = G"命令.但是这不能正常工作.代码没有正确缩进.

举个例子,我有以下源代码,它已经正确缩进:

% 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
Run Code Online (Sandbox Code Playgroud)

如果我使用"gg = G"命令,我得到:

% This function is based on the code_g_generator() function
function [v_code] = get_code(n_code_number)
% There is no need to …
Run Code Online (Sandbox Code Playgroud)

vim code-formatting indentation auto-indent

5
推荐指数
1
解决办法
3260
查看次数

标签 统计

auto-indent ×1

code-formatting ×1

indentation ×1

vim ×1