blob: d9a6219aa03d65bb51b85432c390dba38eeffb8e (
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
(require 'bard-search)
;; Nice scrolling
(pixel-scroll-precision-mode 1)
;;; Editing niceties
(electric-pair-mode t)
;; writeable grep buffers
(use-package wgrep
:bind
(:map wgrep-mode-map
("C-x C-s" . wgrep-save-all-buffers)))
;; preview replace
(use-package iedit)
(use-package expand-region
:bind ("C-=" . er/expand-region))
;; Desktop mode/session saving
(setq desktop-path '("~/.emacs.d/desktop")
desktop-dirname "~/.emacs.d/desktop/"
desktop-base-file-name "emacs-desktop"
desktop-save t
desktop-restore-eager t
desktop-restore-=frams t
desktop-restory-in-current-display t
desktop-files-not-to-save "\(^$\\|\\*scratch\\*\\|\\*Messages\\*\\|\\*dashboard\\*\\|\\*Async-native-compile-log\\*|\\*Music\\*)")
;;; General Keybinds
;; Buffer switching
(global-set-key (kbd "C-x C-b") 'ibuffer)
;; Desktop/session save
(global-set-key (kbd "C-' s") 'desktop-save-in-desktop-dir)
(global-set-key (kbd "C-' r") 'desktop-read)
;;; Scratch buffers
;; Text Scratch buffers
(defun bard/new-org-buffer ()
(interactive)
(let ((xbuf (generate-new-buffer "*org*")))
(switch-to-buffer xbuf)
(funcall (quote org-mode))
(text-scale-increase 1.5)
xbuf))
(define-key global-map (kbd "M-=") #'bard/new-org-buffer)
(defun bard/new-plain-buffer ()
(interactive)
(let ((xbuf (generate-new-buffer "*plain*")))
(switch-to-buffer xbuf)
(text-scale-increase 1.5)
xbuf))
(define-key global-map (kbd "M--") #'bard/new-plain-buffer)
;; elisp scratch buffer
(defun bard/new-elisp-buffer ()
(interactive)
(let ((xbuf (generate-new-buffer "*elisp*")))
(switch-to-buffer xbuf)
(funcall (quote emacs-lisp-mode))
(text-scale-increase 1.5)
xbuf))
;;; Terminals
(defun bard/open-terminal-in-current-directory ()
"Open a terminal in the current working directory."
(interactive)
(let ((default-directory default-directory))
(term "/bin/bash")))
(define-key global-map (kbd "C-t") #'bard/open-terminal-in-current-directory)
(define-key global-map (kbd "C-z t") #'bard/open-terminal-in-current-directory)
(defun bard/open-terminal-emulator ()
"Open a terminal in the current working directory."
(interactive)
(let ((default-directory default-directory))
(start-process "st terminal" nil "st")))
(define-key global-map (kbd "C-z C-t") 'bard/open-terminal-emulator)
(define-key global-map (kbd "C-z C-s") #'bard/new-elisp-buffer)
;;; Time Management
;; Modeline
(setq display-time-format "%Y-%m-%d (%A) %H:%M")
(setq display-time-interval 60)
(setq display-time-default-load-average nil)
(setq display-time-mail-directory nil)
(setq display-time-mail-function nil)
(setq display-time-use-mail-icon nil)
(setq display-time-mail-string nil)
(setq display-time-mail-face nil)
(setq display-time-string-forms
'((propertize
(format-time-string display-time-format now)
'face 'display-time-date-and-time
'help-echo (format-time-string "%a %b %e, %Y" now))
" "))
(display-time-mode 1)
;; world clock
(setq world-clock-list
'(("America/New_York" "New York")
("Europe/Moscow" "Moscow")
("Europe/London" "London")
("Asia/Tokyo" "Tokyo")))
(setq world-clock-time-format "%Y-%m-%d %B (%A) %R %Z")
(define-key global-map (kbd "C-c C-w") #'world-clock)
;; timer package
(use-package tmr
:ensure t
:config
(setq tmr-sound-file "/home/bard/.local/bin/scripts/bell.mp3")
(setq tmr-notification-urgency 'normal)
(setq tmr-descriptions-list 'tmr-description-history)
(define-key global-map (kbd "C-c t l") 'tmr-tabulated-view)
(define-key global-map (kbd "C-c t t") #'tmr)
(define-key global-map (kbd "C-c t T") #'tmr-with-description)
(define-key global-map (kbd "C-c t l") #'tmr-tabulated-view)
(define-key global-map (kbd "C-c t c") #'tmr-clone)
(define-key global-map (kbd "C-c t k") #'tmr-cancel)
(define-key global-map (kbd "C-c t s") #'tmr-reschedule)
(define-key global-map (kbd "C-c t e") #'tmr-edit-description)
(define-key global-map (kbd "C-c t r") #'tmr-remove)
(define-key global-map (kbd "C-c t R") #'tmr-remove-finished))
(provide 'bard-emacs-essentials)
|