我的.emacs配置
阅读原文时间:2023年07月10日阅读:1

上代码:

;; Added by Package.el.  This must come before configurations of
;; installed packages.  Don't delete this line.  If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
(package-initialize)

(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.
 '(column-number-mode t)
 '(display-time-mode t)
 '(inhibit-startup-screen t)
 '(package-selected-packages
   (quote
    (markdown-mode easy-kill ace-window w3 seq realgud-ipdb yasnippet csv-mode company-statistics flymake docbook enwc auctex all python org html5-schema json-mode company-math ##))))
(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 "宋体" :foundry "outline" :slant normal :weight normal :height 120 :width normal)))))

(set-scroll-bar-mode nil)
(tool-bar-mode nil)

(setq initial-frame-alist '((top . 0)(left . 0)(width . 165)(height . 40)))

;; Date Setting
(display-time-mode 1)
(setq display-time-24hr-format t)
(setq display-time-day-and-date t)
(setq display-time-use-mail-icon t)
(setq display-time-interval 10)

;; Closing the sounds
(setq visible-bell t)

;; Show the column and line
(setq column-number-mode t)
(setq line-number-mode t)

;; autosave
(setq auto-save-mode nil)

(setq make-backup-files nil)
(setq-default make-backup-files nil)

;; Show the directory and files
(setq speedbar-show-unknown-files t)

;; It is convenient for us to write code.
(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)
(add-hook 'org-mode-hook 'turn-on-foot-lock)
;; Editing css
(autoload 'css-mode "css-mode" "CSS editing mode" t)

(autoload 'htmlize-buffer "htmlize" "HTMLize mode" t)

(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)

;; The file pattern is associated with the filename suffix
(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))

;; Set keyboard
(global-set-key [F11] 'compile)
(global-set-key [F12] 'gdb)

;; increase package-archives
(require 'package)
(add-to-list 'package-archives
             '("melpa-stable" . "https://stable.melpa.org/packages/"))
(package-initialize)

;; configure the markdown-mode
(autoload 'markdown-mode "markdown-mode"
   "Major mode for editing Markdown files" t)
(add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))

(autoload 'gfm-mode "markdown-mode"
   "Major mode for editing GitHub Flavored Markdown files" t)
(add-to-list 'auto-mode-alist '("README\\.md\\'" . gfm-mode))

然后看下(这头牛真不错):

emacs开发网站

Main repository:

git clone -b master git://git.sv.gnu.org/emacs.git

ELPA repository:

git clone git://git.sv.gnu.org/emacs/elpa

官方文档在这里emacs开发配置,还是需要硬读英文文档。


最新更新:

(setq package-archives '(("gnu" . "http://elpa.emacs-china.org/gnu/")

("melpa" . "http://elpa.emacs-china.org/melpa/")))

;; -----------------------------------My main configuration---------------------------------------

(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.

'(global-linum-mode t)

'(inhibit-startup-screen t)

'(electric-pair-mode t)

'(package-selected-packages

'(flycheck-ycmd company-ycmd ycmd elpy yasnippet s pyvenv py-autopep8 material-theme highlight-indentation flycheck company better-defaults auto-complete)))

(setq initial-frame-alist '((top . 0)(left . 0)(width . 170)(height . 43)))

(tool-bar-mode 0)

(menu-bar-mode 0)

(scroll-bar-mode 0)

(setq initial-scratch-message "")

(setq tool-bar-mode nil)

(setq visible-bell t)

(setq auto-save-mode nil)

(setq backup-directory-alist (quote ("." . "/home/D/Software/Centos_7/backups/")))

(setq-default auto-save-timeout 15)

(setq-default auto-save-interval 100)

(setq make-backup-files nil)

(setq

backup-by-copying t

delete-old-versions t

kept-new-versions 3

kept-old-versions 1

version-control t)

(setq default-tab-width 4)

(setq indent-tabs-mode nil)

;; ----------------------------------Python 3.4 IDE configuration---------------------------------

(require 'package)

(add-to-list 'package-archives

'("melpa" . "http://melpa.org/packages/") t)

(package-initialize)

(defvar myPackages

'(better-defaults

elpy

auto-complete

py-autopep8

flycheck

material-theme))

(when (not package-archive-contents)

(package-refresh-contents))

(mapc #'(lambda (package)

(unless (package-installed-p package)

(package-install package)))

myPackages)

(require 'elpy)

(setq elpy-rpc-python-command "python3")

(setq python-shell-interpreter "python3")

(setq pyvenv-virtualenvwrapper-python "/usr/bin/python3")

(elpy-enable)

(ac-config-default)

(load-theme 'material t) ;; load material theme

(global-set-key (kbd "RET") 'newline-and-indent)

(when (require 'flycheck nil t)

(setq elpy-modules (delq 'elpy-module-flymake elpy-modules))

(add-hook 'elpy-mode-hook 'flycheck-mode))

;; enable autopep8 formatting on save

(require 'py-autopep8)

(add-hook 'elpy-mode-hook 'py-autopep8-enable-on-save)

;;--------------------------------- My ycmd configuration-------------------------------------

;;;; To use ycmd-mode in all supported modes

(require 'ycmd)

(add-hook 'after-init-hook #'global-ycmd-mode)

;;;; Specify only support c/c++ mode

;;(require 'ycmd)

;;(add-hook 'c++-mode-hook 'company-mode)

;;(add-hook 'c++-mode-hook 'ycmd-mode)

;;;; Specify how to run the server

(set-variable 'ycmd-server-command '("/usr/bin/python3" "/home/D/ycmd/ycmd"))

;;;; Specify a global emacs configuration

(set-variable 'ycmd-global-config "/home/D/ycmd/examples/.ycm_extra_conf.py")

;;;; Completion framework

(require 'company-ycmd)

(company-ycmd-setup)

(add-hook 'after-init-hook #'global-company-mode)

;;;; Enable flycheck

(require 'flycheck-ycmd)

(flycheck-ycmd-setup)

(add-hook 'after-init-hook #'global-flycheck-mode)

;;;; Set always complete immediately

(setq company-idle-delay 0)

;;;; ---------------------------------------------------

手机扫一扫

移动阅读更方便

阿里云服务器
腾讯云服务器
七牛云服务器

你可能感兴趣的文章