zoukankan      html  css  js  c++  java
  • vim+astyle安装使用

    astyle下载安装

    wget https://sourceforge.net/projects/astyle/files/astyle/astyle%203.1/astyle_3.1_linux.tar.gz
    tar -zxvf astyle_3.1_linux.tar.gz
    cd astyle/
    cd build
    cmake ..
    make
    make all
    make install
    

    配置环境

    vim ~/.bashrc
    

    将以下内容考入该文件

    export PATH=$PATH:~/software/astyle/astyle/build/
    

    使配置生效

    source ~/.bashrc
    

    打开.vimrc,将以下内容考进该文件

    let g:formatdef_my_cpp = '"astyle --style=google"'
    let g:formatters_cpp = ['my_cpp']
    au BufWrite * :Autoformat
    

    最后一行意味着退出文件就会自动保存,在写python文件时可能带来错误,因此可以只考前两行,使用时使用命令

    astyle main.cpp
    

    main.cpp是你要格式化的文件。

  • 相关阅读:
    IT知识构架与操作系统简介
    read与for循环语句
    shell基础练习题
    shell 100以内加法
    shell
    python学习第一日
    shell脚本基本介绍
    bash的基本特性
    Linux习题
    Linux基本命令
  • 原文地址:https://www.cnblogs.com/qujingtongxiao/p/10201569.html
Copyright © 2011-2022 走看看