配置Linux下的vimrc

    Linux下vim的配置文件vimrc给编程者带来了诸多的方便,笔者简单介绍一下自己的配置。以Ubuntn系统为例,Ubuntn系统的配置文件一般是放置根目录下/etc/vim/vimrc里面


打开vimrc文件

 1 " All system-wide defaults are set in $VIMRUNTIME/debian.vim (usually just
  2 " /usr/share/vim/vimcurrent/debian.vim) and sourced by the call to :runtime
  3 " you can find below.  If you wish to change any of those settings, you should
  4 " do it in this file (/etc/vim/vimrc), since debian.vim will be overwritten
  5 " everytime an upgrade of the vim packages is performed.  It is recommended to
  6 " make changes after sourcing debian.vim since it alters the value of the
  7 " 'compatible' option.
  8 
  9 " This line should not be removed as it ensures that various options are
 10 " properly set to work with the Vim-related packages available in Debian.
 11 runtime! debian.vim
 12 
 13 " Uncomment the next line to make Vim more Vi-compatible
 14 " NOTE: debian.vim sets 'nocompatible'.  Setting 'compatible' changes numerous
 15 " options, so any other options should be set AFTER setting 'compatible'.
 16 "set compatible
 17 
 18 " Vim5 and later versions support syntax highlighting. Uncommenting the next
 19 " line enables syntax highlighting by default.
 20 if has("syntax")
 21   syntax on
 22 endif
 23 
 24 " If using a dark background within the editing area and syntax highlighting

 25 " turn on this option as well

26 "set background=dark
 27 
 28 " Uncomment the following to have Vim jump to the last position when
 29 " reopening a file
 30 "if has("autocmd")
 31 "  au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g    '\"" | endif
 32 "endif
 33 
 34 " Uncomment the following to have Vim load indentation rules and plugins
 35 " according to the detected filetype.
 36 "if has("autocmd")
 37 "  filetype plugin indent on
 38 "endif
 39 
 40 " The following are commented out as they cause vim to behave a lot
 41 " differently from regular Vi. They are highly recommended though.
 42 "set showcmd        " Show (partial) command in status line.
 43 "set showmatch      " Show matching brackets.
 44 "set ignorecase     " Do case insensitive matching

 45 "set smartcase      " Do smart case matching

 46 "set incsearch      " Incremental search
 47 "set autowrite      " Automatically save before commands like :next and :make
 48 "set hidden             " Hide buffers when they are abandoned
 49 "set mouse=a        " Enable mouse usage (all modes)
 50 
 51 set autoindent
 52 set shiftwidth=4
 53 set tabstop=4
 54 set number
 55 
 56 set hlsearch
 57 
 58 set background=dark
 59 
 60 " Source a global configuration file if available
 61 if filereadable("/etc/vim/vimrc.local")
 62   source /etc/vim/vimrc.local

 63 endif

笔者觉得最有用的也就是下面的几行了


设置自动缩进

设置回车为4个长度

设置Tab为四个长度

设置行号


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值