Some actions needs to be done to prepare a good base for the rest of the configuration.
(setq user-full-name "Stefan Eichberger"
user-mail-address "[email protected]")
http://www.emacswiki.org/emacs-en/LoadPath I like the approach to define which packages (sub directory) should be loaded.
(let ((default-directory "~/.emacs.d/elisp/"))
(normal-top-level-add-to-load-path '("use-package")))
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
The use-package is a really great way to have a tidy installation and configuration of your packages.
(package-refresh-contents)
(require 'use-package)
(setq backup-directory-alist '(("." . "~/.emacs.d/backups")))
I agree here with Sacha to save a lot but for me following is enough.
(setq delete-old-versions -1)
(setq version-control t)
(setq auto-save-file-name-transforms '((".*" "~/.emacs.d/auto-save-list" t)))
I have to read up on this history settings. http://www.wisdomandwonder.com/wordpress/wp-content/uploads/2014/03/C3F.html I remeber reading this but not in detail. I disable this for now.
(setq savehist-file "~/.emacs.d/savehist")
(savehist-mode 1)
(setq savehist-save-minibuffer-history 1)
(setq savehist-additional-variables
'(kill-ring
search-ring
regexp-search-ring))
(when window-system
(tooltip-mode -1)
(tool-bar-mode -1)
(menu-bar-mode -1))
I just hate it when I insert from my mouse clipboard and it adds it at the mouse cursor and not my caret.
(setq mouse-yenc-at-point 't)
This makes the scolling with the mouse less irritating.
(setq redisplay-dont-pause t
scroll-margin 1
scroll-step 1
scroll-conservatively 10000
scroll-preserve-screen-position 1)
(setq mouse-wheel-follow-mouse 't)
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1)))
Solarize them is nice and highly advanded but I’m still found of it. this will brake !!!!
(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.
'(default ((t (:stipple nil :background "darkslategrey" :foreground "AntiqueWhite" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 137 :width normal :foundry "unknown" :family "DejaVu Sans Mono")))))
(setq inhibit-splash-screen t)
(fset 'yes-or-no-p 'y-or-n-p)
(setq-default indent-tabs-mode nil)
(setq-default tab-width 2)
(setq sh-basic-offset 2
sh-indentation 2)
(ido-mode t)
I like to have it vertically
(use-package ido-vertical-mode
:ensure ido-vertical-mode
:init
(ido-vertical-mode))
I want to clock into drawers
(use-package undo-tree
:ensure undo-tree
:init
(global-undo-tree-mode 1)
:config
(progn
(global-set-key (kbd "C-z") 'undo-tree-undo)
(global-set-key (kbd "C-S-z") 'undo-tree-redo)))
(use-package htmlize
:ensure htmlize)
Just awesome.
(use-package tramp
:ensure tramp
:config
(progn
(setq tramp-default-method "ssh"
tramp-default-user "eichberger"
ido-enable-tramp-completion t
tramp-backup-directory-alist backup-directory-alist
auto-save-file-name-transforms nil)
(tramp-set-completion-function "ssh"
'((tramp-parse-sconfig "~/.ssh/config")))))
Cleans up your mode line
(use-package smart-mode-line
:ensure smart-mode-line
:init
(sml/setup))
(use-package auto-complete
:ensure auto-complete
:init
(global-auto-complete-mode +1)
:config
(setq ac-auto-show-menu t
ac-quick-help-delay 0.5
ac-use-fuzzy t))
This is here by default but I put the configuration here
(setq ibuffer-saved-filter-groups
(quote (("default"
("files" (or
(mode . emacs-lisp-mode)
(mode . cperl-mode)
(mode . elpy-mode)
(mode . python-mode)
(mode . sh-mode)
(mode . conf-unix-mode)
(mode . conf-space-mode)
(mode . conf-mode)
(mode . fundamental-mode)
(mode . text-mode)))
("tramp" (or
(name . "^\/ssh")))
("eshells" (or
(name . "^\\*eshell")))
("confluence" (mode . confluence-mode))
("dired" (mode . dired-mode))
("emacs" (or
(name . "^\\*scratch\\*$")
(name . "^\\*Warnings\\*$")
(name . "^\\*Buffer List")
(name . "^\\*Completions\\*$")
(name . "^\\*Help\\*$")
(name . "^\\*\\*$")))))))
(add-hook 'ibuffer-mode-hook
(lambda ()
(ibuffer-switch-to-saved-filter-groups "default")))
;; (use-package ibuf-ext
;; :ensure ibuf-ext
;; :config
;; (progn
;; (add-to-list 'ibuffer-never-show-predicates "^\\*tramp")
;; (add-to-list 'ibuffer-never-show-predicates "^\\*helm")
;; (add-to-list 'ibuffer-never-show-predicates "^\\*Messages")
;; (add-to-list 'ibuffer-never-show-predicates "^\\*Backtrace")))
(global-set-key (kbd "C-x C-b") 'ibuffer)
an svn interface
(autoload 'svn-status "dsvn" "Run `svn status'." t)
(autoload 'svn-update "dsvn" "Run `svn update'." t)
jump around …
(require 'ace-jump-mode)
(define-key global-map (kbd "C-c SPC") 'ace-jump-mode)
I got used of Eshell which adds some nice possiblities to my daily work.
(defun eshell-new ()
(interactive)
(eshell (quote (-1))))
(global-set-key (kbd "s-t") 'eshell-new)
I want to edit a file if I’m using dired mode with sudo rights. Especially if I work remote.
(use-package dired+
:ensure dired+)
(defun sudo-edit-current-file ()
(interactive)
(let ((my-file-name) ; fill this with the file to open
(position)) ; if the file is already open save position
(if (equal major-mode 'dired-mode) ; test if we are in dired-mode
(progn
(setq my-file-name (dired-get-file-for-visit))
(find-alternate-file (prepare-tramp-sudo-string my-file-name)))
(setq my-file-name (buffer-file-name); hopefully anything else is an already opened file
position (point))
(find-alternate-file (prepare-tramp-sudo-string my-file-name))
(goto-char position))))
(defun prepare-tramp-sudo-string (tempfile)
(if (file-remote-p tempfile)
(let ((vec (tramp-dissect-file-name tempfile)))
(tramp-make-tramp-file-name
"sudo"
(tramp-file-name-user nil)
(tramp-file-name-host vec)
(tramp-file-name-localname vec)
(format "ssh:%s@%s|"
(tramp-file-name-user vec)
(tramp-file-name-host vec))))
(concat "/sudo:root@localhost:" tempfile)))
(define-key dired-mode-map [s-return] 'sudo-edit-current-file)
This is very handy.
(use-package expand-region
:ensure expand-region
:config
(global-set-key (kbd "C-=") 'er/expand-region))