ubuntu下Vi编辑器的配置

来源:互联网 发布:mac safari 插件管理 编辑:程序博客网 时间:2024/05/17 23:55
          1、安装vim
       sudo apt-get install vim
          2、在终端打开配置文件,使用命令:
xiaojingling@ubuntu:~$ vim /etc/vim/vimrc
      
  3设置语法高亮显示
       打开vimrc,添加以下语句来使得语法高亮显示:
syntax on
          4、设置Windows风格的C/C++自动缩进(添加 以下set语句到vimrc中)
              1设置(软)制表符宽度为4
                            set tabstop=4
                            set softtabstop=4
              2设置缩进的空格数为4
                          set shiftwidth=4
              3设置自动缩进即每行的缩进值与上一行相等;使用 noautoindent 取 消设置:
set autoindent
              4设 置使用 C/C++ 语言的自动缩进方式:
                          set cindent
              5)设置C/C++语言的具体缩进方式
                            set cinoptions={0,1s,t0,n-2,p2s,(03s,=.5s,>1s,=1s,:1s
              6)如果想在左侧显示文本的行号,可以用以下语句:
                          set nu
         5、在vi编辑器中使用鼠标定位,添加下面语句:
                         set mouse=a