An Emacs configuration bundle.
This is Jen-Chieh Shen's emacs configuration. Repeatedly utilized and modified since 2015. Hopefully this will help someone who is new or struggling with Emacs. This configuration should works on most OSs, indicates Windows, Linux and MacOS.
Emacs itself supports multiple programming languages. I managed all the programming languages I personally used. I dabble in numerous technologies, incorporate hardware, firmware and software. Here is the list of programming languages I know and are extended from this configuration.
- ActionScript 2.0 or 3.0 / Assembly Language
- BASIC / Batchfile
- C / C++ / C# / Clojure / CMake / COBOL / CSS
- Elixir / Emacs Lisp / Erlang
- GLSL / Go / Godot Script
- Haskell / Haxe / HTML
- Lisp / Lua
- Makefile / Markdown
- Object Pascal (Delphi) / Objective-C
- Pascal / Perl / PHP / Properties / Python
- Ruby / Rust
- Sass / Scala / SCSS / Shader / Shell script / SQL / Swift
- Text / TypeScript
- Verilog / Vim script
I have experienced many different kinds of IDEs and text editors. But I’ve had a hard time finding the best tool to use. I’ve jumped from one working field to another trying to find something that suits my needs. So instead of struggling with the tool itself, I chose Emacs and configured the entire thing from scratch, to suit my needs.
Here are a few goals that I want this config to accomplished.
- Having the same set of key bindings across different IDEs and text editors as many as possible.
- Having the same font and theme across different OSs and environments.
- Automating trivial or redundant tasks.
- Improve user experiences approach to modern text editor or IDE.
- Make compatible to most features work inside terminal as well.
Having these implementations makes my life easier, and having a genuinely portable workspace, which is great because it lets me work on different machine efficiently, without having to get used to an new IDE.
The average startup time for this configuration is around
25 seconds. You can use command
to check the startup time on your machine. Not quite sure what
causes that much of performance, hopefully, I'm able to lower
the startup time down to
Edit 1: After version
5.3.2, the average startup time is
15 seconds. Solved this issue by removing
require keyword load file and use
use-package package to delay some packages load time.
Edit 2: If you compiled the source code then the startup
time can lower down more from
Edit 3: Using esup package
to test and optimize the configuration. Call
only when package installation is needed. By doing thing, lower
the startup time from around
This is the list of features that are built-in to this configuration. These features are heavily base on my personal habits, and so these could be very tiny things. But I believed detials make things better and make life smoother.
- Auto Install Package - Automatically installs the package that this config relies on.
- Auto Truncate Lines -
truncate-lines-modedepends on certain situation. (
- Better Dashboard - Implementation for improving experiences using dashboard.
- Buffer Menu Search -
Able to search in the
- Build Run - Implementation for executing script for building and running the software.
- Capital Word - You can navigate/kill word by seeing capital letter.
- Consistent Key Bindings - Has consistent key bindings across all modes.
- Curly Bracket Modes - Use curly bracket depends on different mode.
- Display File -
Utility function to use to view a file on the other window.
- Charset Table - Built-in functions that displays character sets.
- Docstring Completion - Some standard docstring completion implementations built-in to this configuration.
- Fast Incremental Search - Fast keys for incremental search forward/backward to the cursor is currently pointing.
- Indent Move - Automatically indent when cursor moves up and down.
- Line Numbers Modding -
Mixed used of
display-line-numbers-modebase on the file usage.
- Mini State -
Mini mode state use to visually see what backend is the
config currently running.
- Auto Switch State - Automatcially switch mini state depends on certain circumstances.
Mode Line Toggle - Toggle to
hidethe mode line.
- Modern Text Editor - Design to have the preset settings close to modern text editors but faster.
- Navigate Blank Line -
C-<down>to navigate previous and next blank line.
- Navigate Table -
org-mode's table easier by using arrow keys.
- Preview HTML - Preview rendered HTML file on the other window.
- Simulate Shell - Completely simulate shell behaviors, make better user experience when using shell in Emacs.
- Switch Window - Fast keys switch between windows quickly.
- Tabify/Untabify Modes - Tabify or Untabify the file depends on the mode you currently in.
- Transparent Window - Keys to increase/decrease the transparency of the frame.
- Trim Trailing Whitespace - Remove trailing spaces and tabs automatically on save.
- Visualize Undo/Redo -
Improved the user experience on undoing and redoing by
undo-tree-visualizerat the other window.
- VS Curly Bracket - Visual Studio IDE like curly bracket implementation.
- VS Multiple Cursors -
VSCode like methods to
- VS Navigate Word - Visual Studio IDE like navigating between word implementation.
A list of package archives that this configuration uses.
- elpa - The default package repository for GNU Emacs.
marmalade - Marmalade is an ELPA compatible package repository that allowed users to upload their own packages.
- melpa -
MELPA is a growing collection of
package.el-compatible Emacs Lisp packages built automatically on our server from the upstream source code using simple recipes.
P.S. Here is a good talk comparing all package archives from a StackExchange question, What are the practical differences between the various Emacs Package Repositories? answered by Tikhon Jelvis.
Here is the list of all packages that powered and make this configuration works. Thanks to all the package maintainers; this configuration cannot be made without them, and if you wish to support them you can go to this elisp-maintainers repo/site and search for the maintainer you want to support. There should be some kind of methods that you could support the maintainer you want.
- Abbreivation Definition - powered by project-abbrev.
- Alt-Codes - powered by alt-codes.
- Auto Completion - powered by company.
- Auto Highlight Symbol - powered by auto-highlight-symbol-mode.
- Banner - powered by dashboard.
- Binary/Hex Editor - powered by nhexl-mode.
- Collaborative Editing - powered by togetherly.
- Context Menu - powered by right-click-context.
- Docstring - none, built-in to this configuration.
- End of Line - powered by show-eol.
- Execute Commands - powered by compile.
- File Explorer - powered by sr-speedbar.
- File Header - powered by file-header.
- Folding/Unfolding - powered by origami.
- Font - powered by use-ttf.
- Goto Char - powered by goto-char-preview.
- Goto Declaration/Definition - powered by dumb-jump.
- Goto Line - powered by goto-line-preview.
- Highlight Indentation - powered by highlight-indent-guides.
- Highlight Matched Pairs - powered by show-paren-mode.
- Highlight Same Region - powered by region-occurrences-highlighter.
- Line Annotation - powered by line-indicators.
- Line Numbers - powered by display-line-numbers and linum.
- Minimap - powered by sublimity.
- Mode Line - powered by powerline.
- Multiple Cursor - powered by iedit and multiple-cursors.
- Multiple Shell - none, planning in the future.
- Navigation/Searcher - powered by ag and isearch-project.
- Package Archive - powered by gnu and melpa.
- Package Management - powered by use-package.
- PDF Viewer - powered by doc-view-mode and ghostscript.
- Project Search - powered by projectile.
- Recent Files - powered by recentf.
- Regexp - powered by re-builder.
- Reload Emacs - powered by reload-emacs.
- Restart Emacs - powered by restart-emacs.
- Scroll Bar - powered by yascroll.
- Shell - powered by shell and exec-path-from-shell.
- Simplify Usage - powered by helm.
- Smooth Scrolling - powered by sublimity.
- Snippet - powered by yasnippet.
- Source Control Management - powered by magit.
- Startup Screen - powered by dashboard.
- Syntax Check - powered by flycheck.
- Tab Bar - powered by centaur-tabs.
Tags - powered by gtags.
- Text Editing - powered by org-mode.
- Theme - none, self customized but close to Visual Studio IDE's themes.
- Todo - powered by hl-todo.
- Toggle Mode Line - powered by feebleline.
- Undo/Redo - powered by undo-tree.
- White Space - powered by whitespace.
If you want to change the default mode to certain file type,
you might want to checkout the
You will see a list of mode that are opened by default mode to
|ActionScript 2.0 or 3.0||actionscript-mode||A simple mode for editing Actionscript 3 files|
|Assembly Language||nasm-mode||NASM x86 assembly major mode|
|BASIC||basic-mode||major mode for editing BASIC code|
|Batchfile||bat-mode||Major mode for editing Dos scripts (batch files)|
|C||c-mode||Major mode for editing C code.|
|C++||c++-mode||Major mode for editing C++ code.|
|C#||charp-mode||A major-mode for editing C# in emacs|
|Clojure||clojure-mode||Major mode for Clojure code|
|CMake||cmake-mode||major-mode for editing CMake sources|
|COBOL||cobol-mode||Mode for editing COBOL code|
|CSS||css-mode||Major mode to edit CSS files|
|Dart||dart-mode||Major mode for editing Dart files|
|Elixir||elixir-mode||Major mode for editing Elixir files|
|Emacs Lisp||elisp-mode||Emacs Lisp mode|
|Erlang||erlang-mode||Major modes for editing and running Erlang|
|GLSL||glsl-mode||major mode for Open GLSL shader files|
|Go||go-mode||Major mode for the Go programming language|
|Godot Script||gdscript-mode||Major mode for editing Godot GDScript files|
|Haskell||haskell-mode||A Haskell editing mode|
|Haxe||haxe-mode||An Emacs major mode for Haxe|
|HTML||web-mode||major mode for editing web templates|
|JSON||json-mode||Major mode for editing JSON files.|
|Java||java-mode||Major mode for editing Java code.|
|Lisp||lisp-mode||Major mode for editing Lisp code for Lisps other than GNU Emacs Lisp.|
|Lua||lua-mode||a major-mode for editing Lua scripts|
|Makefile||makefile-mode||A major mode for editing makefiles.|
|Object Pascal (Delphi)||opascal-mode||major mode for editing Object Pascal source in Emacs|
|Objective-C||objc-mode||Major mode for editing Objective C code.|
|Pascal||pascal-mode||Major mode for editing Pascal source in Emacs.|
|Perl||perl-mode||Major mode for editing Perl code.|
|PHP||web-mode||major mode for editing web templates|
|Properties||conf-javaprop-mode||Conf Mode starter for Java properties files.|
|Python||python-mode||Python major mode|
|Ruby||ruby-mode||Major mode for editing Ruby code.|
|Rust||rust-mode||A major emacs mode for editing Rust source code|
|Shader||shader-mode||Major mode for shader|
|Sass||ssass-mode||Edit Sass without a Turing Machine|
|Scala||scala-mode||Major mode for editing Scala|
|SCSS||scss-mode||Major mode for editing SCSS files|
|Shell script||sh-mode||Major mode for editing shell scripts.|
|SQL||sql-mode||Major mode to edit SQL.|
|Swift||swift-mode||Major-mode for Apple's Swift programming language.|
|TypeScript||typescript-mode||Major mode for editing typescript|
|Verilog||verilog-mode||Major mode for editing Verilog code.|
|Vim script||vimrc-mode||Major mode for vimrc files|
|XML||nxml-mode||Major mode for editing XML.|
|YAML||yaml-mode||Simple mode to edit YAML.|
|gitattributes||gitattributes-mode||Major mode for editing .gitattributes files|
|gitconfig||gitconfig-mode||Major mode for editing .gitconfig files|
|gitignore||gitignore-mode||Major mode for editing .gitignore files|
|Markdown||markdown-mode||Major mode for Markdown-formatted text|
|Org||org-mode||Outline-based notes management and organizer|
P.S. The awesome-emacs is a list of Emacs package that you can choose other alternatives to replace any similar packages listed here. Is also a good place to seek and learn what's inside Emacs!
This configuration have all modes bind to the same set of
key bindings. It benefits the developer would not need to change
their key bindings while after the mode swichted. The key bindings
set can be check in
- My work requires me to use Visual Studio IDE that being said the key bindings set are most likely compatible to Visual Studio IDE.
- Excepts keys that bind to
C-c, Emacs are deeply binds to these two keys, and many packages also use these two keys for there preset keys. As you may know these two keys are often
copy, is awkward that I solved this by adding the same key stroke once again, hence the
C-x C-xand the
The theme was to design close to
Visual Studio IDE
preset light/dark theme. I believed
has a great UI/UX team, since I don't have any experience
or work related to UI/UX, I would just like to have the
theme color as close to it as possible. Anyway, if you
want to customize the theme yourself, then check out the
./.emacs.jcs/jcs-theme.el file. All the theme related
variables can be found in that file.
|Light Theme||Dark Theme|
use-ttf package to keep cross OS consistency.
The default font is
Ubuntu Mono and loaded by using
UbuntuMono-R.ttf located under
folder. If you don't like the this font, you can add your
.ttf file and add the path to
use-ttf-default-ttf-fonts list. Lastly, set the name
.ttf file to
- See the file
./.emacs.jcs/jcs-plugin.elto see how the font is been set in
- For more details about the font settings in this
configuration, check out the
There are two ways to install the configuration on to your machine; it depends on if the internet is available to you.
To install, clone this repo and copy the core
to the emacs config directory accordingly. Make sure you backup
your own configuration before you start the installation.
# clone this repo $ git clone https://github.com/jcs090218/jcs-emacs-init.git # change current directory to project directory $ cd jcs-emacs-init # copy init file to home $ cp ./.emacs ~/ # copy core directories to home $ cp -r ./.emacs.d ~/ $ cp -r ./.emacs.jcs ~/
Then startup Emacsm then it will start asking you to install all necessary packages due to this configuration.
!! [ATTENTION] !! -- MAKE SURE YOU INSTALLED THE CORRECT VERSION OF EMACS!
If the internet isn't available to you, just download a copy
of the configuration from the release tab
. You will see these following files, and extract them to your
HOME directory or the directory that Emacs will start loading
Install it this way; you wouldn't need to be asked to install all necessary packages. So this may be faster or benefits to you.
If you would like to optimize the configuration, you can
run the following command compile all the source code to
byte code so Emacs can run faster during both
# change directory to the `jcs` config directory $ cd ./.emacs.jcs # compile all the config source code $ emacs --batch --eval "(byte-recompile-directory \"./\" 0)"
Supported Emacs versions
The config should run on Emacs 24.3 or higher, but I will recommend to always run on the latest Emacs version available on your machine. The ultimate goal is to design to have each version of config can run on their each according Emacs version base on the version what I'm currently running on my present machine. For each version record, you can check the version_record file at the root of the project directory.