Emacs:导航目录和打开文件的好策略是什么? [英] Emacs: what are good tactics for navigating directories and opening files?

查看:82
本文介绍了Emacs:导航目录和打开文件的好策略是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

上周,由于不得不应付R和Perl的不同IDE,因此我再也不喜欢或使用足够让我感到非常舒服,我决定尝试Emacs。我的这个决定并不是没有一点令人震惊。我的主要用途是Perl与cperl和R与ESS。我的环境是Windows 7 Ultimate 64位,我正在运行v23.4.1,我认为是我代表安装的ESS软件包。



到目前为止,令人惊讶的是没有任何其他重要的软件。我已经将我的ctrl键重新映射到大写锁定,更改的默认文件夹,与.emacs混淆,并添加了一些添加,如自动安装,yasnippet,颜色主题,冰柱和其他几个。显然有一些非常复杂的东西在那里。除此之外,基础Emacs的某些功能立即非常强大和有用,如上下搜索。总的来说,我感到非常惊讶和放心。



一个比我想象的更糟糕的事情是找到和打开文件的过程。经过粗略的阅读各种教程之后,我有了这个准魔法文件位置和文件名自动完成的形象。我的设置中的主目录有g:/ roaming / code / perl或g:/ roaming / code / R /等路径,但我经常需要分支到完全不同的路径,如g:/ pricedata / support files / sector / project01 /等等。



目前,当我需要使用不同的分支时,我很费力地删除文件路径,然后使用自动完成来深入文件系统的分支。这有点让我回到二十年前在Amiga上运行一个bash shell。



我期望什么?类似的东西(使用上面的例子)输入'project01',立即跳到路径底部的文件夹。由于某种原因,我的头脑中已经有了这个想法,Emacs会预先加载目录。所以也许这是不现实的。



我的猜测是,我的困难可能来自于我自己的缺乏熟悉程度,而不是Emacs的结构性缺点,并导致我的问题。我不能抱怨没有足够的文件;相反,有很多信息,它分散在相当随意。冰柱有一个类似的问题 - 如果有什么东西太多了。



1)尝试打开文件树的不同分支时,最好的策略是什么?文件在minibuffer或使用其他方法?是否有可以用于从一个地方到另一个地方快捷方式的别名,还是可以指定要预加载的目录?人们只是围绕很多吗?或者我从完全错误的角度出发,需要采取不同的策略?



2)通过附加设置,完全用于通过前缀通配符等来在(例如)project01中找到文件?我应该把重点放在更有效率上?我没有利用附加组件的力量,如冰柱,任何东西等?



我意识到这些问题有危险地关闭了没有明确答案的弃用类别。我的辩护是,在我承诺不好的习惯或不良的长期解决方案之前的这个阶段的一些提示/指导是值得欢迎的,我怀疑这些答案将有助于其他可能正在考虑切换的人。如果有问题,我很乐意撤销或重新出售。

解决方案

有各种方法。 文件名缓存是内置解决方案。打开文件从最近的文件也是非常有效的,特别是如果您将存储的文件设置为高数字(例如1000)。还有一些文件系统上的从任何地方打开文件的软件包。还有元解决方案 like anything.el 可以在通用界面中显示来自多个来源(历史记录,项目文件等)的文件完成。



您应该调查不同的选项,以找出哪些是最适合你的。


Last week, infuriated (again) by having to cope with different IDEs for R and Perl, neither of which I like or use enough to get really comfortable in, I decided to try Emacs. This decision was not made without a certain trepidation on my part. My main use is for Perl with cperl and for R with ESS. My environment is Windows 7 Ultimate 64-bit and I am running v23.4.1, which I think is what the ESS package installed on my behalf.

Nearly a week in and so far it has been surprisingly painless, no more involved than any other significant piece of software. I have remapped my ctrl key to caps-lock, changed default folders, messed around with .emacs and made some additions such as auto-install, yasnippet, color-theme, icicles and a few others. Clearly there is some very sophisticated stuff out there. In addition of course certain features of base Emacs are immediately very powerful and useful, such as isearching up and down. On the whole I have been pleasantly surprised and reassured.

One thing that is cruder than I was expecting is the process of finding and opening files. After a cursory read of various tutorials I had this image of quasi-magical file location and filename auto-completion. The main directories in my setup have paths like g:/roaming/code/perl or g:/roaming/code/R/ but I often need to branch into completely different paths like g:/pricedata/support files/sector/project01/ and so on.

Currently I laboriously delete the file path when I need to take a different fork, then use auto-complete to move deeper into that branch of the filesystem. It kinda takes me back to running a bash shell on the Amiga twenty years ago.

What had I expected? Something like (using the above example) typing 'project01' to skip immediately into the folder at the bottom of the path. For some reason I had got the idea in my head that Emacs would preload directories. So maybe this wasn't realistic.

My guess is that my difficulties probably stem from my own lack of familiarity rather than a structural shortcoming in Emacs and leads on to my questions. I can't complain that there is not enough documentation; rather there is abundant information that it is scattered around rather haphazardly. Icicles has a similar problem - if anything there's too much.

1) What is the best tactic for moving around different branches of the file tree when trying to open files in the minibuffer or using some other method? Are there aliases that can be used to shortcut from one place to another or can one specify directories to be preloaded? Do people just cd around a lot? Or am I coming at this from completely the wrong angle and need to adopt a different strategy?

2) With additional setup, can auto-complete be used to find files in (say) the project01 directly above by prefixing with wildcards etc? What should I focus on to become more efficient here? Am I not tapping the power of add-ons like icicles, anything etc?

I realise these questions veer dangerously close the deprecated category of not having clear answers. My defence is that some tips/guidance at this stage before I commit myself to bad habits or a poor long-term solution would be welcome and I suspect the answers will benefit others who might be considering the switch. I am happy to withdraw or rephrase if there are problems.

解决方案

There are various approaches. File name cache is a built in solution. Opening files from recent files is also very effective, especially if you set the stored files to a high number (e.g. 1000). There are also packages for opening files from anywhere on the file system. And there are meta solutions like anything.el which can show you file completions from multiple sources (history, project files, etc.) in a common interface.

You should investigate the different options to find out which is the most suitable for you.

这篇关于Emacs:导航目录和打开文件的好策略是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆