【TEST】NOI-Linux可用 gedit c++精简配置 附Emacs日常配置

这里是backup的测试随笔,用于测试 CSS / Markdown 效果。
同时也是是本菜鸡考场上一般使用的Gedit配置。
只有6行,挺短的。应该算好记吧。
使用之前记得勾选首选项里的外部工具。
再去找Manage External Tools。
Gedit大法好!Gedit大法好!Gedit大法好!
UPD:
已经变成Emacs党。。。所以也贴一下Emacs配置
当然是蒯的
下面的话是某人要挟我写的。。。
蒯自Brave_Cattle的博客
传送门: https://www.cnblogs.com/BCOI/p/8834924.html


``` (setq default-tab-width 4) (setq indent-tabs-mode nil) ;;------------语言环境字符集设置(utf-8)-------------

(set-language-environment 'Chinese-GB)
(set-keyboard-coding-system 'utf-8)
(set-clipboard-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-buffer-file-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-selection-coding-system 'utf-8)
(modify-coding-system-alist 'process "*" 'utf-8)
(setq default-process-coding-system '(utf-8 . utf-8))
(setq-default pathname-coding-system 'utf-8)
(set-file-name-coding-system 'utf-8)
(setq ansi-color-for-comint-mode t)
;;处理shell-mode乱码,好像没作用

;;------语言环境字符集设置结束------------

;;--------------窗口界面设置------------------

(set-foreground-color "grey")
(set-background-color "black")
(set-cursor-color "gold1")
(set-mouse-color "gold1")

(set-scroll-bar-mode nil)
;;取消滚动栏

;;(customize-set-variable 'scroll-bar-mode 'right))
;;设置滚动栏在窗口右侧,而默认是在左侧

(tool-bar-mode nil)
;;取消工具栏

;;启动设置
(setq default-frame-alist
'((vertical-scroll-bars)
(top . 25)
(left . 45)
(width . 120)
(height . 40)
(background-color . "black")
(foreground-color . "grey")
(cursor-color . "gold1")
(mouse-color . "gold1")
(tool-bar-lines . 0)
(menu-bar-lines . 1)
(right-fringe)
(left-fringe)))

;;启动自动最大化(数据自己调整,注意格式,如(top . 0),圆点前后都要留有空格)
;;(setq initial-frame-alist '((top . 0) (left . 0) (width . 142) (height . 49)))

;; 设置另外一些颜色:语法高亮显示的背景和主题,区域选择的背景和主题,二次选择的背景和选择
(set-face-foreground 'highlight "white")
(set-face-background 'highlight "blue")
(set-face-foreground 'region "cyan")
(set-face-background 'region "blue")
(set-face-foreground 'secondary-selection "skyblue")
(set-face-background 'secondary-selection "darkblue")

;;------------窗口界面设置结束-----------------

;;----------日历设置--------------------

;;设置日历的一些颜色
(setq calendar-load-hook
'(lambda ()
(set-face-foreground 'diary-face "skyblue")
(set-face-background 'holiday-face "slate blue")
(set-face-foreground 'holiday-face "white")))

;;设置我所在地方的经纬度,calendar里有个功能是日月食的预测,和你的经纬度相联系的。
;; 让emacs能计算日出日落的时间,在 calendar 上用 S 即可看到
(setq calendar-latitude +39.54)
(setq calendar-longitude +116.28)
(setq calendar-location-name "北京")

;; 设置阴历显示,在 calendar 上用 pC 显示阴历
(setq chinese-calendar-celestial-stem
["甲" "乙" "丙" "丁" "戊" "己" "庚" "辛" "壬" "癸"])
(setq chinese-calendar-terrestrial-branch
["子" "丑" "寅" "卯" "辰" "巳" "戊" "未" "申" "酉" "戌" "亥"])

;; 设置 calendar 的显示
(setq calendar-remove-frame-by-deleting t)
(setq calendar-week-start-day 1) ; 设置星期一为每周的第一天
(setq mark-diary-entries-in-calendar t) ; 标记calendar上有diary的日期
(setq mark-holidays-in-calendar nil) ; 为了突出有diary的日期,calendar上不标记节日
(setq view-calendar-holidays-initially nil) ; 打开calendar的时候不显示一堆节日

;; 去掉不关心的节日,设定自己在意的节日,在 calendar 上用 h 显示节日
(setq christian-holidays nil)
(setq hebrew-holidays nil)
(setq islamic-holidays nil)
(setq solar-holidays nil)
(setq general-holidays '((holiday-fixed 1 1 "元旦")
(holiday-fixed 2 14 "情人节")
(holiday-fixed 3 14 "白色情人节")
(holiday-fixed 4 1 "愚人节")
(holiday-fixed 5 1 "劳动节")
(holiday-float 5 0 2 "母亲节")
(holiday-fixed 6 1 "儿童节")
(holiday-float 6 0 3 "父亲节")
(holiday-fixed 7 1 "建党节")
(holiday-fixed 8 1 "建军节")
(holiday-fixed 9 10 "教师节")
(holiday-fixed 10 1 "国庆节")
(holiday-fixed 12 25 "圣诞节")))

;;Calendar模式支持各种方式来更改当前日期
;;(这里的“前”是指还没有到来的那一天,“后”是指已经过去的日子)
;; q 退出calendar模式
;; C-f 让当前日期向前一天
;; C-b 让当前日期向后一天
;; C-n 让当前日期向前一周
;; C-p 让当前日期向后一周
;; M-} 让当前日期向前一个月
;; M-{ 让当前日期向后一个月
;; C-x ] 让当前日期向前一年
;; C-x [ 让当前日期向后一年
;; C-a 移动到当前周的第一天
;; C-e 移动到当前周的最后一天
;; M-a 移动到当前月的第一天
;; M-e 多动到当前月的最后一天
;; M-< 移动到当前年的第一天
;; M-> 移动到当前年的最后一天

;;Calendar模式支持移动多种移动到特珠日期的方式
;; g d 移动到一个特别的日期
;; o 使某个特殊的月分作为中间的月分
;; . 移动到当天的日期
;; p d 显示某一天在一年中的位置,也显示本年度还有多少天。
;; C-c C-l 刷新Calendar窗口

;; Calendar支持生成LATEX代码。
;; t m 按月生成日历
;; t M 按月生成一个美化的日历
;; t d 按当天日期生成一个当天日历
;; t w 1 在一页上生成这个周的日历
;; t w 2 在两页上生成这个周的日历
;; t w 3 生成一个ISO-SYTLE风格的当前周日历
;; t w 4 生成一个从周一开始的当前周日历
;; t y 生成当前年的日历

;;EMACS Calendar支持配置节日:
;; h 显示当前的节日
;; x 定义当天为某个节日
;; u 取消当天已被定义的节日
;; e 显示所有这前后共三个月的节日。
;; M-x holiday 在另外的窗口的显示这前后三个月的节日。

;; 另外,还有一些特殊的,有意思的命令:
;; S 显示当天的日出日落时间(是大写的S)
;; p C 显示农历可以使用
;; g C 使用农历移动日期可以使用

;;-----------日历设置结束----------------
;;-----------日记设置---------------------

(setq diary-file "~/diary/diary");; 默认的日记文件
(setq diary-mail-addr "whuchenxi2010@gmail.com")
;;(add-hook 'diary-hook 'appt-make-list)
;;当你创建了一个'~/diary'文件,你就可以使用calendar去查看里面的内容。你可以查看当天的事件,相关命令如下 :
;; d 显示被选中的日期的所有事件
;; s 显示所有事件,包括过期的,未到期的等等

;; 创建一个事件的样例:
;; 02/11/1989
;; Bill B. visits Princeton today
;; 2pm Cognitive Studies Committee meeting
;; 2:30-5:30 Liz at Lawrenceville
;; 4:00pm Dentist appt
;; 7:30pm Dinner at George's
;; 8:00-10:00pm concert

;; 创建事件的命令:
;; i d 为当天日期添加一个事件
;; i w 为当天周创建一个周事件
;; i m 为当前月创建一个月事件
;; i y 为当前年创建一个年事件
;; i a 为当前日期创建一个周年纪念日
;; i c 创建一个循环的事件

;;----------日记设置结束-----------------

;;-------------方便编程操作设置----------------

;;代码折叠
(load-library "hideshow")
(add-hook 'c-mode-hook 'hs-minor-mode)
(add-hook 'c++-mode-hook 'hs-minor-mode)
(add-hook 'java-mode-hook 'hs-minor-mode)
(add-hook 'perl-mode-hook 'hs-minor-mode)
(add-hook 'php-mode-hook 'hs-minor-mode)
(add-hook 'emacs-lisp-mode-hook 'hs-minor-mode)
;;能把一个代码块缩起来,需要的时候再展开
;; M-x hs-minor-mode
;; C-c @ ESC C-s show all
;; C-c @ ESC C-h hide all
;; C-c @ C-s show block
;; C-c @ C-h hide block
;; C-c @ C-c toggle hide/show

(global-linum-mode t)

;;把c语言风格设置为k&r风格
(add-hook 'c-mode-hook
'(lambda ()
(c-set-style "k&r")))

(autoload 'css-mode "css-mode" "CSS editing mode" t)
;;css-mode.el编辑css文件

(autoload 'htmlize-buffer "htmlize" "HTMLize mode" t)
;;把buffer的内容连同颜色转为html格式

(autoload 'folding-mode "folding" "Folding mode" t)
(autoload 'turn-off-folding-mode "folding" "Folding mode" t)
(autoload 'turn-on-folding-mode "folding" "Folding mode" t)
;;folding.el 编辑文本的一部分,其它部分折叠起来

(setq auto-mode-alist
;; 将文件模式和文件后缀关联起来
(append '(("\.py\'" . python-mode)
("\.s?html?\'" . html-helper-mode)
("\.asp\'" . html-helper-mode)
("\.phtml\'" . html-helper-mode)
("\.css\'" . css-mode))
auto-mode-alist))

(defun my-compile()
(interactive)
(save-some-buffers t)
(let((file(file-name-nondirectory buffer-file-name)))
(compile(format "g++ %s -g -lm -pg -std=c++11 -O2 -o %s" file(file-name-sans-extension file))))
)

(global-linum-mode t)
(global-set-key [f9] 'my-compile)

(set-frame-parameter (selected-frame) 'alpha '(85 50))
(add-to-list 'default-frame-alist '(alpha (85 50)))

(defun toggle-transparency ()
(interactive)
(let ((alpha (frame-parameter nil 'alpha)))
(set-frame-parameter
nil 'alpha
(if (eql (cond ((numberp alpha) alpha)
((numberp (cdr alpha)) (cdr alpha))
;; Also handle undocumented ( ) form.
((numberp (cadr alpha)) (cadr alpha)))
100)
'(85 50) '(100 100)))))
(global-set-key (kbd "C-c t") 'toggle-transparency)

(setq c-default-style
'((java-mode . "java")(other . "awk")))

;;------------方便编程操作设置结束--------------------
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(blink-cursor-mode nil)
'(cua-mode t nil (cua-base))
'(show-paren-mode t))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(default ((t (:family "Monaco" :foundry "APPL" :slant normal :weight normal :height 110 :width normal)))))

;;在标题栏显示buffer的名字(默认不显示)
(setq frame-title-format "%b@emacs")

;;显示匹配括号
(show-paren-mode t)
(setq show-paren-style 'parentheses)

;;全选
(global-set-key (kbd "C-a") 'mark-whole-buffer)

;滚动页面时比较舒服,不要整页的滚动
(setq scroll-step 1
scroll-margin 3
scroll-conservatively 10000)

;;打开代码折叠功能
(add-hook 'c-mode-hook 'hs-minor-mode)
(add-hook 'c++-mode-hook 'hs-minor-mode)

<hr/>

!/bin/sh

fullname=$GEDIT_CURRENT_DOCUMENT_NAME
name=echo $fullname | cut -d. -f1
g++ $fullname -o $name -lm
if [ \(? -ne 0 ] then exit 0 fi dir=\)GEDIT_CURRENT_DOCUMENT_DIR
gnome-terminal --hide-menubar --working-directory=$dir -x bash -c "time \(dir/\)name;echo;echo 'Press Any Key To Continue.';read;"

<hr/>
附带A+B Problem
```cpp
#include<cstdio>
#include<iostream>
using namespace std;
int main()
{
    int a,b;cin>>a>>b;
    cout<<a+b<<endl;
    return 0;
}
posted @ 2018-04-14 21:26  backup_noooob  阅读(489)  评论(1编辑  收藏  举报