在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):freetonik/castlemacs开源软件地址(OpenSource Url):https://github.com/freetonik/castlemacs开源编程语言(OpenSource Language):Emacs Lisp 100.0%开源软件介绍(OpenSource Introduction):Castlemacs: modern, minimalist Emacs for macOS ⌘Features
Table of Contents
IntroEmacs is Core principles
FAQIs Castlemacs compatible with non-macOS systems?
Yes! Nothing binds Castlemacs to macOS except for some conventions. As long as you have some key on your keyboard that can play a role of I don’t know Emacs. Can I use Castlemacs or is it hard?. You don’t need to know Emacs, but it will help. The goal of this project is to make a setup that is suitable for absolute beginners. Is this similar to Spacemacs? No. Spacemacs is a big, custom distribution with additional layers on top of Emacs. Castlemacs is simply a pre-configured Emacs. You don’t need to learn anything new if you know your way around Emacs. Will Castlemacs support <something>? Probably, unless it goes against the Core Principles. Feel free to open an issue. Does this setup work well in the terminal? It works, but it is not built for terminal use, since one of the Core Principles is to behave like a native macOS application. Why is it called Castlemacs? See Why this name? Where do I store my private config? You can store your regular private config in Why does Castlemacs uses the system clipboard separately from the kill ring? Kill ring system is powerful, but potentially confusing for newcomers. The way it is integrated with the system clipboard by default makes it even more confusing. For these reasons Castlemacs uses the system clipboard only (via the usual macOS key combinations), and keeps the kill ring system independently available to those who want it. InstallationInstall EmacsDownload Emacs from emacsformacosx.com. That’s it! Alternative version (advanced)The “simplest way” is the canonical Emacs distribution for macOS. However, it has a number of disadvantages:
If these are important to you, consider installing Mitsuharu Yamamoto’s port instead. brew tap railwaycat/emacsmacport
brew install emacs-mac --with-natural-title-bar
ln -s /usr/local/opt/emacs-mac/Emacs.app /Applications Install dependenciesCastlemacs relies on ripgrep to quickly search within a project. Install it: brew install ripgrep Castlemacs requires brew install aspell We also need `gnutls` — GNU Transport Layer Security (TLS) Library: brew install gnutls Install CastlemacsBackup current Emacs config (if exists), then clone Castlemacs from Github: mv ~/.emacs.d ~/.emacs.d.bak
git clone https://github.com/freetonik/castlemacs ~/.emacs.d Launch Emacs and wait for several minutes. On the first launch it will download and install packages. When it’s done and the status line in the bottom stops outputting text, restart Emacs. Don’t worry about warning messages on the first launch, they will go away after first restart. Setup keyboardI highly recommend changing Caps Lock to Control by going to System Preferences → Keyboard → Modifier Keys. This way you will have a more comfortable Control under your left pinky. If you use Japanese Magic Keyboard, then you don’t have to do anything, since Note to Mojave usersIn macOS Mojave Emacs build might fail due to some changes in Xcode command line tools. Xcode command line tools must be pointed to the release version of Xcode 10 instead of the beta version. Use xcode-select to accomplish this. UsageModifier keysCastlemacs takes advantage of two facts:
So,
In this document we’ll refer to keys with their common macOS names: Cmd, Alt, Ctrl. BasicsBasic combinations with
NavigationBasic movementButtons I, J, K, L form a natural alternative to arrow keys. You can move around by holding Cmd while using these keys, without leaving the home row (press Cmd with your right thumb). (See http://tonsky.me/blog/cursor-keys/ for some background and motivation.)
Moving textHold
Simple jumping within text
† “Beginning of line” is a smart command. It moves cursor to the first non-whitespace character. Press it again, and it moves cursor to the real beginning of line. You can keep pressing it to jump cursor between those two positions. Smart jumping within buffer and between buffersMany commands in Emacs write the current position into a mark ring. For example, if you were editing line 6, then performed a search with
Holding Search and replace
EditingWords and lines
Deleting text
Multiple cursors
† When no text is selected, While multiple cursors are active:
Learn about all features of multiple cursors at https://github.com/magnars/multiple-cursors.el IndentationEmacs is pretty good at indenting stuff automatically. Pressing
RegionCommand with apostrophe expands selection. Holding shift contracts it.
Window ManagementNote that in Emacs-talk, a pane is called a Splitting windowsThese bindings are based on default Emacs conventions, but save you one keypress. Also,
Moving between windowsMove left and right just like in iTerm. Hold shift to make it up and down.
Restoring window configurationThis is
Project ManagementCastlemacs uses Projectile for project management. There are a lot of features, and most of them are discoverable from the so-called “command map”.
Note that ‘Emacs default’ doesn’t make much sense in this context, since Projectile is not part of Emacs. I try to provide commonly used combinations for these cases: While in search mode:
GitGit gutterChanges to the current file are shown in the gutter on left side. You can change the appearance of those symbols: search for MagitCastlemacs uses Magit, a wonderful package that aspires to be a complete Git porcelain.
From this status window you can do everything. Here are the basic commands available within Magit status window:
There are cheat sheets available within Magit. Refer to Magit User Manuals for more info. Terminal (shell)There is a toggleable popup shell which is actually a full blown terminal emulator (
File tree and open buffers
ProgrammingLanguages and modesEmacs supports many programming languages by default. Castlemacs adds support for YAML, Markdown, Web mode (HTML, CSS, PHP, templating, etc), Emmet. Feel free to add more features by sending a PR or opening an issue. Code completionCode completion popup shows up immediately when possible. When popup is active:
Note that not all backends support the last two commands. This feature is provided by Company mode package. Learn more about Company mode at http://company-mode.github.io/ Emmet
Learn more about emmet mode. Spellchecking, thesaurus, definitionSpellcheckingSpellchecking requires an external command to be available. See Install dependencies.
The last three lines in the popup allow to add current word to your personal dictionary or accept it as correct for current session (as long as Emacs is open) or current buffer. When correcting via list, you can press Note that personal dictionary is located at ThesaurusYou can quickly search for synonyms. This requires an internet connection since the package uses https://www.powerthesaurus.org/ as backend.
Select a synonym and press Word definitionThis requires an internet connection.
Org modeOrg mode is for keeping notes, maintaining TODO lists, planning projects, and authoring documents with a fast and effective plain-text system. Learn more about Org at https://orgmode.org/. (Caution! This is a black hole!) Castlemacs provides some nice defaults:
Put your org files in ln -s ~/Dropbox/Org ~/org Org agenda looks inside all the files in Why this name?Castlemacs takes advantage of the heavily used Command key on macOS. The Command key icon ⌘ is a ‘looped square’: it’s known as the place of interest sign when used on information signs, a practice which started in Finland in the 1950s, spreading to the other Nordic countries in the 1960s. The symbol is derived from a shape of a castle. Here, for example, is the Borgholm Castle in Sweden: |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论