‘Ubuntu’+‘Atom’+‘gcc-make-run’更改调试终端为Gnome-terminal

‘Ubuntu’+‘Atom’+‘gcc-make-run’更改调试终端为Gnome-terminal

0、为什么

在Ubuntu下安装了gcc-make-run插件后对C/C++代码编译运行。默认打开的是X-term,很丑而且。。。。。。算了就是很丑。

这里写图片描述

1、Ubuntu安装Atom

通过PPA安装

sudo add-apt-repository ppa:webupd8team/atom
sudo apt-get update
sudo apt-get install atom

2、相关插件的安装

2.1安装npm

sudo apt-get install npm

2.2命令行安装插件

windows:
cd Users/用户名/.atom/package
ubuntu:
cd ~/.atom/package
如果package文件夹不存在可以自己新建一个

git clone 插件的github仓库目录
cd 克隆下来的插件目录
npm install

2.3部分插件github仓库目录

atom-simplified-chinese-menu插件(汉化)
https://github.com/chinakids/atom-simplified-chinese-menu
gcc-make-run插件(C/C++编译插件)
https://github.com/tomlau10/gcc-make-run
linter-gcc插件(C/C++代码风格美化插件)
https://github.com/hebaishi/linter-gcc
linter插件
https://github.com/steelbrain/linter

3、修改配置文件

atom ~/.atom/package/gcc-make-run/lib/gcc-make-run.coffee

修改下列代码对应的部分,没接触过coffeescript,但是根据代码英文字母也能猜出来实际上就是修改when 'linux'...后面的代码内容。

buildRunCmd: (info) ->
    # get config
    mk = atom.config.get('gcc-make-run.make')
    info.env = _extend({ ARGS: atom.config.get('gcc-make-run.args') }, process.env)

    if info.useMake
      switch process.platform
        when 'win32' then info.cmd = "start \"#{info.exe}\" cmd /c \"\"#{mk}\" -sf \"#{info.base}\" run & pause\""
        when 'linux' then info.cmd = "gnome-terminal -t \"#{info.exe}\" -x \""  + @escdq("\"#{mk}\" -sf \"#{info.base}\" run") + "; read -n1 -p 'Press any key to continue...'\""
        when 'darwin' then info.cmd = 'osascript -e \'tell application "Terminal" to activate do script "' + @escdq("clear && cd \"#{info.dir}\"; \"#{mk}\" ARGS=\"#{@escdq(info.env.ARGS)}\" -sf \"#{info.base}\" run; " + 'read -n1 -p "Press any key to continue..." && osascript -e "tell application \\"Atom\\" to activate" && osascript -e "do shell script ' + @escdq("\"osascript -e #{@escdq('"tell application \\"Terminal\\" to close windows 0"')} + &> /dev/null &\"") + '"; exit') + '"\''
    else
      # normal run
      switch process.platform
        when 'win32' then info.cmd = "start \"#{info.exe}\" cmd /c \"\"#{info.exe}\" #{info.env.ARGS} & pause\""
        when 'linux' then info.cmd = "gnome-terminal -x bash -c \"#{info.dir}/#{info.exe} #{info.env.ARGS} ; exec bash\""
        when 'darwin' then info.cmd = 'osascript -e \'tell application "Terminal" to activate do script "' + @escdq("clear && cd \"#{info.dir}\"; \"./#{info.exe}\" #{info.env.ARGS}; " + 'read -n1 -p "Press any key to continue..." && osascript -e "tell application \\"Atom\\" to activate" && osascript -e "do shell script ' + @escdq("\"osascript -e #{@escdq('"tell application \\"Terminal\\" to close windows 0"')} + &> /dev/null &\"") + '"; exit') + '"\''

    # check if cmd is built
    return true if info.cmd?
    atom.notifications.addError('gcc-make-run: Cannot Execute Output', { detail: 'Execution after compiling is not supported on your OS' })
    return false

这里写图片描述

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值