我创建了/usr/share/vim/vim73/ftplugin/rb.vim
包含以下内容的文件;
set ts=2 " Set tab size to 2
set bs=2 " Suggested for ruby
set sw=2 " Suggested for ruby
set et " Convert tabs into spaces
set fdm=marker " Enable code block folding
Run Code Online (Sandbox Code Playgroud)
我的内容/etc/vim/vimrc
如下;
syntax on " Enable syntax highlighting
set number " Enable line numbers
set ts=4 " Set tab width to 4 spaces
set nocompatible " Disable compatibility mode (prevent ABCD key bugs)
colorscheme kolor " Set the color scheme
filetype plugin on " Enable filetype plugins (from http://bit.ly/GVfznk)
Run Code Online (Sandbox Code Playgroud)
我添加了这个超级用户问题中的filetype plugin on
行,但它似乎没有改变任何东西。我可以确认文件的加载,因为在键入时,返回该行,表明它已工作。/etc/vim/vimrc
:filetype
filetype detection:ON plugin:ON indent:OFF
运行:scriptnames
返回以下内容;
1: /usr/share/vim/vimrc
2: /usr/share/vim/vim73/syntax/syntax.vim
3: /usr/share/vim/vim73/syntax/synload.vim
4: /usr/share/vim/vim73/syntax/syncolor.vim
5: /usr/share/vim/vim73/filetype.vim
6: /usr/share/vim/vim73/colors/kolor.vim
7: /usr/share/vim/vim73/ftplugin.vim
8: /usr/share/vim/vim73/plugin/getscriptPlugin.vim
9: /usr/share/vim/vim73/plugin/gzip.vim
10: /usr/share/vim/vim73/plugin/matchparen.vim
11: /usr/share/vim/vim73/plugin/netrwPlugin.vim
12: /usr/share/vim/vim73/plugin/rrhelper.vim
13: /usr/share/vim/vim73/plugin/spellfile.vim
14: /usr/share/vim/vim73/plugin/tarPlugin.vim
15: /usr/share/vim/vim73/plugin/tohtml.vim
16: /usr/share/vim/vim73/plugin/vimballPlugin.vim
17: /usr/share/vim/vim73/plugin/zipPlugin.vim
Run Code Online (Sandbox Code Playgroud)
问题是,当我执行以下操作时,我得到了全尺寸的标签并且没有代码折叠;
touch example.rb
vi example.rb
Run Code Online (Sandbox Code Playgroud)
永远不要在/usr/share/vim/
或 中做任何事情(添加/删除/更改)/etc/vim/
。绝不。
这些是运行时文件:
$HOME
.始终在~/.vim/
目录和~/.vimrc
文件中进行自定义。
/usr/share/vim/vim73/ftplugin/rb.vim
应该是~/.vim/after/ftplugin/ruby.vim
。
在该文件中,您应该使用setlocal
而不是set
因为特定于文件类型的设置应该尽可能精确和本地化。
您输入的内容/etc/vim/vimrc
应该是~/.vimrc
:您应该删除这些行并返回/etc/vim/vimrc
其原始状态。
无论您在/etc/vim/
或 中做了/usr/share/vim
什么,请尽快将其还原。
归档时间: |
|
查看次数: |
916 次 |
最近记录: |