# yet you need to install packages and check the simpc-mode as I have post at another acticle
# init.el @etcix --[latest label:deprecated]
;; pre init elisp conf
; mode 大全 start -----------------------------------------------------------------------------------------------------------------------------
(menu-bar-mode 1) ;; 隐藏菜单栏
(blink-cursor-mode 1) ;; 开启光标闪烁
(tool-bar-mode -1) ;yes ;; 隐藏工具栏
(scroll-bar-mode -1) ;yes ;; 滚动栏隐藏
(electric-indent-mode t) ;yes
(show-paren-mode t) ;; 括号配对
(electric-pair-mode t) ;; 自动补全括号
(global-hl-line-mode -1) ;; 高亮当前行
(global-auto-revert-mode 1) ;; 自动加载外部修改过的文件
(delete-selection-mode 1) ;; 当你选中一段文字 之后输入一个字符会替换掉你选中部分的文字。
(global-display-line-numbers-mode 1)
(delete-selection-mode t)
(global-company-mode t)
(auto-image-file-mode t) ;yes for image
(global-auto-revert-mode 1) ;yes for auto load this init.el file
(fset 'yes-or-no-p 'y-or-n-p) ;; 简化yes no
(setq-default cursor-type 'bar) ;; 设置光标为线状
(setq
frame-title-mode t ;; 在窗口的标题栏上显示文件名称
frame-title-format "filename: %b" ;; 设置标题栏
inhibit-splash-screen t ;yes ;; 关闭启动画面
gnus-inhibit-startup-message t ;; 关闭引导界面
make-backup-files nil ;; 关闭自动备份文件~
backup-inhibited t ;; 不产生备份
auto-save-mode nil ;; 自动保存模式
truncate-lines nil ;; 自动换行
transient-mark-mode t ;; 高亮显示选择区域
global-font-lock-mode t ;; 进行语法加亮
ring-bell-function 'ignore
show-paren-style 'parenthesis ;; 只高亮括号
require-final-newline t ;; 自动的在文件末增加一新行
track-eol t ;; 当光标在行尾上下移动的时候,始终保持在行尾。
c-default-style "awk" ;; 设置c++编译颜色风格
initial-frame-alist (quote ((fullscreen . maximized))) ;; 默认全屏
)
;end ---------------------------------------------------------------------------------------------------------------------------------------
; ui conf start ------------------------------------------------------------------------------------------------------------------------------
(load-theme 'monokai t)
(add-hook 'emacs-lisp-mode-hook 'show-paren-mode)
(global-hl-line-mode -1) ;or maybe no
;end ----------------------------------------------------------------------------------------------------------------------------------------
; tab f2 open config file start --------------------------------------------------------------------------------------------------------------
(defun open-my-init-file ()
(interactive)
(find-file "~/.emacs.d/init.el")
)
(global-set-key (kbd "<f2>") 'open-my-init-file)
;end -------------------------------------------------------------------------------------------------------------------------------------------
;; auto save code conf start ----------------------------------------------------------------------------------------------------------------
(defgroup auto-save nil
"Auto save file when emacs idle."
:group 'auto-save)
(defcustom auto-save-idle 0.1;;!!!!!!!!!!!!
"The idle seconds to auto save file."
:type 'integer
:group 'auto-save)
(defcustom auto-save-slient nil
"Nothing to dirty minibuffer if this option is non-nil."
:type 'boolean
:group 'auto-save)
(setq auto-save-default nil)
;; 前方高能核心代码, 请集中注意力
(defun auto-save-buffers ()
(interactive)
(let ((autosave-buffer-list))
(save-excursion
(dolist (buf (buffer-list))
(set-buffer buf)
(if (and (buffer-file-name) (buffer-modified-p))
(progn
(push (buffer-name) autosave-buffer-list)
(if auto-save-slient
(with-temp-message ""
(basic-save-buffer))
(basic-save-buffer))
)))
(unless auto-save-slient
(cond
((= (length autosave-buffer-list) 1)
(message "# Saved %s" (car autosave-buffer-list)))
((> (length autosave-buffer-list) 1)
(message "# Saved %d files: %s"
(length autosave-buffer-list)
(mapconcat 'identity autosave-buffer-list ", "))))))))
(defun auto-save-enable ()
(interactive)
(run-with-idle-timer auto-save-idle t #'auto-save-buffers))
(auto-save-enable);; 开启自动保存功能
(setq auto-save-slient t);; 自动保存的时候静悄悄的, 不要打扰我
;end ----------------------------------------------------------------------------------------------
;;; 别人的插件所有配置代码 start --------------------------------------------------------------------------------
(defvar plugin-home-dir "C:/Users/etcix/AppData/Roaming/.emacs.d/packages/")
;tsoding的c-mode,我不确定能不能使用 M-x simpc-mode
(add-to-list 'load-path (concat plugin-home-dir "simpc-mode"))
(require 'simpc-mode)
; org conf
(require 'org)
(setq org-src-fontify-natively t)
; recentf conf
(require 'recentf)
(recentf-mode 1)
(setq recentf-max-menu-items 25)
(global-set-key (kbd "\C-x\ \C-r") 'recentf-open-files)
;end ---------------------------------------------------------------------------------------------
; elpa package conf start --------------------------------------------------------------------------------------
(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.
'(company-idle-delay 0.08)
'(company-minimum-prefix-length 1)
'(package-selected-packages
'(evil quickrun popwin js2-mode swiper smex monokai-theme company)))
(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.
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; (when (>= emacs-major-version 24) ;;
;; (require 'package) ;;
;; (package-initialize) ;;
;; (add-to-list 'package-archives '("melpa","http://1.15.88.122/melpa/")) t) ;;
;; ;;
;; (require 'cl) ;;
;; ;; add self package here ;;
;; (defvar etcix/melpaplugins '( ;;
;; company ;;
;; ;;
;; monokai-theme ;;
;; ) "Default packages" ;;
;; ) ;;
;; ;;
;; (defun etcix/packages-installed-p () ;;
;; (loop for pkg in etcix/melpaplugins ;;
;; when (not (package-installed-p pkg)) ;;
;; do (return nil) ;;
;; finally (return t) ;;
;; ) ;;
;; ;;
;; ;;
;; (unless (etcix/packages-installed-p) ;;
;; (message "%s" "refreshing packages database...") ;;
;; (package-refresh-contents ) ;;
;; (dolist (pkg etcix/melpaplugins) ;;
;; (when (not (package-installed-p pkg) ;;
;; ) ;;
;; (package-install pkg) ;;
;; ) ;;
;; ) ;;
;; ) ;;
;; ;;
;; ) ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; M-x comment-box
; utsc源
(setq package-archives '(("gnu" . "https://mirrors.ustc.edu.cn/elpa/gnu/")
("melpa" . "https://mirrors.ustc.edu.cn/elpa/melpa/")
("nongnu" . "https://mirrors.ustc.edu.cn/elpa/nongnu/")))
;smex M-x 的增强
(require 'smex)
(smex-initialize)
(global-set-key (kbd "M-x") 'smex)
;swiper C-s improved
(ivy-mode 1)
(setq ivy-use-virtual-buffers t)
(global-set-key (kbd "C-s") 'swiper) ;C-s 调用swiper C-n / C-p 上下选择;C-x b 选择buffer;
(global-set-key (kbd "C-c C-r") 'ivy-resume)
; js2mode conf JS的类IDE to be delete
(setq auto-mode-alist
(append '((
"\\.js\\'" . js2-mode
))
auto-mode-alist))
;popwin 当你C-h f/v 查看帮助文档时,自动把光标跳入那里并且用q或C-g关闭窗口
(require 'popwin)
(popwin-mode t)
;emacs 自带的c/c++代码server插件
(require 'eglot)
(add-to-list 'eglot-server-programs '((c++-mode c-mode) "clangd"))
(add-hook 'c-mode-hook #'eglot-ensure)
(add-hook 'c++-mode-hook #'eglot-ensure)
; do not tap return key at the front of single ";"
;quickrun c++快速单文件编译
(require 'quickrun)
; but I don't know how to use
; vim模拟
(evil-mode -1)
;end ------------------------------------------------------------------------------------------------
;缩写展开 start ==============================================================================
;; not work on windows when I tab the SPACE key
;; (abbrev-mode t)
;; (define-abbrev-table 'global-abbrev-table '(
;; ("8me" "etcix")
;; ))
;end ====================================================================================
# on linux when som package not install, install by hand --[latest label: still works]
; mode 大全 start -----------------------------------------------------------------------------------------------------------------------------
(menu-bar-mode 1) ;; 隐藏菜单栏
(blink-cursor-mode 1) ;; 开启光标闪烁
(electric-indent-mode t) ;yes
(show-paren-mode t) ;; 括号配对
(electric-pair-mode t) ;; 自动补全括号
(global-hl-line-mode -1) ;; 高亮当前行
(global-auto-revert-mode 1) ;; 自动加载外部修改过的文件
(delete-selection-mode 1) ;; 当你选中一段文字 之后输入一个字符会替换掉你选中部分的文字。
(global-display-line-numbers-mode 1)
(delete-selection-mode t)
(auto-image-file-mode t) ;yes for image
(global-auto-revert-mode 1) ;yes for auto load this init.el file
(fset 'yes-or-no-p 'y-or-n-p) ;; 简化yes no
(setq-default cursor-type 'bar) ;; 设置光标为线状
(setq
frame-title-mode t ;; 在窗口的标题栏上显示文件名称
frame-title-format "filename: %b" ;; 设置标题栏
inhibit-splash-screen t ;yes ;; 关闭启动画面
gnus-inhibit-startup-message t ;; 关闭引导界面
make-backup-files nil ;; 关闭自动备份文件~
backup-inhibited t ;; 不产生备份
auto-save-mode nil ;; 自动保存模式
truncate-lines nil ;; 自动换行
transient-mark-mode t ;; 高亮显示选择区域
global-font-lock-mode t ;; 进行语法加亮
ring-bell-function 'ignore
show-paren-style 'parenthesis ;; 只高亮括号
require-final-newline t ;; 自动的在文件末增加一新行
track-eol t ;; 当光标在行尾上下移动的时候,始终保持在行尾。
c-default-style "awk" ;; 设置c++编译颜色风格
initial-frame-alist (quote ((fullscreen . maximized))) ;; 默认全屏
)
;end ---------------------------------------------------------------------------------------------------------------------------------------
; org conf
(require 'org)
(setq org-src-fontify-natively t)
; utsc源
(setq package-archives '(("gnu" . "https://mirrors.ustc.edu.cn/elpa/gnu/")
("melpa" . "https://mirrors.ustc.edu.cn/elpa/melpa/")
("nongnu" . "https://mirrors.ustc.edu.cn/elpa/nongnu/")))
; UI conf
(load-theme 'tango-dark)
(add-hook 'emacs-lisp-mode-hook 'show-paren-mode)
; tab f2 open config file start --------------------------------------------------------------------------------------------------------------
(defun open-my-init-file ()
(interactive)
(find-file "~/.emacs.d/init.el")
)
(global-set-key (kbd "<f2>") 'open-my-init-file)
;end -------------------------------------------------------------------------------------------------------------------------------------------
;; auto save code conf start ----------------------------------------------------------------------------------------------------------------
(defgroup auto-save nil
"Auto save file when emacs idle."
:group 'auto-save)
(defcustom auto-save-idle 0.1;;!!!!!!!!!!!!
"The idle seconds to auto save file."
:type 'integer
:group 'auto-save)
(defcustom auto-save-slient nil
"Nothing to dirty minibuffer if this option is non-nil."
:type 'boolean
:group 'auto-save)
(setq auto-save-default nil)
;; 前方高能核心代码, 请集中注意力
(defun auto-save-buffers ()
(interactive)
(let ((autosave-buffer-list))
(save-excursion
(dolist (buf (buffer-list))
(set-buffer buf)
(if (and (buffer-file-name) (buffer-modified-p))
(progn
(push (buffer-name) autosave-buffer-list)
(if auto-save-slient
(with-temp-message ""
(basic-save-buffer))
(basic-save-buffer))
)))
(unless auto-save-slient
(cond
((= (length autosave-buffer-list) 1)
(message "# Saved %s" (car autosave-buffer-list)))
((> (length autosave-buffer-list) 1)
(message "# Saved %d files: %s"
(length autosave-buffer-list)
(mapconcat 'identity autosave-buffer-list ", "))))))))
(defun auto-save-enable ()
(interactive)
(run-with-idle-timer auto-save-idle t #'auto-save-buffers))
(auto-save-enable);; 开启自动保存功能
(setq auto-save-slient t);; 自动保存的时候静悄悄的, 不要打扰我
;end ----------------------------------------------------------------------------------------------
; recentf conf
(require 'recentf)
(recentf-mode 1)
(setq recentf-max-menu-items 25)
(global-set-key (kbd "\C-x\ \C-r") 'recentf-open-files)
;end ---------------------------------------------------------------------------------------------
# NO USING emacs ON WINDOWS
# I think `lunaryemacs` is a kind of version that should try