forked from rougier/nano-emacs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nano-defaults.el
172 lines (135 loc) · 4.77 KB
/
nano-defaults.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
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
;; ---------------------------------------------------------------------
;; 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/>.
;; ---------------------------------------------------------------------
;; No startup screen
(setq inhibit-startup-screen t)
;; No startup message
(setq inhibit-startup-message t)
(setq inhibit-startup-echo-area-message t)
;; No message in scratch buffer
(setq initial-scratch-message nil)
;; Initial buffer
(setq initial-buffer-choice nil)
;; No frame title
(setq frame-title-format nil)
;; No file dialog
(setq use-file-dialog nil)
;; No dialog box
(setq use-dialog-box nil)
;; No popup windows
(setq pop-up-windows nil)
;; No empty line indicators
(setq indicate-empty-lines nil)
;; No cursor in inactive windows
(setq cursor-in-non-selected-windows nil)
;; Text mode is initial mode
(setq initial-major-mode 'text-mode)
;; Text mode is default major mode
(setq default-major-mode 'text-mode)
;; Moderate font lock
(setq font-lock-maximum-decoration nil)
;; No limit on font lock
(setq font-lock-maximum-size nil)
;; No line break space points
(setq auto-fill-mode nil)
;; Fill column at 80
(setq fill-column 80)
;; No confirmation for visiting non-existent files
(setq confirm-nonexistent-file-or-buffer nil)
;; Completion style, see
;; gnu.org/software/emacs/manual/html_node/emacs/Completion-Styles.html
(setq completion-styles '(basic substring))
;; Use RET to open org-mode links, including those in quick-help.org
(setq org-return-follows-link t)
;; Mouse active in terminal
(unless (display-graphic-p)
(xterm-mouse-mode 1)
(global-set-key (kbd "<mouse-4>") 'scroll-down-line)
(global-set-key (kbd "<mouse-5>") 'scroll-up-line))
;; No scroll bars
(if (fboundp 'scroll-bar-mode) (set-scroll-bar-mode nil))
;; No toolbar
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
;; No menu bar
(if (display-graphic-p)
(menu-bar-mode t) ;; When nil, focus problem on OSX
(menu-bar-mode -1))
;; Tab behavior
;; (setq tab-always-indent 'complete)
;; (global-company-mode)
;; (define-key company-mode-map [remap indent-for-tab-command]
;; #'company-indent-or-complete-common)
;; Pixel scroll (as opposed to char scrool)
;; (pixel-scroll-mode t)
;; Mac specific
(when (eq system-type 'darwin)
(setq ns-use-native-fullscreen t
mac-option-key-is-meta nil
mac-command-key-is-meta t
mac-command-modifier 'meta
mac-option-modifier nil
mac-use-title-bar nil))
;; Make sure clipboard works properly in tty mode on OSX
(defun copy-from-osx ()
(shell-command-to-string "pbpaste"))
(defun paste-to-osx (text &optional push)
(let ((process-connection-type nil))
(let ((proc (start-process "pbcopy" "*Messages*" "pbcopy")))
(process-send-string proc text)
(process-send-eof proc))))
(when (and (not (display-graphic-p))
(eq system-type 'darwin))
(setq interprogram-cut-function 'paste-to-osx)
(setq interprogram-paste-function 'copy-from-osx))
;; y/n for answering yes/no questions
(fset 'yes-or-no-p 'y-or-n-p)
;; No tabs
(setq-default indent-tabs-mode nil)
;; Tab.space equivalence
(setq-default tab-width 4)
;; Size of temporary buffers
(temp-buffer-resize-mode)
(setq temp-buffer-max-height 8)
;; Minimum window height
(setq window-min-height 1)
;; Buffer encoding
(prefer-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-language-environment 'utf-8)
;; Unique buffer names
(require 'uniquify)
(setq uniquify-buffer-name-style 'reverse
uniquify-separator " • "
uniquify-after-kill-buffer-p t
uniquify-ignore-buffers-re "^\\*")
;; Default shell in term
(unless
(or (eq system-type 'windows-nt)
(not (file-exists-p "/bin/zsh")))
(setq-default shell-file-name "/bin/zsh")
(setq explicit-shell-file-name "/bin/zsh"))
;; Kill term buffer when exiting
(defadvice term-sentinel (around my-advice-term-sentinel (proc msg))
(if (memq (process-status proc) '(signal exit))
(let ((buffer (process-buffer proc)))
ad-do-it
(kill-buffer buffer))
ad-do-it))
(ad-activate 'term-sentinel)
(provide 'nano-defaults)