gedit 外部工具——快捷运行

文本编辑器-首选项-插件-勾选“外部工具”

可快捷编译运行一些代码,适合新手使用。

配置如下。

  • 快捷键:F5
  • 保存:当前文档
  • 输入:无
  • 输出:无
  • 使用范围:所有文档,所有语言

脚本如下。

#!/bin/sh

dir=$GEDIT_CURRENT_DOCUMENT_DIR
name=$GEDIT_CURRENT_DOCUMENT_NAME
pre=${name%.*}
suffix=${name##*.}

case $suffix in
    c)
        gcc $dir/$name -o ${pre}.out
        [ $? ] && gnome-terminal -- bash -c "time '$dir/${pre}.out';echo;read;"
        ;;
    cpp)
        g++ $dir/$name -o ${pre}.out
        [ $? ] && gnome-terminal -- bash -c "time '$dir/${pre}.out';echo;read;"
        ;;
    go)
        go build $dir/$name
        [ $? ] && gnome-terminal -- bash -c "time '$dir/$pre';echo;read;"
        ;;
    py)
        gnome-terminal -- bash -c "time python3 '$dir/$name';echo;read;"
        ;;
    rs)
        rustc $dir/$name -o ${pre}.out
        [ $? ] && gnome-terminal -- bash -c "time '$dir/${pre}.out';echo;read;"
        ;;
    sh)
        chmod +x $name
        gnome-terminal -- bash -c "time '$dir/$name';echo;read;"
        ;;
esac

Gedit主题 monokai.xml

<?xml version="1.0" encoding="UTF-8"?>
<!--
 Copyright (C) 2009 tm2gtksw2(Alexandre da Silva)

 This file was generated from a textmate theme named Monokai
 with tm2gtksw2 tool. (Alexandre da Silva)

 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Library General Public
 License as published by the Free Software Foundation; either
 version 2 of the License, or (at your option) any later version.

 This library is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 Library General Public License for more details.

 You should have received a copy of the GNU Library General Public
 License along with this library; if not, write to the
 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.
-->
<style-scheme id="monokai" _name="Monokai" version="1.0">
  <author>tm2gtksw2(Alexandre da Silva)</author>
  <_description>GMate Theme - Generated from textmate theme with tm2gtksw2</_description>
  <style name="bracket-match"  background="#3e3d32" bold="true"/>
  <style name="bracket-mismatch"  background="#3e3d32" underline="true"/>
  <style name="css:at-rules" foreground="#f92672"/>
  <style name="css:color" foreground="#ae81ff"/>
  <style name="css:keyword" foreground="#66d9ef" italic="true"/>
  <style name="current-line"  background="#3e3d32"/>
  <style name="cursor" foreground="#f8f8f0"/>
  <style name="def:base-n-integer" foreground="#ae81ff"/>
  <style name="def:boolean" foreground="#ae81ff"/>
  <style name="def:builtin" foreground="#ae81ff"/>
  <style name="def:character" foreground="#ae81ff"/>
  <style name="def:comment" foreground="#75715e"/>
  <style name="def:complex" foreground="#ae81ff"/>
  <style name="def:decimal" foreground="#ae81ff"/>
  <style name="def:doc-comment" foreground="#75715e"/>
  <style name="def:doc-comment-element" foreground="#75715e"/>
  <style name="def:error" foreground="#f8f8f0" background="#f92672"/>
  <style name="def:floating-point" foreground="#ae81ff"/>
  <style name="def:function" foreground="#a6e22e"/>
  <style name="def:keyword" foreground="#f92672"/>
  <style name="def:note" foreground="#75715e"/>
  <style name="def:number" foreground="#ae81ff"/>
  <style name="def:operator" foreground="#f92672"/>
  <style name="def:preprocessor" foreground="#66d9ef"/>
  <style name="def:reserved" foreground="#f92672"/>
  <style name="def:shebang" foreground="#75715e"/>
  <style name="def:special-char" foreground="#66d9ef"/>
  <style name="def:special-constant" foreground="#ae81ff"/>
  <style name="def:statement" foreground="#f92672"/>
  <style name="def:string" foreground="#e6db74"/>
  <style name="def:type" foreground="#66d9ef" italic="true"/>
  <style name="draw-spaces" foreground="#3b3a32"/>
  <style name="html:dtd" foreground="#e6db74"/>
  <style name="html:tag" foreground="#f92672"/>
  <style name="js:function" foreground="#66d9ef"/>
  <style name="line-numbers" foreground="#f8f8f2" background="#3e3d32"/>
  <style name="perl:builtin" foreground="#a6e22e"/>
  <style name="perl:include-statement" foreground="#f92672"/>
  <style name="perl:special-variable" foreground="#ae81ff"/>
  <style name="php:string" foreground="#e6db74"/>
  <style name="python:builtin-constant" foreground="#f92672"/>
  <style name="python:builtin-function" foreground="#a6e22e"/>
  <style name="python:module-handler" foreground="#f92672"/>
  <style name="python:special-variable" foreground="#f92672"/>
  <style name="ruby:attribute-definition" foreground="#f92672"/>
  <style name="ruby:global-variable" foreground="#a6e22e"/>
  <style name="ruby:module-handler" foreground="#f92672"/>
  <style name="ruby:predefined-variable" foreground="#ae81ff"/>
  <style name="ruby:regex" foreground="#e6db74"/>
  <style name="ruby:special-variable" foreground="#f92672"/>
  <style name="ruby:symbol" foreground="#ae81ff"/>
  <style name="rubyonrails:attribute-definition" foreground="#f92672"/>
  <style name="rubyonrails:block-parameter" foreground="#fd971f" italic="true"/>
  <style name="rubyonrails:class-inherit" foreground="#a6e22e" underline="true" italic="true"/>
  <style name="rubyonrails:class-name" foreground="#66d9ef" italic="true"/>
  <style name="rubyonrails:complex-interpolation" foreground="#ae81ff"/>
  <style name="rubyonrails:global-variable" foreground="#a6e22e"/>
  <style name="rubyonrails:module-handler" foreground="#f92672"/>
  <style name="rubyonrails:module-name" foreground="#66d9ef" italic="true"/>
  <style name="rubyonrails:predefined-variable" foreground="#ae81ff"/>
  <style name="rubyonrails:regex" foreground="#e6db74"/>
  <style name="rubyonrails:simple-interpolation" foreground="#ae81ff"/>
  <style name="rubyonrails:special-variable" foreground="#f92672"/>
  <style name="rubyonrails:symbol" foreground="#ae81ff"/>
  <style name="search-match"  background="#3e3d32" bold="true" underline="true"/>
  <style name="selection" foreground="#f8f8f2" background="#49483e"/>
  <style name="text" foreground="#f8f8f2" background="#272822"/>
  <style name="xml:attribute-name" foreground="#a6e22e"/>
  <style name="xml:element-name" foreground="#f92672"/>
  <style name="xml:namespace" foreground="#f92672"/>
  <style name="xml:tag" foreground="#f92672"/>
</style-scheme>
posted @ 2019-09-25 17:19  一年`  阅读(508)  评论(0编辑  收藏  举报