我的.emacs(Ubuntu版)(二十二)

2024-05-08 00:38
文章标签 ubuntu 二十二 emacs

本文主要是介绍我的.emacs(Ubuntu版)(二十二),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

1.版本一 

(package-initialize)
(add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(add-to-list 'package-archives '("elpa" . "http://elpa.gnu.org/packages/"))(ansi-color-for-comint-mode-on)
(add-to-list 'load-path "~/.emacs.d/site-lisp")
(load-theme 'tsdh-dark)
(require 'auto-complete)
(global-auto-complete-mode t)
(global-set-key (kbd "C-SPC") nil);;去掉工具条
(tool-bar-mode 0)
;;去掉菜单栏
(menu-bar-mode 0)(load-file "~/.emacs.d/site-lisp/imenu-list.el")
(global-set-key [f9] #'imenu-list-smart-toggle)
;;去掉启动界面
(setq inhibit-startup-message t);;打开文件默认只读模式
(defun read-only-setup () (read-only-mode))
(add-hook 'find-file-hook #'read-only-setup);;neotree
(add-to-list 'load-path "~/.emacs.d/site-lisp/neotree")
;;(load-file "~/.emacs.d/site-lisp/neotree/teotree.el")
(require 'neotree)
(global-set-key [f7] 'hexl-mode)
(global-set-key [f8] 'neotree-refresh)
(global-set-key [f10] 'neotree-toggle)
(global-set-key [f12] 'cua-mode);;cscope
(require 'xcscope)
(setq cscope-do-not-update-database t)
(global-set-key (kbd "M-1") 'cscope-find-egrep-pattern)
(global-set-key (kbd "M-2") 'cscope-find-this-file)
(global-set-key (kbd "M-3") 'cscope-index-files)
(global-set-key (kbd "M-4") 'cscope-find-this-symbol)
(global-set-key (kbd "M-5") 'cscope-find-global-definition)
(global-set-key (kbd "M-6") 'cscope-pop-mark)
(global-set-key [f1] 'whitespace-newline-mode);自动清除行位空格
(global-set-key [f2] 'delete-trailing-whitespace)
(global-set-key [f3] 'find-name-dired)
(global-set-key [f4] 'grep-find)
(global-set-key [f5] 'compile)
(global-set-key [(f6)] 'replace-regexp)
(setq x-select-enable-clipboard t)
(setq mouse-yank-at-point t)
(global-hl-line-mode 1)(require'linum)
(global-linum-mode t)
(setq column-number-mode t)(add-hook 'comint-output-filter-functions'comint-watch-for-password-prompt)(display-time-mode 1)
(setq display-time-24hr-format t)
(setq display-time-day-and-date t)
(display-time)(column-number-mode t)
(setq default-tab-width 2)
(setq indent-tabs-mode nil);; add there directory before same file
(require 'uniquify)
(setq uniquify-buffer-name-style 'forward)
(global-set-key (kbd "C-j") 'goto-line)
(electric-pair-mode t)(setq make-backup-files nil)
;; 设定不产生备份文件
(setq-default make-backup-files nil)
;关闭自动保存模式
(setq auto-save-mode nil)
;不生成 #filename# 临时文件
(setq auto-save-default nil);;括号匹配
(show-paren-mode t)
(setq show-paren-style 'parentheses);;双重补全,好用的很呐
(global-set-key (kbd "M-/") 'hippie-expand);;括号自动补全
(electric-pair-mode 1)
(setq electric-pair-pairs '((?\" . ?\")(?\{ . ?\})) );;Command line(No Gui)
(setq x-select-enable-clipboard t)
(unless window-system(when (getenv "DISPLAY")(defun xsel-cut-function (text &optional push)(with-temp-buffer(insert text)(call-process-region (point-min) (point-max) "xsel" nil 0 nil "--clipboard" "--input")))(defun xsel-paste-function()(let ((xsel-output (shell-command-to-string "xsel --clipboard --output")))(unless (string= (car kill-ring) xsel-output)xsel-output )))(setq interprogram-cut-function 'xsel-cut-function)(setq interprogram-paste-function 'xsel-paste-function)));;窗口全屏 
(defun my-fullscreen () (interactive) (x-send-client-messagenil 0 nil "_NET_WM_STATE" 32'(2 "_NET_WM_STATE_FULLSCREEN" 0)))
(my-fullscreen);;Or full screen : 非全屏
;;(add-to-list 'default-frame-alist '(fullscreen . maximized))

2.版本二(2023.3.19版)

(package-initialize)
(add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(add-to-list 'package-archives '("elpa" . "http://elpa.gnu.org/packages/"))(ansi-color-for-comint-mode-on)
(add-to-list 'load-path "~/.emacs.d/site-lisp")
(load-theme 'tsdh-dark)
(require 'auto-complete)
(global-auto-complete-mode t)
(global-set-key (kbd "C-SPC") nil)(with-eval-after-load 'company (company-ctags-auto-setup));;highlight-beyond-fill 80+
(add-to-list 'load-path "~/.emacs.d/site-lisp/highlight-beyond-fill")
(require 'highlight-beyond-fill-column);;去掉工具条
(tool-bar-mode 0)
;;去掉菜单栏
(menu-bar-mode 0)(load-file "~/.emacs.d/site-lisp/imenu-list.el")
(global-set-key [f9] #'imenu-list-smart-toggle)
;;去掉启动界面
(setq inhibit-startup-message t);;打开文件默认只读模式
(defun read-only-setup () (read-only-mode))
(add-hook 'find-file-hook #'read-only-setup);;记录我们每次调用 M-x 时输入的命令历史,然后每次将最常用的显示在前面
;;amx-mode
(use-package amx:ensure t:init (amx-mode));;mwin: 优化C-a和C-e
(use-package mwim:ensure t:bind("C-a" . mwim-beginning-of-code-or-line)("C-e" . mwim-end-of-code-or-line));;ace-window:: 多窗口时,C-x o 重新绑定ace-window,为每个window编号跳转.
(use-package ace-window:ensure t:bind (("C-x o" . 'ace-window)));;undo-tree
(use-package undo-tree:ensure t:init (global-undo-tree-mode))(setq sml/no-confirm-load-theme t)
(use-package smart-mode-line:ensure t:init (sml/setup))(use-package good-scroll:ensure t:if window-system          ; 在图形化界面时才使用这个插件:init (good-scroll-mode))(use-package which-key:ensure t:init (which-key-mode))(use-package avy:ensure t:bind(("M-j" . avy-goto-char-timer)))(use-package highlight-symbol:ensure t:init (highlight-symbol-mode):bind ("C-." . highlight-symbol));;Or
;;(add-hook 'find-file-hook 'read-only-mode);;swiper快速搜索(好用)
global-set-key (kbd "C-s") 'swiper);;counsel快速搜索
;;(global-set-key (kbd "C-s") 'counsel-grep);;counsel mode
(ivy-mode t)
(counsel-mode t)
(setq ivy-use-virtual-buffers t)
(setq ivy-use-selectable-prompt t)
(setq enable-recursive-minibuffers t)
(setq ivy-count-format "(%d/%d) ")
(setq search-default-mode #'char-fold-to-regexp);;搜索最近访问文件
;;(global-set-key (kbd "C-x b") 'ivy-switch-buffer)
(global-set-key (kbd "C-x b") 'counsel-switch-buffer);;搜索文件
(global-set-key (kbd "C-x C-f") 'counsel-find-file);;查看历史搜索记录
;;(global-set-key (kbd "C-r") 'counsel-grep-or-swiper)
;;(global-set-key (kbd "C-r") 'counsel-find-file)
(global-set-key (kbd "C-r") 'counsel-recentf)(defun copy-all-dir ()"copy dir path."(interactive)(message "dired-copy-filename-as-kill 0")(dired-copy-filename-as-kill 0))(define-key dired-mode-map (kbd "w") 'copy-all-dir);;neotree
(add-to-list 'load-path "~/.emacs.d/site-lisp/neotree")
(require 'neotree)
(global-set-key [f7] 'hexl-mode)
(global-set-key [f8] 'neotree-toggle)
(global-set-key [f10] 'neotree-toggle)
(global-set-key [f12] 'cua-mode)(global-set-key (kbd "C-,") 'neotree-refresh)
;;(define-key key-translation-map (kbd "g") (kbd "<f10>"));;Or
;;(global-auto-revert-mode 1)
;;目录只读
(defun refresh-dired ()(interactive)(neotree-refresh)(auto-revert-mode);;(delete-other-windows 1)
;;  (delete-windows 0))
;;(global-set-key [f10] 'refresh-dired);;将当前行移动到最上端.
(defun go-top ()"Go to front line."(interactive)(message "recenter-top-bottom 0");;(universal-argument)(recenter-top-bottom 0));;cscope
(require 'xcscope)
(setq cscope-do-not-update-database t)
(global-set-key (kbd "M-1") 'cscope-find-egrep-pattern)
(global-set-key (kbd "M-2") 'cscope-find-this-file)
(global-set-key (kbd "M-3") 'cscope-index-files)
(global-set-key (kbd "M-4") 'cscope-find-this-symbol)
(global-set-key (kbd "M-5") 'cscope-find-global-definition)
(global-set-key (kbd "M-6") 'cscope-pop-mark)
(global-set-key (kbd "M-7") 'cscope-prev-symbol)
(global-set-key (kbd "M-8") 'cscope-next-symbol)
(global-set-key (kbd "M-9") 'go-top)(global-set-key [f1] 'whitespace-newline-mode);自动清除行位空格
(global-set-key [f2] 'delete-trailing-whitespace)
;;(global-set-key [f3] 'find-name-dired)
(global-set-key [f3] 'front-insert-linenumber)
(global-set-key [f4] 'grep-find)
(global-set-key [f5] 'compile)
(global-set-key [(f6)] 'replace-regexp)
(setq x-select-enable-clipboard t)
(setq mouse-yank-at-point t)
(global-hl-line-mode 1);;行号显示
(require 'linum)
(global-linum-mode t)
(setq column-number-mode t);; ;;行号显示
;; (require 'hlinum)
;; (hlinum-activate)
;; (setq column-number-mode t)(add-hook 'comint-output-filter-functions'comint-watch-for-password-prompt)(display-time-mode 1)
(setq display-time-24hr-format t)
(setq display-time-day-and-date t)
(display-time)(column-number-mode t)
(setq default-tab-width 2)
(setq indent-tabs-mode nil);; add there directory before same file
(require 'uniquify)
(setq uniquify-buffer-name-style 'forward)
(global-set-key (kbd "C-j") 'goto-line)
(electric-pair-mode t)(setq make-backup-files nil)
;; 设定不产生备份文件
(setq-default make-backup-files nil)
;关闭自动保存模式
(setq auto-save-mode nil)
;不生成 #filename# 临时文件
(setq auto-save-default nil);;括号匹配
(show-paren-mode t)
(setq show-paren-style 'parentheses);;双重补全,好用的很呐
(global-set-key (kbd "M-/") 'hippie-expand);;括号自动补全
(electric-pair-mode 1)
(setq electric-pair-pairs '((?\" . ?\")(?\{ . ?\})) );;Command line(No Gui)
(setq x-select-enable-clipboard t)
(unless window-system(when (getenv "DISPLAY")(defun xsel-cut-function (text &optional push)(with-temp-buffer(insert text)(call-process-region (point-min) (point-max) "xsel" nil 0 nil "--clipboard" "--input")))(defun xsel-paste-function()(let ((xsel-output (shell-command-to-string "xsel --clipboard --output")))(unless (string= (car kill-ring) xsel-output)xsel-output )))(setq interprogram-cut-function 'xsel-cut-function)(setq interprogram-paste-function 'xsel-paste-function)));;窗口全屏 
(defun my-fullscreen () (interactive) (x-send-client-messagenil 0 nil "_NET_WM_STATE" 32'(2 "_NET_WM_STATE_FULLSCREEN" 0)));;(my-fullscreen)(defun fullscreen ()(interactive)(set-frame-parameter nil 'fullscreen(if (frame-parameter nil 'fullscreen) nil 'fullboth)))(fullscreen);;(add-to-list 'default-frame-alist '(fullscreen . maximized))(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)'(custom-safe-themes'("3c83b3676d796422704082049fc38b6966bcad960f896669dfc21a7a37a748fa" default))'(display-time-mode t)'(package-selected-packages'(rainbow-delimiters highlight-symbol tiny dashboard which-key good-scroll smart-mode-line undo-tree mwim ace-window amx nlinum hlinum fd-dired ripgrep counsel fzf swiper markdown-mode vmd-mode cmake-mode gnu-elpa-keyring-update gnu-elpa company-ycmd))'(show-paren-mode t)'(tool-bar-mode nil))(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 "DejaVu Sans Mono" :foundry "PfEd" :slant normal :weight normal :height 128 :width normal)))))

3.版本三(2023.4.6)

(package-initialize)
(add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(add-to-list 'package-archives '("elpa" . "http://elpa.gnu.org/packages/"))(ansi-color-for-comint-mode-on)
(add-to-list 'load-path "~/.emacs.d/site-lisp")
(load-theme 'tsdh-dark)
(require 'auto-complete)
(global-auto-complete-mode t)
(global-set-key (kbd "C-SPC") nil)
(with-eval-after-load 'company (company-ctags-auto-setup));;ert
(require 'ert);;gtags
(load-file "~/.emacs.d/site-lisp/gtags.el")
(require 'ggtags)
(setenv "GTAGSLABEL" "pygments")
(setq ggtags-global-mode 1)
(add-hook 'c-mode-common-hook(lambda ()(when (derived-mode-p 'c-mode 'c++-mode 'java-mode 'asm-mode)(ggtags-mode 1))))(add-hook 'gtags-select-mode-hook'(lambda ()(setq hl-line-face 'underline)(hl-line-mode 1)))(add-hook 'dired-mode-hook 'ggtags-mode)
(add-hook 'go-mode-hook 'ggtags-mode)
(add-hook 'python-mode-hook 'ggtags-mode)
; ggtags integrate Imenu
(setq-local imenu-create-index-function #'ggtags-build-imenu-index)
; Customization
(setq gtags-suggested-key-mapping t)
(setq gtags-auto-update t);;cflow
(require 'cflow-mode)
(defvar cmd nil nil)
(defvar cflow-buf nil nil)
(defvar cflow-buf-name nil nil)(defun yyc/cflow-function (function-name)"Get call graph of inputed function. "(interactive "sFunction name:\n")(interactive (list (car (senator-jump-interactive "Function name: "nil nil nil))))(setq cmd (format "cflow  -b --main=%s %s" function-name buffer-file-name))(setq cflow-buf-name (format "**cflow-%s:%s**"(file-name-nondirectory buffer-file-name)function-name))(setq cflow-buf (get-buffer-create cflow-buf-name))(set-buffer cflow-buf)(setq buffer-read-only nil)(erase-buffer)(insert (shell-command-to-string cmd))(pop-to-buffer cflow-buf)(goto-char (point-min))(cflow-mode));;cedet解析代码定义位置
(semantic-mode 1)
(global-ede-mode 1)
(global-semanticdb-minor-mode t)	 ;;缓存解析过的源代码的结果,以便以后可以使用
(global-semantic-idle-scheduler-mode t)	 ;;emacs空闲时分析源代码
(global-semantic-idle-summary-mode t)	 ;;对当前位点处符号,显示分析出来的结果的摘要
(global-semantic-idle-completions-mode t);;代码补全功能,可以使用命令进行选择
(global-semantic-decoration-mode t)	 ;;顾名思义,使用不同的显示风格来显示分析出来的不同结果
(global-semantic-highlight-edits-mode t)
(global-semantic-show-parser-state-mode t)
(global-semantic-highlight-func-mode t)	 ;;高亮函数或者标签的声明行
(global-semantic-stickyfunc-mode t)	 ;;在文本的最上层显示函数的声明信息
(global-semantic-mru-bookmark-mode t)	 ;;保存使用过的所有tag,mru是最多最近使用的意思;;multiple-cursors
(require 'multiple-cursors);;x-send-keystrokes
(require 'cl-lib);;highlight-beyond-fill 80+
(add-to-list 'load-path "~/.emacs.d/site-lisp/highlight-beyond-fill")
(require 'highlight-beyond-fill-column);;去掉工具条
(tool-bar-mode 0)
;;去掉菜单栏
(menu-bar-mode 0)(load-file "~/.emacs.d/site-lisp/imenu-list.el")
(global-set-key [f9] #'imenu-list-smart-toggle)
;;去掉启动界面
(setq inhibit-sta

这篇关于我的.emacs(Ubuntu版)(二十二)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/968843

相关文章

Ubuntu固定虚拟机ip地址的方法教程

《Ubuntu固定虚拟机ip地址的方法教程》本文详细介绍了如何在Ubuntu虚拟机中固定IP地址,包括检查和编辑`/etc/apt/sources.list`文件、更新网络配置文件以及使用Networ... 1、由于虚拟机网络是桥接,所以ip地址会不停地变化,接下来我们就讲述ip如何固定 2、如果apt安

怎么关闭Ubuntu无人值守升级? Ubuntu禁止自动更新的技巧

《怎么关闭Ubuntu无人值守升级?Ubuntu禁止自动更新的技巧》UbuntuLinux系统禁止自动更新的时候,提示“无人值守升级在关机期间,请不要关闭计算机进程”,该怎么解决这个问题?详细请看... 本教程教你如何处理无人值守的升级,即 Ubuntu linux 的自动系统更新。来源:https://

Ubuntu系统怎么安装Warp? 新一代AI 终端神器安装使用方法

《Ubuntu系统怎么安装Warp?新一代AI终端神器安装使用方法》Warp是一款使用Rust开发的现代化AI终端工具,该怎么再Ubuntu系统中安装使用呢?下面我们就来看看详细教程... Warp Terminal 是一款使用 Rust 开发的现代化「AI 终端」工具。最初它只支持 MACOS,但在 20

在Ubuntu上部署SpringBoot应用的操作步骤

《在Ubuntu上部署SpringBoot应用的操作步骤》随着云计算和容器化技术的普及,Linux服务器已成为部署Web应用程序的主流平台之一,Java作为一种跨平台的编程语言,具有广泛的应用场景,本... 目录一、部署准备二、安装 Java 环境1. 安装 JDK2. 验证 Java 安装三、安装 mys

如何评价Ubuntu 24.04 LTS? Ubuntu 24.04 LTS新功能亮点和重要变化

《如何评价Ubuntu24.04LTS?Ubuntu24.04LTS新功能亮点和重要变化》Ubuntu24.04LTS即将发布,带来一系列提升用户体验的显著功能,本文深入探讨了该版本的亮... Ubuntu 24.04 LTS,代号 Noble NumBAT,正式发布下载!如果你在使用 Ubuntu 23.

什么是 Ubuntu LTS?Ubuntu LTS和普通版本区别对比

《什么是UbuntuLTS?UbuntuLTS和普通版本区别对比》UbuntuLTS是Ubuntu操作系统的一个特殊版本,旨在提供更长时间的支持和稳定性,与常规的Ubuntu版本相比,LTS版... 如果你正打算安装 Ubuntu 系统,可能会被「LTS 版本」和「普通版本」给搞得一头雾水吧?尤其是对于刚入

如何安装 Ubuntu 24.04 LTS 桌面版或服务器? Ubuntu安装指南

《如何安装Ubuntu24.04LTS桌面版或服务器?Ubuntu安装指南》对于我们程序员来说,有一个好用的操作系统、好的编程环境也是很重要,如何安装Ubuntu24.04LTS桌面... Ubuntu 24.04 LTS,代号 Noble NumBAT,于 2024 年 4 月 25 日正式发布,引入了众

Ubuntu 怎么启用 Universe 和 Multiverse 软件源?

《Ubuntu怎么启用Universe和Multiverse软件源?》在Ubuntu中,软件源是用于获取和安装软件的服务器,通过设置和管理软件源,您可以确保系统能够从可靠的来源获取最新的软件... Ubuntu 是一款广受认可且声誉良好的开源操作系统,允许用户通过其庞大的软件包来定制和增强计算体验。这些软件

如何安装HWE内核? Ubuntu安装hwe内核解决硬件太新的问题

《如何安装HWE内核?Ubuntu安装hwe内核解决硬件太新的问题》今天的主角就是hwe内核(hardwareenablementkernel),一般安装的Ubuntu都是初始内核,不能很好地支... 对于追求系统稳定性,又想充分利用最新硬件特性的 Ubuntu 用户来说,HWEXBQgUbdlna(Har

Ubuntu 24.04 LTS怎么关闭 Ubuntu Pro 更新提示弹窗?

《Ubuntu24.04LTS怎么关闭UbuntuPro更新提示弹窗?》Ubuntu每次开机都会弹窗提示安全更新,设置里最多只能取消自动下载,自动更新,但无法做到直接让自动更新的弹窗不出现,... 如果你正在使用 Ubuntu 24.04 LTS,可能会注意到——在使用「软件更新器」或运行 APT 命令时,