我试图使用
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
如果我使用“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
如您所见,在此示例中,Vim在第一个“if”块之后错误地缩进代码.对于其他文件,我遇到类似的问题(虽然不一定在第一个if块上).
对于VHDL文件,我遇到了类似的问题.
我尝试过使用autoindent,smartindent和cindent设置的不同组合.通过这些论坛后,我还确保将“语法”,“文件类型”,“文件类型缩进”和“文件类型插件缩进”设置为打开.不过,它不起作用.另外,如果我“设置语法?”我为matlab文件获取“matlab”,为vhdl文件获取“vhdl”,这是正确的.如果我“设置indentexpr?”我为matlab文件获取“GetMatlabIndent(v:lnum)”,为vhdl文件获取“GetVHDLindent()”.
尝试通过在另一台计算机(之前从未安装过VIM)上全新安装VIM来隔离问题(并确保它不是由于我安装的其中一个vim插件).在那台电脑上,我遇到了同样的问题(这就是为什么我不认为我需要给你.vimrc,但如果你需要它我也可以在这里上传).
有任何想法吗?
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。