Emacs之ido-mode笔记

来源:互联网 发布:淘宝店铺代运营方案 编辑:程序博客网 时间:2024/03/29 02:12

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 InC-bReverts to the old switch-buffer completion engineBuffersC-fReverts to the old find-file completion engineFilesC-dOpens a dired buffer in the current directoryDirs / FilesC-aToggles showing ignored files (see ido-ignore-files)Files / BuffersC-cToggles if searching of buffer and file names should ignore case. (see ido-case-fold)Dirs / Files / BuffersTABAttempt to complete the input like the normal completing read functionalityDirs / Files / BuffersC-pToggles prefix matching; when it’s on the input will only match the beginning of a filename instead of any part of it.FilesC-s / C-rMoves to the next and previous match, respectivelyAllC-tToggles matching by Emacs regular expression.AllBackspaceDeletes 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 / DirsM-dSearches for the input in all sub-directories to the directory you’re in.FilesC-kKills the currently focused buffer or deletes the file depending on the mode.Files / BuffersM-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 directoryM-k从list中删除当前work directoryM-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 NameDescriptionido-ignore-buffersTakes a list of buffers to ignore in C-x bido-ignore-directoriesTakes a list of directories to ignore in C-x d and C-x C-fido-ignore-filesTakes a list of files to ignore in C-x C-fido-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 0
原创粉丝点击