summaryrefslogtreecommitdiff
path: root/emacs/.config/emacs-kj/lisp/kj-defaults.el
blob: a5ced960e88d102ab96521ea2deaf6e87cb408c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
;;; -*- lexical-binding: t; -*-

;; Backups
(make-directory "~/.cache/emacs_backups/" t)
(make-directory "~/.cache/emacs_autosave/" t)
(setq backup-directory-alist '(("." . "~/.cache/emacs_backups/")))
(setq auto-save-file-name-transforms '((".*" "~/.cache/emacs_autosave/" t)))

;; Keep backups, but avoid same directory since it can be slow on tramp.
(setq version-control t
      delete-old-versions -1
      vc-make-backup-files t
      create-lockfiles nil
      backup-by-copying t)

(setq-default indent-tabs-mode nil)
(setq sentence-end-double-space nil)
(setq save-interprogram-paste-before-kill t)
(setq mouse-yank-at-point t)
(setq enable-recursive-minibuffers t)
(set-language-environment "utf-8")
(setq require-final-newline t)
;; Save bookmark list every time a bookmark is added.
(setq bookmark-save-flag 1)
(delete-selection-mode 1)

(savehist-mode 1)

;; Resize settings
(setq frame-inhibit-implied-resize t)
(setq pixel-scroll-precision-mode t)

(setq kill-whole-line t)

(defun kj/kill-word-or-region (arg)
  (interactive "p")
  (if (region-active-p)
      (kill-region (region-beginning) (region-end))
    (backward-kill-word (or arg 1))))
(global-set-key (kbd "C-w") 'kj/kill-word-or-region)

(defun kj/open-line (n)
  (interactive "*p")
  (beginning-of-line)
  (open-line n)
  (indent-according-to-mode))
(global-set-key (kbd "C-o") 'kj/open-line)

(provide 'kj-defaults)