Skip to content

Latest commit

 

History

History
149 lines (120 loc) · 3.22 KB

editor.org

File metadata and controls

149 lines (120 loc) · 3.22 KB

Core Editor bits

Editor Config

Indents and spacing

(setq tab-width 2)
(setq js-indent-level 2)
(setq css-indent-offset 2)
(setq c-basic-offset 2)
(setq-default indent-tabs-mode nil)
(setq-default c-basic-offset 2)
(setq-default tab-width 2)
(setq-default c-basic-indent 2)

(use-package indent-tools
  :ensure t)

Editing

(global-linum-mode)

(global-set-key (kbd "H-/") 'comment-region)
(global-set-key (kbd "M-s-÷") 'uncomment-region)
(set-cursor-color "wheat")

Reload from disk

;; Automatically reload files when they change on disk
(global-auto-revert-mode 1)
(setq auto-revert-verbose nil)

Edit Behaviours

;; Type over selected text
(delete-selection-mode 1)
;; Kill whole line
(global-set-key (kbd "H-<backspace>") 'kill-whole-line)


;; Use Cmd for movement
(global-set-key (kbd "H-<right>") (kbd "C-e"))  ;; End of line
(global-set-key (kbd "H-<left>") (kbd "C-a"))   ;; Beginning of line


;; Kills the current buffer without displaying the annoying menu.
;; A confirmation will be asked for, if the buffer has been modified
(global-set-key (kbd "C-x k") 'kill-this-buffer)


;; Remove trailing whitespace before saving
(add-hook 'before-save-hook 'delete-trailing-whitespace)

Font

(when (member "Fira Code" (font-family-list))
  (set-face-attribute 'default nil :font "Fira Code-17"))

Themes

  ;;(use-package suscolors-theme
  ;;  :ensure t)

  (use-package gruvbox-theme
    :ensure t)

  (use-package inkpot-theme
    :ensure t)

  ;;(use-package dracula-theme
  ;;  :ensure t)

  (use-package srcery-theme
    :ensure t)
  (use-package cyberpunk-theme
    :ensure t)
  (use-package poet-theme
    :ensure t)

;; Taken from Simon Shine's answer at https://stackoverflow.com/questions/9900232/changing-color-themes-emacs-24-order-matters
  (setq my-themes '(poet-dark cyberpunk inkpot gruvbox-dark-hard poet srcery))

  (setq my-cur-theme nil)
  (defun cycle-my-theme ()
    "Cycle through a list of themes, my-themes"
    (interactive)
    (when my-cur-theme
      (disable-theme my-cur-theme)
      (setq my-themes (append my-themes (list my-cur-theme))))
    (setq my-cur-theme (pop my-themes))
    (load-theme my-cur-theme t))

;; Switch to the first theme in the list above
   (cycle-my-theme)

;; Bind this to C-t
  (global-set-key (kbd "C-H-t") 'cycle-my-theme)

Misc

Yaml

(use-package yaml-mode
  :ensure t
  :init (add-to-list 'auto-mode-alist '("\\.yml\\'" . yaml-mode)))

(use-package flymake-yaml
  :ensure t
  :init (add-hook 'yaml-mode-hook 'flymake-yaml-load))

(load custom-file t)

JSON

(use-package json-mode
  :ensure t)
(use-package jsonnet-mode
  :ensure t)

Protobuf

(use-package protobuf-mode
  :ensure t)

ansible vault

(use-package ansible-vault
  :ensure t)

Toml

(use-package toml-mode
  :ensure t)

Provide this so that it may be required

(provide 'editor)