summaryrefslogtreecommitdiff
path: root/emacs/.emacs
blob: 232b2e5a98abb36bf911d178b660923ae3c870b3 (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
;; Package init and install
(require 'package)
(add-to-list 'package-archives
             '("melpa" . "https://melpa.org/packages/"))
(package-initialize)

(defvar packages (list
                   'use-package
                   'geiser-chez
		   'geiser-racket
                   'company
                   'nix-mode
                   'lsp-mode
                   'magit
                   ))

(mapc (lambda (pack)
        (unless (package-installed-p pack)
          (package-install pack))
        ) packages)

(require 'use-package)
(require 'nix-mode)
(require 'magit)

(use-package evil
             :ensure t
             :init
             (setq evil-want-integration t) ;; This is optional since it's already set to t by default.
             (setq evil-want-keybinding nil)
	     (setq evil-want-C-u-scroll t)
             :config

             (evil-mode 1))

(use-package evil-collection
             :after evil
             :ensure t

             :config
             (evil-collection-init))

;; General settings
(global-hl-line-mode)
(global-display-line-numbers-mode)
(setq display-line-numbers-type 'relative)
(tool-bar-mode -1)
(toggle-scroll-bar -1)

;; Keyboard bindings
(defun split-and-follow-horizontal ()
  (interactive)
  (split-window-below)
  (balance-windows)
  (other-window 1))
(global-set-key(kbd "C-x 2") 'split-and-follow-horizontal)
(defun split-and-follow-vertical ()
  (interactive)
  (split-window-right)
  (balance-windows)
  (other-window 1))
(global-set-key(kbd "C-x 3") 'split-and-follow-vertical)

(keyboard-translate ?\C-h ?\C-x)
(keyboard-translate ?\C-x ?\C-h)

;; Completion

(require 'lsp-mode)
(mapc (lambda (mode) (add-hook mode #'lsp)) (list
					     'c-mode-hook
					     'python-mode-hook
					     ))

(mapc (lambda (mode) (add-hook mode 'company-mode)) (list
						   'emacs-lisp-mode-hook
						   ))

;; Custom keybinding
(define-key (current-global-map) [remap list-buffers] 'ibuffer)

(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.
 '(ansi-color-faces-vector
   [default default default italic underline success warning error])
 '(ansi-color-names-vector
   ["black" "red3" "ForestGreen" "yellow3" "blue" "magenta3" "DeepSkyBlue" "gray50"])
 '(custom-enabled-themes '(deeper-blue))
 '(package-selected-packages '(magit use-package evil-surround evil-collection)))
(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.
 )