Skip to content

Instantly share code, notes, and snippets.

@kevinadi
Last active October 17, 2021 23:55
Show Gist options
  • Save kevinadi/ae58d59843b0ca54812eebae7ebcd437 to your computer and use it in GitHub Desktop.
Save kevinadi/ae58d59843b0ca54812eebae7ebcd437 to your computer and use it in GitHub Desktop.
Reasonable init.el using builtins only
(require 'package)
;;; Code:
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
(not (gnutls-available-p))))
(proto (if no-ssl "http" "https")))
;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired
(add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives '("gnu" . (concat proto "://elpa.gnu.org/packages/")))))
(package-initialize)
(add-hook 'prog-mode-hook 'linum-mode)
;(add-hook 'text-mode-hook (lambda () (setq show-trailing-whitespace t)))
(add-hook 'prog-mode-hook (lambda () (setq show-trailing-whitespace t)))
(setq linum-format "%4d \u2502 ")
(setq default-tab-width 4)
(show-paren-mode t)
(menu-bar-mode -1)
;(toggle-scroll-bar -1)
;(tool-bar-mode -1)
(electric-pair-mode)
(setq ring-bell-function
(lambda ()
(let ((orig-fg (face-background 'mode-line)))
(set-face-background 'mode-line "#CC0000")
(run-with-idle-timer 0.1 nil
(lambda (fg) (set-face-background 'mode-line fg))
orig-fg))))
(global-set-key (kbd "C-f") 'scroll-up-command)
(global-set-key (kbd "C-b") 'scroll-down-command)
;(global-set-key (kbd "S-C-v") 'scroll-down-command)
(global-set-key (kbd "S-C-<left>") 'shrink-window-horizontally)
(global-set-key (kbd "S-C-<right>") 'enlarge-window-horizontally)
(global-set-key (kbd "S-C-<down>") 'shrink-window)
(global-set-key (kbd "S-C-<up>") 'enlarge-window)
(global-set-key (kbd "C-c ;") 'comment-or-uncomment-region)
(windmove-default-keybindings)
(ido-mode t)
(ido-everywhere t)
(global-set-key
"\M-x"
(lambda ()
(interactive)
(call-interactively
(intern
(ido-completing-read
"M-x "
(all-completions "" obarray 'commandp))))))
(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.
'(custom-enabled-themes (quote (wombat)))
'(make-backup-files nil))
(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.
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment