Skip to content

Instantly share code, notes, and snippets.

@gutschilla
Created April 6, 2016 13:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gutschilla/b80dbcc6a557ed2c799a293f4b66ed87 to your computer and use it in GitHub Desktop.
Save gutschilla/b80dbcc6a557ed2c799a293f4b66ed87 to your computer and use it in GitHub Desktop.
my emacs config
;; backup files
(setq backup-directory-alist `(("." . "~/.saves")))
(setq backup-by-copying t)
(setq delete-old-versions t
kept-new-versions 6
kept-old-versions 2
version-control t)
;; packages
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
("org" . "http://orgmode.org/elpa/")
("marmalade" . "http://marmalade-repo.org/packages/")
("melpa-stable" . "http://melpa-stable.milkbox.net/packages/")))
(package-initialize)
(defun require-package (package)
(setq-default highlight-tabs t)
"Install given PACKAGE."
(unless (package-installed-p package)
(unless (assoc package package-archive-contents)
(package-refresh-contents))
(package-install package)))
(require 'evil)
(evil-mode 1)
(require 'neotree)
(global-set-key [f2] 'neotree-toggle)
(add-hook 'neotree-mode-hook
(lambda ()
(define-key evil-normal-state-local-map (kbd "TAB") 'neotree-enter)
(define-key evil-norm
al-state-local-map (kbd "SPC") 'neotree-enter)
(define-key evil-normal-state-local-map (kbd "q") 'neotree-hide)
(define-key evil-normal-state-local-map (kbd "RET") 'neotree-enter)))
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(custom-safe-themes
(quote
("b7d8a2b21cac06c88b4c214cad7b61fbdebe95d824b6121809e9d846ada3cd2e" default)))
'(inhibit-startup-screen t)
'(send-mail-function (quote smtpmail-send-it))
'(smtpmail-smtp-server "webtropia1.gutsch.it")
'(smtpmail-smtp-service 587))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
(autoload 'markdown-mode "markdown-mode"
"Major mode for editing Markdown files" t)
(add-to-list 'auto-mode-alist '("\\.text\\'" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))
(setq default-tab-width 2)
(require 'helm)
(require 'helm-config)
;; The default "C-x c" is quite close to "C-x C-c", which quits Emacs.
;; Changed to "C-c h". Note: We must set "C-c h" globally, because we
;; cannot change `helm-command-prefix-key' once `helm-config' is loaded.
(global-set-key (kbd "C-c h") 'helm-command-prefix)
(global-unset-key (kbd "C-x c"))
(define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action) ; rebind tab to run persistent action
(define-key helm-map (kbd "C-i") 'helm-execute-persistent-action) ; make TAB works in terminal
(define-key helm-map (kbd "C-z") 'helm-select-action) ; list actions using C-z
(when (executable-find "curl")
(setq helm-google-suggest-use-curl-p t))
(setq helm-split-window-in-side-p t ; open helm buffer inside current window, not occupy whole other window
helm-move-to-line-cycle-in-source t ; move to end or beginning of source when reaching top or bottom of source.
helm-ff-search-library-in-sexp t ; search for library in `require' and `declare-function' sexp.
helm-scroll-amount 8 ; scroll 8 lines other window using M-<next>/M-<prior>
helm-ff-file-name-history-use-recentf t)
(helm-mode 1)
(require 'evil-leader)
(global-evil-leader-mode)
(evil-leader/set-leader ",")
(evil-leader/set-key
"e" 'find-file
"b" 'switch-to-buffer
"k" 'kill-buffer)
(require 'evil-surround)
(global-evil-surround-mode 1)
(evil-commentary-mode)
; have _ be included as word
(defadvice evil-inner-word (around underscore-as-word activate)
(let ((table (copy-syntax-table (syntax-table))))
(modify-syntax-entry ?_ "w" table)
(with-syntax-table table
ad-do-it)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment