Skip to content

Instantly share code, notes, and snippets.

@bpruitt-goddard
Last active May 14, 2020 22:09
Show Gist options
  • Save bpruitt-goddard/63ec60cd4c141f9242bee446311b751e to your computer and use it in GitHub Desktop.
Save bpruitt-goddard/63ec60cd4c141f9242bee446311b751e to your computer and use it in GitHub Desktop.
Emacs Journey

Emacs Journey

Current Configuration (Github)

Table Of Contents

Problem

Goals

Progress

Issues

Useful Shortcuts


Problem

Currently, I use VS Code for c#/backend development. This works well for the most part, but has a few issues that I would like to fix by pivoting to a new editor:

  1. Slow intellisense/autocomplete with VS Code + omnisharp. The hope is that emacs will provide a faster experience.
  2. Slowdown from the above slows the rest of my machine down, which is painful.
  3. Poor window/pane management. There is no easy keyboard shortcuts for creating/killing panes or windows
  4. Poor code navigation. VS Code does a bad job of tracking previous positions and has no native feature for storing bookmarks to jump between.

The goal is to learn emacs for developing c#. It can later be expanded to other languages, but the immediate focus is getting a specific workflow setup that can be used as my daily editor.


Goals

The goals of this are:

  1. Use emacs as primary editor for creating code modifications and reviewing code
  2. Make heavy use of keyboard shortcuts afforded by emacs to improve productivity with (1)
  3. Have a baseline configuration that can be modified to customize my experience as I continue to improve my emacs skills

Out of scope for initial learning, but might be focused on later:

  • Using emacs for git management. magit looks very powerful
  • Using emacs org-mode for note taking.
  • Debugging inside of emacs. Not currently supported for c#
  • Running projects from inside emacs. Or running the command line via a shell inside emacs

Progress

Here is where each incremental progress will be outlined

Overall progress

  1. Install emacs
  2. Basic file opening and navigation
  3. Get Vanilla Emacs config started
  4. Basic xah-fly-keys file controls
  5. Basic buffer controls
  6. Project loading/navigation
  7. Basic omnisharp code navigation
  8. omnisharp code refactoring/autocompletion
  9. Emacs file and directory controls
  10. Emacs file and directory searching and modification
  11. (Final Step) Reach out to other emacs users for input on my configuration/setup

--

Setup

The initial hurdle was deciding on which flavor of emacs to use as a starting point. I initially decided on doom-emacs as it bills itself as focusing on sane defaults and the ability to serve as a good foundation. It makes adding some features easier than vanilla emacs, which should hopefully speed up initial competency/usage of emacs. I may change to a different emacs flavor once I have the basics down and a better idea of how my setup will ultimately look.

After trying doom-emacs for a short while, I went back to the drawing board and decided to use vanilla emacs. doom-emacs was doing too many "black magic" things making it hard to debug when something went wrong. Initially, the idea of separate config files for organization sounded ideal, but using an org-mode config is proving to be easier as it is all in one place and I can easily document why I'm making the config changes I am.

Navigation

I originally ran through basic navigation of files and buffers (using evil). I'm expanding the shortcuts section here and learning the basics. Fortunately, there are many somewhat "isolated" sections/features of evil/vi, which makes it easy to learn a small bit at a time. At this point, I am using emacs/evil to try some text editing, with somewhat frequent stops to look up how a certain feature works.

One concern I have is not using the best tools for the job as there are many ways to perform actions. My hope is that the final step of reviewing my techniques with others will allow me to improve any bad spots.

Vanilla Emacs

After getting up to speed on evil/vi, I ran into a few issues with it not quite being dvorak-friendly. I discovered an alternative more ergonomic-friendly library xah-fly-keys that natively supports dvorak and re-organizes the keys to put the more frequently used commands in more finger-friendly locations. As I do not have any previous vi "baggage" at this point, I'm pivoting to learn these controls as well.

With this change, came the difficulty in getting it working with doom-emacs, as it is built around evil. When trying to get them to play nice together, I realized I didn't understand anything that doom-emacs was adding over vanilla emacs, and didn't like that. I have thus decided to go with vanilla emacs and build my config from there. This will be more work, but will allow me to add pieces as I learn them and ensure that I understand everything I'm changing.

To that end, I started an org file config.org to contain all of my configuration changes (linked at top). It will be the only way I modify emacs to ensure I can have the same experience on other machines.


Issues


Shortcuts

This section will keep track of the most used basic shortcuts to start using and reference back to for using emacs.

Xah Fly Keys

  • u - insert mode
  • f8 - command mode
  • In Command Mode
    • h,n,c,t - left, right, up, down
    • g,r - forward/back word
    • m,v - forward/back paren
    • a - execute command
    • ; - comment
    • q,j,k - cut, copy, paste
    • b - isearch
      • left,right - search forward/back
    • d,s - beginning/end of line, paragraph
    • space ctl h - list leader key commands
    • y - mark
    • space d/space b - beginning/end of buffer
    • f - undo
    • ctl g f - redo
    • Selections
      • 6 - select text block
      • 7 - select line
      • 8 - select current word
      • 9 - select between brackets/quotes
    • File Actions
      • space c n - new file
      • space t b - close
  • Buffers
    • 3 - unsplit all buffers
    • 4 - split down
    • space 4 - split right
    • w - change buffers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment