Emacs之ido-mode笔记

ido-mode

1 启动ido-mode

添加如下配置

(setq ido-enable-flex-matching t)
(setq ido-use-filename-at-point 'guess)
(setq ido-everywhere t)          
(ido-mode 1)
2 操作

输入部分名称,就会自动筛选匹配的文件/buffer.     若候选项是由多个单词用空格分隔组成的,则可用直接输入每个单词的首字母缩写,也能匹配该候选项.例如输入`cgf`能够匹配"*Customize Group: Foobar *"

使用<-和->在待选项中切换选择.

使用向上,下键切换上次/下次的文件/buffer

直接使用C-f 和C-b 切换文件/buffer选择模式

按回车直接选择第一个匹配项

其他命令         #+CAPTION:一般命令

KeybindingDescriptionAvailable In
C-bReverts to the old switch-buffer completion engineBuffers
C-fReverts to the old find-file completion engineFiles
C-dOpens a dired buffer in the current directoryDirs / Files
C-aToggles showing ignored files (see ido-ignore-files)Files / Buffers
C-cToggles if searching of buffer and file names should ignore case. (see ido-case-fold)Dirs / Files / Buffers
TABAttempt to complete the input like the normal completing read functionalityDirs / Files / Buffers
C-pToggles prefix matching; when it’s on the input will only match the beginning of a filename instead of any part of it.Files
C-s / C-rMoves to the next and previous match, respectivelyAll
C-tToggles matching by Emacs regular expression.All
BackspaceDeletes characters as usual or goes up one directory if it makes sense to do so.All (but functionality varies)
C-SPC / C-@Restricts the completion list to anything that matches your current input.All
//直接跳到根目录,若在windows下则为driver目录Files
~/直接跳到HOME目录Files / Dirs
M-dSearches for the input in all sub-directories to the directory you’re in.Files
C-kKills the currently focused buffer or deletes the file depending on the mode.Files / Buffers
M-mCreates a new sub-directory to the directory you’re inFiles

当用ido-find-file打开一个文件时,会把该文件所在目录的所有文件信息缓存起来,该缓存起来的目录被称为Work Directory. work Directory会被记录在ido-work-directory-list变量中.

当在当前目录下查找不到符合条件的文件时,在等待一段时间后,ido会自动从work directory list中搜索符合条件的文件

#+CAPTION:Work Directory Commands

键绑定描述
M-n / M-p切换到下一个/上一个work directory
M-k从list中删除当前work directory
M-s在所有的work directory list中搜索匹配当前输入的文件名
3 配置
  • 变量`ido-use-filename-at-point`

    根据光标所在值猜测默人要打开的文件名的方法,nil表示不猜测

    (setq ido-use-filename-at-point 'guess)
  • 变量`ido-use-url-at-point`

    类似变量`ido-use-filename-at-point`,但是把光标所在的值作为是url

  • 变量`ido-create-new-buffer`

    当用C-x b输入一个新buffer时,默认情况下ido会提示你再按一次回车确认新建buffer.

    该变量的可选值为

    • 'alway                不提示,直接新建

    • 'prompt                提示用户确认

    • 'never                不新建

  • 设置显示可选项的顺序

    变量`ido-file-extensions-order`

    ;; 空格表示没有扩展名的文件,t表示所有未列出扩展名的其他文件的以默认方法排序
    (setq ido-file-extensions-order '(".org" ".txt" ".py" ".emacs" ".xml" ".el" ".ini" ".cfg" ".cnf" "" t))
  • 设置隐藏某些可选项

Variable NameDescription
ido-ignore-buffersTakes a list of buffers to ignore in C-x b
ido-ignore-directoriesTakes a list of directories to ignore in C-x d and C-x C-f
ido-ignore-filesTakes a list of files to ignore in C-x C-f
ido-ignore-extensions是否忽略变量`completion-ignored-extensions`中的文件
completion-ignored-extensionsCompletion ignores file names ending in any string in this list.It ignores directory names if they match any string in this list which ends in a slash.
ido-work-directory-list-ignore-regexps符合该列表的目录不放入work directory中
ido-auto-merge-delay-time当在当前目录下查找不到符合条件的文件时,在等待一段时间后,ido会自动从work directory list中搜索符合条件的文件,该等待的时间由该变量决定,单位为秒



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值