" configure expanding of tabs for various file types
au BufRead,BufNewFile *.py set expandtab
au BufRead,BufNewFile *.c set expandtab
au BufRead,BufNewFile *.h set expandtab
au BufRead,BufNewFile Makefile* set noexpandtab
" --------------------------------------------------------------------------------
" configure editor with tabs and nice stuff...
" --------------------------------------------------------------------------------
set expandtab " enter spaces when tab is pressed
set textwidth=120 " break lines when line length increases
set tabstop=4 " use 4 spaces to represent tab
set softtabstop=4
set shiftwidth=4 " number of spaces to use for auto indent
set autoindent " copy indent from current line when starting a new line
" make backspaces more powerfull
set backspace=indent,eol,start
set ruler " show line and column number
syntax on " syntax highlighting
set showcmd " show (partial) command in status line
-----
" configure expanding of tabs for various file types
au BufRead,BufNewFile *.py set expandtab
au BufRead,BufNewFile *.c set noexpandtab
au BufRead,BufNewFile *.h set noexpandtab
au BufRead,BufNewFile Makefile* set noexpandtab
" --------------------------------------------------------------------------------
" configure editor with tabs and nice stuff...
" --------------------------------------------------------------------------------
set expandtab " enter spaces when tab is pressed
set textwidth=120 " break lines when line length increases
set tabstop=4 " use 4 spaces to represent tab
set softtabstop=4
set shiftwidth=4 " number of spaces to use for auto indent
set autoindent " copy indent from current line when starting a new line
set smartindent
set smarttab
set expandtab
set number
" make backspaces more powerfull
set backspace=indent,eol,start
set ruler " show line and column number
syntax on " syntax highlighting
set showcmd " show (partial) command in status line
7条答案
按热度按时间guykilcj1#
我在我的macbook上使用这个:
(编辑为仅显示与缩进/制表符相关的内容)
jhkqcmku2#
我用途:
但我还是要试试达伦的作品
fnvucqvd3#
更简单的选项:只需取消注解/etc/vim/vimrc文件中配置的以下部分(最初已注解掉):
jdzmm42g4#
我在python repo中使用了vimrc,其中包括:
http://svn.python.org/projects/python/trunk/Misc/Vim/vimrc
我还加
I have my old config here that I'm updating
uqxowvwt5#
确保为VIM编辑正确的配置文件。特别是在使用Windows时,文件可以命名为_vimrc,而不是其他平台上的.vimrc。
体内类型
:help vimrc
并使用以下命令检查_vimrc/.vimrc文件的路径
:echo $HOME
:echo $VIM
确保您只使用一个文件。如果您想将配置拆分成更小的块,您可以从_vimrc文件中获取其他文件。
:help source
yhived7q6#
结合Daren和Thanos提出的解决方案,我们得到了一个很好的.vimrc文件。
dxxyhpgq7#
对于更高级的python编辑,请考虑安装simplefold vim插件。它允许您使用正则表达式进行高级代码折叠。我用它来折叠我的类和方法定义,以便更快地编辑。