ablemacs/config.el

108 lines
2.5 KiB
EmacsLisp

;;;;;;;;;;;;;;;;;;;;
;; File Locations ;;
;;;;;;;;;;;;;;;;;;;;
(setq org-directory "~/org-mode/")
;;;;;;;;;;;;;;;;;
;; Keybindings ;;
;;;;;;;;;;;;;;;;;
;; Cut/paste like a normal human being.
(cua-mode 1)
;; Tab key binding.
(global-set-key (kbd "TAB") #'self-insert-command)
;; Spam Ctrl + s to save.
(global-set-key (kbd "C-s") 'save-buffer)
;; Ctrl + Tab to alternate between other windows
(global-set-key (kbd "<C-tab>") 'other-window)
;; Prevent backspace from turning a tab character into 4 spaces.
(setq backward-delete-char-untabify-method nil)
;;;;;;;;;;;;;;;;;;;;;
;; Display Options ;;
;;;;;;;;;;;;;;;;;;;;;
;; This theme is inspired by the atom one dark theme
(setq doom-theme 'doom-one)
;; Display line numbers the normal way.
(setq display-line-numbers-type t)
;; Display time in specific formats.
(setq display-time-24hr-format 1)
(setq display-time-day-and-date 1)
;; Enable diplaying time
(display-time-mode 1)
;; Restore the menu bar because doom-emacs disables it.
(defun restore-menu-bar()
(interactive)
(if (fboundp 'tool-bar-mode) (tool-bar-mode 1))
(if (fboundp 'menu-bar-mode) (menu-bar-mode 1)))
(restore-menu-bar)
;; Start emacs maximized.
(add-hook 'window-setup-hook #'toggle-frame-maximized)
;; Set tab width, Doesn't seem to work :( ;;
(setq-default tab-width 1)
;;;;;;;;;;;;;;;;;
;; Minor Modes ;;
;;;;;;;;;;;;;;;;;
(defun do-nothing ()
"Don't do anything"
(interactive))
(define-minor-mode no-backspace-mode
"Disable the backspace key"
:global t
:lighter " noBackspace")
(defvar no-backspace--emulation-alist
`((no-backspace-mode
. ,(let ((map (make-sparse-keymap)))
(define-key map (kbd "DEL") #'do-nothing)
map))))
(add-to-list 'emulation-mode-map-alists 'no-backspace--emulation-alist)
;;;;;;;;;;;;;;;;;
;; HBLang Mode ;;
;;;;;;;;;;;;;;;;;
(defvar hblang-mode-syntax-table
(let ((table (make-syntax-table)))
;; C and C++-style comments.
(modify-syntax-entry ?/ ". 124b" table)
(modify-syntax-entry ?* ". 23" table)
(modify-syntax-entry ?\n "> b" table)
table)
"Syntax table for `hblang-mode'.")
(defvar hblang-font-lock-keywords
;; Change the "" quoted regex to do various forms of highlighting.
'(("" (1 font-lock-function-name-face))
("" (1 font-lock-variable-name-face)))
"Highlight rules for `hblang-mode'.")
(define-derived-mode hblang-mode prog-mode "hb"
"Major mode for editing hblang files."
(setq font-lock-defaults '(hblang-font-lock-keywords nil)))
(add-to-list 'auto-mode-alist '("\\.hb\\'" . hblang-mode))
(provide 'hblang-mode)