Skip to content

Instantly share code, notes, and snippets.

@ericchansen
Last active November 5, 2021 15:12
Show Gist options
  • Save ericchansen/4fd9b4500e9abf8261fc085355850d57 to your computer and use it in GitHub Desktop.
Save ericchansen/4fd9b4500e9abf8261fc085355850d57 to your computer and use it in GitHub Desktop.
My .emacs configuration
;; Highlights dumb stuff.
(require 'whitespace)
(setq whitespace-style '(face empty tabs lines-tail trailing))
(global-whitespace-mode t)
;; 80 column marker.
(
add-hook 'rust-mode-hook (
lambda ()
(setq-local whitespace-line-column 80)
)
)
;; No tabs! Ever!
(setq-default indent-tabs-mode nil)
;; Save all backups to ~/.emacs_backups.
(setq make-backup-files t)
(
setq backup-directory-alist (
quote (
(\".\" . \"~/.emacs_backups\")
)
)
)
(setq backup-by-copying t)
(
setq delete-old-versions t
kept-new-versions 2
kept-old-versions 2
version-control t
)
;; Honestly, I forgot what this does.
(line-number-mode 1)
(column-number-mode 1)
;; Comment binding.
;; Hit Ctrl + C, C to comment or uncomment the selected region. If no region is
;; selected, it will comment/uncomment the current line.
(
defun comment-or-uncomment-region-or-line ()
\"Comments or uncomments the region or the current line if there's no active region\"
(interactive)
(let (beg end)
(if (region-active-p)
(setq beg (region-beginning) end (region-end))
(setq beg (line-beginning-position) end (line-end-position))
)
(comment-or-uncomment-region beg end)
)
)
(global-set-key (kbd \"C-c c\") 'comment-or-uncomment-region-or-line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment