Skip to content

Instantly share code, notes, and snippets.

@t-chab
Last active November 22, 2016 06:01
Show Gist options
  • Save t-chab/5a86d3a18d4aa808187af93d4bfaab48 to your computer and use it in GitHub Desktop.
Save t-chab/5a86d3a18d4aa808187af93d4bfaab48 to your computer and use it in GitHub Desktop.
Simplified emacs startup file
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Begin file
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Package management
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'package)
(setq package-enable-at-startup nil)
;; Add MELPA repository
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") t)
;; Add Marmalade repository
;(add-to-list 'package-archives
; '("marmalade" . "https://marmalade-repo.org/packages/") t)
;; Added by Package.el. This must come before configurations of
;; installed packages. Don't delete this line. If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
(package-initialize)
;; Bootstrap `use-package'
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
;; Check and install missing packages if needed
(setq use-package-always-ensure t)
;; Checks for package update
(use-package auto-package-update
:config
(auto-package-update-maybe)
(setq auto-package-update-delete-old-versions t))
;; Nice mode line, with nice theme
(use-package smart-mode-line-powerline-theme
:config (setq sml/theme 'powerline))
(use-package smart-mode-line
:config (sml/setup))
;; Code completion
(use-package company
:config (add-hook 'after-init-hook 'global-company-mode))
;; Additional completion packages
(use-package company-ansible)
(use-package company-dict)
(use-package company-emoji)
(use-package company-lua)
(use-package company-quickhelp)
(use-package company-restclient)
(use-package company-shell)
(use-package company-try-hard)
(use-package company-web)
(use-package magit)
;; Helm for minibuffer completion
(use-package helm
:config (helm-mode 1)
(global-set-key (kbd "M-x") 'helm-M-x)
(global-set-key (kbd "M-y") 'helm-show-kill-ring))
;; Minimap
(use-package sublimity
:config (require 'sublimity)
(require 'sublimity-scroll)
; (require 'sublimity-map)
(sublimity-mode 1))
; (sublimity-map-set-delay 3))
;; Use custom theme
(use-package monokai-theme
:config (load-theme 'monokai t))
;; Multi terminal emulation
(use-package multi-term
:config (require 'multi-term))
(use-package markdown-mode)
(use-package markdown-preview-mode)
(use-package markdown-toc)
(use-package json-mode)
;; Bash completion setup
(use-package bash-completion
:config (require 'bash-completion)
(bash-completion-setup))
(use-package discover-my-major
:config (global-set-key (kbd "C-h C-m") 'discover-my-major)
(global-set-key (kbd "C-h M-m") 'discover-my-mode))
;; Nice package to automatically disassemble java .class files
(use-package autodisass-java-bytecode)
;; flyspell-popup flyspell-correct-helm
;; flymake-shell flymake-sass flymake-json flymake-jslint flymake-gjshint flymake-css
;; flycheck-pos-tip flycheck-package flycheck-color-mode-line flycheck-checkbashisms flycheck
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; End package managements
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Custom settings
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Org mode configuration
(require 'org)
(define-key global-map "\C-cl" 'org-store-link)
(define-key global-map "\C-ca" 'org-agenda)
(setq org-log-done t)
;; Change default font
(set-face-attribute 'default nil :font "Source Code Pro-9")
;; Disable toolbar
(if window-system
(tool-bar-mode -1)
)
;; Check TLS certs
(setq tls-checktrust t)
(setq gnutls-verify-error t)
;; Save whatever’s in the current (system) clipboard before
;; replacing it with the Emacs’ text.
;; https://github.com/dakrone/eos/blob/master/eos.org
(setq save-interprogram-paste-before-kill t)
;; Kill current buffer by default (without asking)
(global-set-key (kbd "C-x k") 'kill-this-buffer)
;; Always display column number in status line
(setq column-number-mode t)
;; Display line numbers in left margin
;(global-linum-mode nil)
;; Disable startup screens
(setq inhibit-startup-screen t)
(setq inhibit-startup-message t)
(setq inhibit-splash-screen t)
(setq initial-scratch-message nil)
;; Encoding and line endings
(prefer-coding-system 'utf-8)
(setq default-buffer-file-coding-system 'utf-8-unix)
;; No fucking tabs for indent
(setq-default indent-tabs-mode nil)
;; Indent with 4 spaces
(setq-default tab-width 4)
;; SSH by default for remote host access
(setq tramp-default-method "ssh")
;; Windows specific setup
(if (eq system-type 'windows-nt)
(progn
(set-face-attribute 'default nil :font "Consolas-9")
(add-to-list 'package-archives
'("melpa-stable" . "http://stable.melpa.org/packages/") t)
(setq multi-term-program "C:/Program Files/Git/bin/mintty.exe")
(require 'ssh-agency)
(setq tramp-verbose 10)
;; Make sure that the bash executable can be found
(setq explicit-shell-file-name "C:/Program Files/Git/usr/bin/bash.exe")
(setq shell-file-name explicit-shell-file-name)
(setenv "SHELL" shell-file-name)
(add-hook 'comint-output-filter-functions 'comint-strip-ctrl-m)
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment