emacs 常用自定义快捷键设置

这篇博客介绍了作者在emacs中的个性化键位绑定设置,包括最近文件、查看函数描述、git文件搜索、代码补全、Mac系统下通过Finder访问文件、文本选择扩展、iedit模式、org模块功能如capture和pomodoro,以及全局搜索和窗口管理等。

我的emacs配置GitHub

Emacs key bindings settings

Recent Files 最近打开的文件:

;; open recent files
(global-set-key "\C-x\ \C-r" 'recentf-open-files)

查看函数和变量描述

;;find-function  find-variable
(global-set-key (kbd "C-h C-f") 'find-function)
(global-set-key (kbd "C-h C-v") 'find-variable)
(global-set-key (kbd "C-h C-k") 'find-function-on-key)


;;======================
(global-set-key "\C-s" 'swiper)
(global-set-key (kbd "C-c C-r") 'ivy-resume)
(global-set-key (kbd "M-x") 'counsel-M-x)
(global-set-key (kbd "C-x C-f") 'counsel-find-file)
(global-set-key (kbd "C-h f") 'counsel-describe-function)
(global-set-key (kbd "C-h v") 'counsel-describe-variable)

git管理下文件的搜索

;; git keys
(global-set-key (kbd "C-c p f") 'counsel-git)

缩进buffer

;; indent key-binding
(global-set-key (kbd "C-M-\\")  'indent-region-or-buffer)

hippie expand代码补全

(global-set-key (kbd "s-/") 'hippie-expand)

Mac系统下在Finder打开文件所在文件夹

;;reveal-in-osx-finder
(global-set-key (kbd "C-c z") 'reveal-in-osx-finder)

拓展选择文本

;;expand-region
(global-set-key (kbd "C-=") 'er/expand-region)

iedit mode

;;iedit
(global-set-key (kbd "M-s e") 'iedit-mode)

用C-n, C-p选择company待选选项

;;company keys
(with-eval-after-load 'company
  (define-key company-active-map (kbd "M-n") nil)
  (define-key company-active-map (kbd "M-p") nil)
  (define-key company-active-map (kbd "C-n") #'company-select-next)
  (define-key company-active-map (kbd "C-p") #'company-select-previous)
  )

Dired mode 选择文件夹

(with-eval-after-load 'dired
  (define-key dired-mode-map (kbd "RET") 'dired-find-alternate-file))

org capture

;;org capture
(global-set-key (kbd "C-c r") 'org-capture)

org pomodoro 开始任务

;;org pomodoro
(global-set-key (kbd "C-c o p") 'org-pomodoro)

打开org agenda buffer

;; org mode
(global-set-key (kbd "C-c a") 'org-agenda)

helm ag 工程目录下全局搜索

;;helm ag
(global-set-key (kbd "C-c p s") 'helm-do-ag-project-root)

auto-yasnippet 生成和使用临时补全

;;auto yasnippet
(global-set-key (kbd "C-c s c") 'aya-create)
(global-set-key (kbd "C-c s e") 'aya-expand)

f8 打开neotree

;;neotree
(global-set-key [f8] 'neotree-toggle)

window move 更改聚焦窗口

(非Mac系统用户需要换其它快捷键进行绑定)

;;window move
(global-set-key (kbd "C-S-p") 'windmove-up)
(global-set-key (kbd "C-S-n") 'windmove-down)
(global-set-key (kbd "C-S-b") 'windmove-left)
(global-set-key (kbd "C-S-f") 'windmove-right)



(provide 'init-keybindings)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值