Skip to content

mhibti/emacs.d

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Emacs configuration

Bootstraping and tools

Packages

Package sources

(require 'package)

Use MELPA as primary source

(add-to-list 'package-archives
             '("melpa" . "https://stable.melpa.org/packages/"))

Add org-contrib repo.

(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/"))

We’re all set up.

(package-initialize)

use-package

Don’t forget to install use-package. use-package is the core of this config.

(unless (package-installed-p 'use-package) (package-install 'use-package))

Tuning defaults

Turning off menubar

As a heavy keyboard user, I never used the menubar anyway.

(menu-bar-mode -1)

Enabling downcase and upcase region commands

I’m not sure why beginners find downcase-region and upcase-region commands confusing. Let’s enable them.

(put 'downcase-region 'disabled nil)
(put 'upcase-region 'disabled nil)

Deleting trailing whitespaces before save

(add-hook 'before-save-hook 'delete-trailing-whitespace)

Customize

Customizations will be stored in customizations.el

(use-package customizations
  :defer t
  :init
  (setq custom-file (locate-user-emacs-file "customizations.el"))
  (load custom-file))

Moving between windows

At first default keybinding for moving between windows (C-x o) looked strange for me. So I opted to use windmove library, which allows to select windows using shift + arrow keys. (S-left and so on).

(use-package windmove
  :config
  (windmove-default-keybindings))

Saving sessions

When it comes to session persisting, Emacs, no surprise, already has a solution. Built-in desktop library provides such functionality.

(use-package desktop
  :init
  (desktop-save-mode t))

Features

Command completion

Ivy

This config uses Ivy as completion frontend.

(use-package ivy :ensure t)

Other completion functions

(use-package counsel :ensure t)

(use-package counsel-projectile
  :ensure t
  :bind
  ("C-x C-p" . counsel-projectile-find-file)
  ("C-x C-o" . counsel-projectile-ag))

M-x enhancement

(use-package smex
  :ensure t
  :bind
  ("M-x" . smex))

Project interaction

(use-package projectile
  :init
  (projectile-mode))

Switch to project buffers using projectile-switch-to-buffer, fallback to switch-to-buffer otherwise.

(use-package akhramov-projectile-switch-to-buffer
  :load-path
  (lambda () (locate-user-emacs-file "packages"))
  :bind
  ("C-x b" . akhramov-projectile-switch-to-buffer))

Editing plugins

Drop-in replacement for standard comment-dwim

(use-package comment-dwim-2
  :ensure t
  :bind
  ("M-;" . comment-dwim-2))

Multicursor support

(use-package multiple-cursors
  :ensure t
  :bind
  ("M-]" . mc/mark-next-like-this))

Linting

(use-package flycheck
  :ensure t
  :init
  (add-hook 'after-init-hook 'global-flycheck-mode))

VCS

Git

(use-package magit :ensure t)

Shells, terminals etc

Eshell fish-like autosuggestions

(use-package esh-autosuggest
  :hook (eshell-mode . esh-autosuggest-mode)
  :ensure t)

I used to run terminals in Emacs for long. Let’s take a step towards eshell. Meshelle glues projectile and eshell with ivy.

(use-package meshelle
  :load-path
  (lambda () (locate-user-emacs-file "packages"))
  :bind
  ("C-x p" . meshelle))

Org

(use-package org-mode
  :ensure org-plus-contrib
  :bind ("C-c a" . org-agenda))
(use-package org-wild-notifier
  :ensure t
  :init (org-wild-notifier-mode))

Misc

Alerts

(use-package alert :ensure t)

Wild notifier. Spiky, but works. Upon click wild-notifier

  1. Focuses terminal
  2. Executes commands (e.g. switch-buffer)
(when (string-equal system-type "darwin")
  (use-package wild-notifier
    :init (setf alert-default-style 'wild)
    :load-path (lambda () (locate-user-emacs-file "packages"))))

Languages

Agda

(use-package agda2-mode
  :mode "\\.agda\\'"
  :load-path
  (lambda () (file-name-directory (shell-command-to-string "agda-mode locate")))
  :init
  (bind-key "C-c ." 'agda2-goal-and-context-and-inferred)
  (bind-key "C-c C-s" 'agda2-solve-maybe-all))

C / C++

I don’t always write C code, but when I do it’s always in Ruby style

(use-package ruby-style
  :load-path
  (lambda () (locate-user-emacs-file "packages/vendor")))

Elm

(use-package elm-mode :ensure t)

Javascript

(use-package js2-mode
  :ensure t
  :init
  (add-hook 'js-mode-hook 'js2-minor-mode))

Lisps

Parens and indentation with parinfer:

(use-package parinfer
  :ensure t
  :init
  (progn
    (setq parinfer-extensions
          '(defaults       ; should be included.
            pretty-parens  ; different paren styles for different modes.
            smart-yank))   ; Yank behavior depend on mode.
    (add-hook 'clojure-mode-hook #'parinfer-mode)
    (add-hook 'emacs-lisp-mode-hook #'parinfer-mode)
    (add-hook 'common-lisp-mode-hook #'parinfer-mode)
    (add-hook 'scheme-mode-hook #'parinfer-mode)
    (add-hook 'lisp-mode-hook #'parinfer-mode)))

Ruby

(use-package enh-ruby-mode
  :ensure t
  :init
  (add-hook 'ruby-mode-hook 'enh-ruby-mode))

Vue

(use-package vue-mode :ensure t)

Theme

This theme is as cool as it sounds

(use-package cyberpunk-theme
  :ensure t
  :defer t
  :init
  (load-theme 'cyberpunk t))

Tweak modline with smart-mode-line package

(use-package smart-mode-line
  :ensure t
  :defer t
  :config
  :init
  (setq sml/theme 'respectful)
  (sml/setup))

About

My emacs configuration

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Emacs Lisp 100.0%