Skip to content

Instantly share code, notes, and snippets.

@tr37ion
Last active August 29, 2015 14:16
Show Gist options
  • Save tr37ion/adafb642b206064cf81c to your computer and use it in GitHub Desktop.
Save tr37ion/adafb642b206064cf81c to your computer and use it in GitHub Desktop.
A small Emacs config file for (fast) CLI file editing
;; ------------------------- Emacs CLI config ------------------------
;; I use this Emacs config for CLI editing files. Some things you see
;; can be deleted in favor of faster loading times. I use it as it is
;; for convenience. Use an shell alias to start emacs from CLI eg:
;; # alias eml='emacs -Q -nw -L .emacs-light'
;; Feel free to change it to you needs. If you find something useful
;; or code not needed/outdated please let me know. Have fun!!!
;; -------------------------------------------------------------------
;; Prepare package management
(require 'package)
;; Initialize package management
(add-to-list 'load-path "~/.emacs.d/elisp")
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
;; Start Package Initialization
(package-initialize)
;; js2: JavaScript mode
(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))
(add-to-list 'interpreter-mode-alist '("node" . js2-mode))
;; Some editor settings
(tool-bar-mode 0)
;(flyspell-mode 1)
(flycheck-mode 1)
(column-number-mode 1)
(visual-line-mode 1)
(show-paren-mode 1)
(auto-fill-mode 1)
(set-default 'cursor-type 'box)
(add-hook 'after-init-hook #'global-flycheck-mode)
;; ido: faster file navigation
(ido-mode 1)
;; smex: mode for M-X imode style minibuffer
(require 'smex)
(smex-initialize)
(global-set-key (kbd "M-x") 'smex)
(global-set-key (kbd "M-X") 'smex-major-mode-commands)
(global-set-key (kbd "C-c M-x") 'smex-update)
(global-set-key (kbd "C-C C-c M-x") 'execute-extended-command)
;; company-mode: Company is a text completion framework for Emacs. The name stands for "complete anything". It uses pluggable back-ends and front-ends to retrieve and display completion candidates. (http://company-mode.github.io/)
(company-mode 1)
;; loccur: Provides is a minor mode for Emacs acting like occur but without creating a new window.
;; It just hides all the text except lines containing matches for a given regexp. (https://github.com/fourier/loccur)
(require 'loccur)
;; defines shortcut for loccur of the current word
(define-key global-map [(control o)] 'loccur-current)
;; defines shortcut for the interactive loccur command
(define-key global-map [(control meta o)] 'loccur)
;; defines shortcut for the loccur of the previously found word
(define-key global-map [(control shift o)] 'loccur-previous-match)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment