-
-
Notifications
You must be signed in to change notification settings - Fork 197
/
nano-bindings.el
50 lines (41 loc) · 1.82 KB
/
nano-bindings.el
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
;; ---------------------------------------------------------------------
;; GNU Emacs / N Λ N O - Emacs made simple
;; Copyright (C) 2020 - N Λ N O developers
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;; ---------------------------------------------------------------------
;; Kill current buffer (instead of asking first buffer name)
(global-set-key (kbd "C-x k") 'kill-current-buffer)
;; M-n for new frame (M-n is unbound in vanilla emacs)
(defun new-frame ()
(interactive)
(select-frame (make-frame))
(switch-to-buffer "*scratch*"))
(global-set-key (kbd "M-n") 'new-frame)
(global-set-key (kbd "M-`") 'other-frame)
;; M-return for frame maximization toggle
(global-set-key (kbd "<M-return>") 'toggle-frame-maximized)
(with-eval-after-load 'org
(define-key org-mode-map (kbd "<M-return>") 'toggle-frame-maximized))
;; Close frame if not the last, kill emacs else
(defun nano--delete-frame-or-kill-emacs ()
"Delete frame or kill Emacs if there is only one frame."
(interactive)
(if (> (length (frame-list)) 1)
(delete-frame)
(save-buffers-kill-terminal)))
(global-set-key (kbd "C-x C-c") 'nano--delete-frame-or-kill-emacs)
;; Open recent files
(global-set-key (kbd "C-c r") 'recentf-open-files)
(provide 'nano-bindings)