;;;; -*- emacs-lisp -*-

(menu-bar-mode -1)
(if (fboundp 'tool-bar-mode)
    (tool-bar-mode -1))
(if (fboundp 'scroll-bar-mode)
    (scroll-bar-mode -1))

(show-paren-mode t)
(line-number-mode t)
(column-number-mode t)
(delete-selection-mode t)

(setq-default indent-tabs-mode nil
              show-trailing-whitespace t)

(setq auto-save-default nil
      make-backup-files nil
      initial-scratch-message nil
      inhibit-startup-message t
      scroll-margin 2
      scroll-step 1
      scroll-conservatively 999
      cperl-indent-level 4
      cperl-continued-statement-offset 4
      cperl-invalid-face nil
      linum-format "%4d \u2502 "
      ediff-split-window-function 'split-window-horizontally
      large-file-warning-threshold nil)

(fset 'yes-or-no-p 'y-or-n-p)

(define-key global-map (kbd "RET")
  'reindent-then-newline-and-indent)

(global-set-key "\C-w" (lambda (arg) (interactive "p")
                  (if (region-active-p)
                      (kill-region (point) (mark))
                    (backward-kill-word arg))))

(mapc
 (lambda (pair)
   (if (eq (cdr pair) 'perl-mode)
       (setcdr pair 'cperl-mode)))
 (append auto-mode-alist interpreter-mode-alist))

(add-hook 'c-mode-hook
          (lambda ()
            (setq indent-tabs-mode t)
            (c-set-style "linux")))

(add-to-list 'auto-mode-alist '("\\.sls\\'" . yaml-mode))

(set-background-color "black")
(set-foreground-color "white")

(custom-set-faces
 '(cperl-array-face ((nil (:foreground "red" :weight bold))))
 '(cperl-hash-face ((nil (:foreground "magenta" :weight bold))))
 '(cperl-nonoverridable-face ((((class color) (background dark)) (:foreground "green"))))
 '(custom-variable-tag ((t (:foreground "cyan" :weight bold))))
 '(font-lock-builtin-face ((((class color) (min-colors 8)) (:foreground "green" :weight bold))))
 '(font-lock-comment-face ((((class color) (min-colors 8)) (:foreground "red"))))
 '(font-lock-constant-face ((((class color) (min-colors 8)) (:foreground "yellow" :weight bold))))
 '(font-lock-function-name-face ((((class color) (min-colors 8)) (:foreground "green" :weight bold))))
 '(font-lock-keyword-face ((((class color) (min-colors 8)) (:foreground "cyan" :weight bold))))
 '(font-lock-string-face ((((class color) (min-colors 8)) (:foreground "cyan"))))
 '(font-lock-variable-name-face ((((class color) (min-colors 8)) (:foreground "yellow" :weight bold))))
 '(isearch ((t (:background "magenta"))))
 '(lazy-highlight ((t (:background "blue"))))
 '(link ((t (:foreground "cyan" :underline t))))
 '(link-visited ((t (:inherit link :foreground "magenta"))))
 '(minibuffer-prompt ((t (:foreground "cyan" :weight bold))))
 '(shadow ((t (:foreground "yellow"))))
 '(show-paren-match ((t (:foreground "red" :weight bold))))
 '(show-paren-mismatch ((t (:background "red" :foreground "yellow" :weight bold))))
 '(smerge-markers ((t (:background "white" :foreground "black"))))
 '(whitespace-empty ((t (:foreground "red"))))
 '(whitespace-hspace ((t (:background "red" :foreground "white" :weight bold))))
 '(whitespace-indentation ((t (:background "red" :foreground "yellow" :weight bold))))
 '(whitespace-line ((t (:foreground "magenta"))))
 '(whitespace-newline ((t (:foreground "red" :weight bold))))
 '(whitespace-space ((t (:background "yellow" :foreground "white" :weight bold))))
 '(whitespace-space-after-tab ((t (:background "red" :foreground "yellow" :weight bold))))
 '(whitespace-space-before-tab ((t (:background "red" :foreground "yellow" :weight bold))))
 '(whitespace-tab ((t (:background "yellow" :foreground "white" :weight bold))))
 '(whitespace-trailing ((t (:background "red" :foreground "yellow" :weight bold)))))
