No description, website, or topics provided.
Emacs Lisp C++ CMake Python Shell HTML
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
elpa
eshell
snippets/c++-mode
.gitattributes
.gitignore
README.org
custom.el
init.el
other-config.el
other-keybinds.el
simple-cpp.el
simple-multiple-cursors.el
simple-project.el
simple-python.el
simple-shell.el
simple-tabs.el

README.org

Simple Emacs for Simple Users

Introduction

GNU Emacs is a beast that cannot be tamed easily. But once you know its workarounds, it will be a place better than heaven. So, I have tried to convert this beast into a puppy that you will love using. If the puppy gets harsh on you then open an issue or send a pull request so that the beast becomes nicer than before.

Target users

This configuration is targeted towards new users who have been using modern editors like Sublime Text and want to see the power of Emacs.

If you are a Vim user then you might want to checkout Spacemacs which has everything setup top to bottom for Vim experience in Emacs.

If you are a power user and you want to squeeze out every functionality out of Emacs then you should go with Spacemacs which has far better support for grouping buffers and different window configurations.

Tested on GNU Emacs development build

It is recommended that you use Emacs development build instead of normal builds.

For Ubuntu:

sudo add-apt-repository ppa:ubuntu-elisp/ppa
sudo apt-get update
sudo apt-get install emacs-snapshot

For Arch Linux:

pacaur -S emacs-git

For Mac OS:

brew install emacs-mac --with-cocoa --with-xml2 --with-gnutls --with-imagemagick --with-glib --HEAD

It is better to compile from source but that is totally upto you.

Installing simple-emacs

If you have been using Emacs from before then backup your configurations:

mv ~/.emacs.d ~/.emacs.d.bak
mv ~/.emacs ~/.emacs.bak

Clone the simple-emacs repository using git:

git clone https://github.com/Compro-Prasad/simple-emacs.git ~/.emacs.d

Now open your Emacs and start doing your stuff.

Some conventions

  • C-x → Ctrl + X
  • M-x → Alt + X
  • C-S-x → Ctrl + Shift + X
  • C-M-x → Ctrl + Alt + X
  • M-S-x → Alt + Shift + x

C-g the Panic key

When you think you pressed the wrong key or Emacs isn’t responding then you can press C-g to cancel any action.

Creating and opening files

  • Press C-n or C-o to open or create a file. Both present you the same interface.
  • When creating files you need to enter file name first.
  • You can use up and down to switch between selections.
  • To get into a directory use right key on the selection.
  • To get back to previous directory use left key.
  • You can use TAB to list all possible actions on the selected candidate(s). Hit TAB again to hide the actions.

Multiple cursors

Work in progress.

Select next occuranceM-S-down
Select previous occuranceM-S-up
Select all occurancesC-;
Create cursor with mouseM-S-click

Undo and Redo

  • To undo a change press C-z or C-/.
  • There is no redo in Emacs, so when you use C-S-z it will open undo tree where you can navigate the undo history using up and down keys. To switch to different undo branch use left and right keys. To quit this state just press q.

Switching tabs and buffers

  • You can switch tabs using C-TAB and C-S-TAB.
  • To switch buffers use C-x C-right and C-x C-left.
  • You can switch to any buffer in any tab.
  • You can list buffers using C-x b which also shows you recently opened files.

Closing tabs and buffers

  • You can close tab using C-w which will also kill the buffers in the tab.
  • To close the tab but not the buffer you may try C-f4.
  • To kill the buffer but not the tab you can use C-x k.

Searching

  • C-f does forward search
  • C-S-f does backward search
  • C-r searches in a Git project. If it is not a Git repository then directory is asked first. For it to work in absence of git project install the_silver_searcher:

Ubuntu:

sudo apt install silversearcher-ag

Arch Linux:

sudo pacman -S the_silver_searcher

Shell

  • There are three shells in Emacs: shell, eshell and term
  • Default shell is eshell
  • Use C-l to clear eshell buffer
  • Pop up, switch or close shell using ~C-‘~
  • In Eshell, type use-theme to list and preview available themes
  • To customize shell behaviour look into simple-shell.el

C/C++ setup

Install clang++ on your distro for better experience. To auto compile a single C++ file your file should have:

/*= compile: g++ -std=c++11 -Wall -Werror -o $exe $src =*/
/*= run: $exe =*/

at top of your file. To insert this code snippet type compile (in the buffer and not in the M-x prompt) and hit TAB key.

If you are into competitive programming then you might want to try cp then hit TAB. For this you may need to create input.txt with program’s input.

Use F9 to run your single file programs.

Preview HTML pages

When you open an HTML file in Emacs you can see its live preview by going to http://localhost:8080/imp/.

Python

To make Emacs a Python IDE, you need to have anaconda_mode installed:

sudo pip2 install anaconda_mode   # For python2
sudo pip3 install anaconda_mode   # For python3

This will enable syntax checking and symbol completion for python files.

  • Find definitions using M-.
  • Find assignments using M-*
  • Find references using M-r
  • Jump back to previous location using ~M-,~
  • Activate virtual environment using M-x pyvenv-activate. Enter root directory of the virtual environment as input.
  • If you are using pipenv then you can easily do M-x pipenv-activate.

See official repository for more information on keybindings for jumping to definitions and stuff.

Toggling features

KeybindingFeatureFunction
C-S-t mMenu barmenu-bar-mode
C-S-t tTool bartool-bar-mode
C-S-t lLine numberslinum-mode
C-S-t sSyntax checkingflycheck-mode
C-S-t cCompletioncompany-mode