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