摘要:下为定制和代码的自动提示从开始,对扩展包进行统一管理,极大程度上简化了扩展包的搜索与安装过程。安装完毕后,在配置文件中做以下配置代码补全。
1.最左侧显示行号
在emacs的配置文件(~./.emacs.d/init.el)文件里添加如下内容:
(add-to-list "load-path "/usr/share/emacs/site-lisp")
(require "linum)
(global-linum-mode t)
首先应该先检查字体配置, 然后检查是否开启eamcs的xft的USE标示符.
安装 font-cursor-misc 或 font-adobe-75dpi ,重启计算机测试(好像大部分是因为缺少这个语言包的问题)
安装:
1). [ebuild N ] media-fonts/font-adobe-75dpi-1.0.0 USE="X nls" 0 kB 2). [ebuild N ] x11-apps/bdftopcf-1.0.2 USE="-debug" 0 kB 3). [ebuild N ] media-fonts/font-alias-1.0.1 USE="-debug" 0 kB 4). [ebuild N ] media-fonts/font-util-1.1.1 USE="-debug" 0 kB3. 在emacs文件的标题栏显示该文件的绝对路径: (好处是当你打开多个同名文件时,易于区分)
(setq frame-title-format ("%S" (buffer-file-name "%f" (dired-directory dired-directory "%b"))))
4. 如果不想显示绝对路径,只是想显示该文件的名称(setq frame-title-format "XX@%b"),其中XX为自己的电脑名,或自己可任意取名,甚至可以不需要。
5. linux下为emacs定制c/c++ 和python代码的自动提示从 Emacs 24 开始,Emacs 对扩展包进行统一管理,极大程度上简化了扩展包的搜索与安装过程。打开 Emacs,然后执行 M-x list-packages ,如果网速足够快,应该很快就能看到 Emacs 官方提供的扩展包列表。
待软件包列表出现后,执行 C-s M-r ^ +company ,回车即可让光标跳到 company 扩展包信息所在的文本行,继而敲击 i 键(表示要安装该扩展包),再敲击 x 键(表示执行安装过程),稍等片刻,Emacs 会自动从下载 company 扩展包并安装至 $HOME/.emacs.d 目录。
提示:C-s 是开启 Emacs 查找模式, M-r 是将查找模式切换为正则表达式查找模式,而 C-s(ctrl +s) M-r(Alt + r) ^ + company 是用于匹配『位于行首且由多个空格与 company 字符串构成的字符串』的正则表达式。
如果以后要删除 company 扩展,步骤与安装步骤类似,只是将 i 键替换为 d 键(表示删除)。company 安装完毕后,在 Emacs 配置文件中做以下配置:
;; 代码补全
(add-hook "c-mode-hook "company-mode)
(add-hook "c++-mode-hook "company-mode)。
对于pcl的代码提示功能,只需要安装 company的关于C/C++的头文件即可.(目前是这样的)
在linux下,若emacs启动较慢,可通过hostname查看自己主机的名字,然后打开/etc/hosts文件,将其中localhost改为自己主机名
6.最后贴一下自己的emacs配置文件;; 关闭启动时的 “开机画面”,将缺省主模式设为 text-mode (setq inhibit-startup-message t) ;; 语法高亮 (global-font-lock-mode t) ;; 以y/n代表yes/no (fset "yes-or-no-p "y-or-n-p) ;; 显示括号匹配 (show-paren-mode t) (setq show-paren-style "parentheses) (transient-mark-mode t) ;; 在标题栏提示你目前在什么位置 (setq frame-title-format "yxg@%b") ;;(setq frame-title-format "("%S" (buffer-file-name "%f" (dired-directory dired-directory "%b")))) ;; 默认显示100列就换行 (setq default-fill-column 100) ;; 去掉工具栏 ;;(tool-bar-mode 0) ;; 去掉菜单栏 ;;(menu-bar-mode 0) (scroll-bar-mode 0) (tooltip-mode 0) ;; 显示列号、行号 (setq column-number-mode t) (setq line-number-mode t) ;; 回车缩进 (global-set-key "C-m" "newline-and-indent) (global-set-key (kbd "C-") "newline) ;;(global-unset-key (kbd "C-SPC")) ;;(global-set-key (kbd "M-SPC") "set-mark-command) ;;;; c mode ;;;; (defvar xgp-cfsi-left-PAREN-old nil "Command used to input "("") (make-variable-buffer-local "xgp-cfsi-left-PAREN-old) (defun xgp-cfsi-modify-alist (alist term new) (let ((tl (assq term (symbol-value alist)))) (if tl (setcdr tl new) (add-to-list alist (cons term new))))) (defun xgp-cfsi (style) "Deciding whether using CFSI." (interactive "Style: ") (c-set-style style) (setq indent-tabs-mode nil c-hanging-semi&comma-criteria (quote (c-semi&comma-inside-parenlist))) (xgp-cfsi-modify-alist "c-hanging-braces-alist "class-open nil) (xgp-cfsi-modify-alist "c-hanging-braces-alist "class-close nil) (local-set-key " " "self-insert-command)) (defun xgp-cfsi-erase-blanks () "Erase all trivial blanks for CFSI." (interactive) (save-excursion (goto-char (point-min)) (while (re-search-forward "[ ]+$" nil t) (replace-match "" nil nil)))) (defun linux-c-mode() (define-key c-mode-map [return] "newline-and-indent) (setq imenu-sort-function "imenu--sort-by-name) (interactive) (imenu-add-menubar-index) (which-function-mode) (c-toggle-auto-state) (c-toggle-hungry-state) (setq indent-tabs-mode nil) (xgp-cfsi "linux")) (add-hook "c-mode-common-hook "linux-c-mode) ;; MELPA 扩展包仓库 (when (>= emacs-major-version 24) (require "package) (add-to-list "package-archives "("melpa" . "http://melpa.org/packages/") t) (package-initialize)) ;; 代码补全 (add-hook "c-mode-hook "company-mode) (add-hook "c++-mode-hook "company-mode) ;;(eval-after-load "company ;; "(add-to-list "company-backends "company-irony)) ;; 左侧行号显示 (add-to-list "load-path "/usr/share/emacs/site-lisp") (require "linum) (global-linum-mode t) (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) "(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 "Liberation Mono" :foundry "1ASC" :slant normal :weight normal :height 98 :width normal))))) ;;;;;;;;;;;;;;;;;;;;; for zero ;;;;;;;;;;;;;;;;;;;;;;;;;; (add-hook "c-mode-hook (lambda () (font-lock-add-keywords nil "(("(@ *[^@# ]+ *#) *[;]*[ ]+" 1 font-lock-function-name-face t) ("^ *(@) *$" 1 font-lock-function-name-face t))))) (defun zero-quantum () (interactive) (insert "@ ") (insert " # @") (backward-char 5)) (define-prefix-command "ctl-z-map) (global-set-key (kbd "C-z") "ctl-z-map) (global-set-key (kbd "C-z c") "c-mode) (global-set-key (kbd "C-z t") "tex-mode) (global-set-key (kbd "C-z m") "markdown-mode) (global-set-key (kbd "C-z q") "zero-quantum)
文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。
转载请注明本文地址:https://www.ucloud.cn/yun/9585.html
摘要:缘起宇宙在成住坏空的循环成灭过程中,现在的劫称为贤劫,贤劫中出现于世之千佛即为贤劫千佛。一入误终身用过之后,才发现,他天生带的神奇的风格,几乎处处可以使用。正如神雕侠侣中描写的那样风陵渡口初相遇,一见杨过误终身。之后初相遇,一入误终身。 摘要:苹果公司总裁乔布斯是贤动千佛中的金刚慧佛,由他创造的iPod,iPhone,Mac,引领着IT世界之潮流。Mac基于Unix,和Linux师出同...
摘要:缘起宇宙在成住坏空的循环成灭过程中,现在的劫称为贤劫,贤劫中出现于世之千佛即为贤劫千佛。一入误终身用过之后,才发现,他天生带的神奇的风格,几乎处处可以使用。正如神雕侠侣中描写的那样风陵渡口初相遇,一见杨过误终身。之后初相遇,一入误终身。 摘要:苹果公司总裁乔布斯是贤动千佛中的金刚慧佛,由他创造的iPod,iPhone,Mac,引领着IT世界之潮流。Mac基于Unix,和Linux师出同...
摘要:缘起宇宙在成住坏空的循环成灭过程中,现在的劫称为贤劫,贤劫中出现于世之千佛即为贤劫千佛。一入误终身用过之后,才发现,他天生带的神奇的风格,几乎处处可以使用。正如神雕侠侣中描写的那样风陵渡口初相遇,一见杨过误终身。之后初相遇,一入误终身。 摘要:苹果公司总裁乔布斯是贤动千佛中的金刚慧佛,由他创造的iPod,iPhone,Mac,引领着IT世界之潮流。Mac基于Unix,和Linux师出同...
摘要:安装完后,运行如果出现就了这一步添加指令到文件中,不然输不上汉字,有可能连输入法都切不出来,如果在环境里汉字都是很奇怪火星字符。system: debian linux emacs version: emacs 23 话说debian linux是可定制比强的系统也真是那么回事,在你使用的过程中需要什么都是需要自己去手动安装的,不必要的东西,debian linux是不会为你自动安装的,...
摘要:这里将要介绍的是系列发行版的与的详细使用方法,如需要了解系列发行版的包管理系统可查看我的另一篇文章软件安装管理之与详解。 一、序言 上一篇文章《Linux软件安装管理之——源码安装详解》详细介绍了Linux平台下的源码包安装原理,虽然使用源代码进行软件编译可以具有定制化的设置,但对于Linux distribution的发行商来说,则有软件管理不晚的问题,毕竟不是每个人都会进行源代码编...
阅读 912·2021-11-25 09:43
阅读 2773·2019-08-30 15:54
阅读 3088·2019-08-30 15:54
阅读 2797·2019-08-30 15:44
阅读 2631·2019-08-27 14:19
阅读 1492·2019-08-26 12:18
阅读 2153·2019-08-26 11:42
阅读 761·2019-08-26 11:35