First version of use-package

This commit is contained in:
Maciej 2019-07-16 21:04:35 +03:00
parent 42ff73fdd7
commit fca83b0b97
Signed by: maciej
GPG key ID: 41D62D42D3B0D765
15 changed files with 214 additions and 197 deletions

View file

@ -2,59 +2,76 @@
;;; Wrap long lines
(toggle-truncate-lines t)
;;; Show trailing whitespace and remove whitespace on save
(require 'whitespace)
(add-hook 'prog-mode-hook 'whitespace-mode)
(add-hook 'text-mode-hook 'whitespace-mode)
(setq whitespace-style '(face trailing empty))
;;; Cleanup whitespace on save
(add-hook 'before-save-hook 'whitespace-cleanup)
;;; Tabs are spaces and are general at 2. Guide indent with lines
(setq-default indent-tabs-mode nil)
;;; Insert newline on save
(setq require-final-newline t)
;;; Match parenthasis (left-right)
(electric-pair-mode 1)
;;; Rainbow parenthesis
(add-hook 'prog-mode-hook 'rainbow-delimiters-mode)
(add-hook 'text-mode-hook 'rainbow-delimiters-mode)
;;; Show hex colors as colors
(add-hook 'prog-mode-hook 'rainbow-mode)
(add-hook 'text-mode-hook 'rainbow-mode)
(require 'lsp-mode)
;;; When pasting/writing over a selection, replace it.
(delete-selection-mode 1)
;; Dash
(define-key prog-mode-map (kbd "C-s C-d") 'dash-at-point) ;; Jump to dash definition
(define-key text-mode-map (kbd "C-s C-d") 'dash-at-point) ;; Jump to dash definition
(add-to-list
'dash-at-point-mode-alist
'(enh-ruby-mode . "ruby,rubygems,rails")) ;; Configure lookup for Ruby mode
;; When possible, show code documentation
(global-eldoc-mode 1)
;; Revert tags automatically
;; Revert tag tables without asking
(setq tags-revert-without-query 1)
;; Use flycheck globally to check syntax and compile languages
(global-flycheck-mode 1)
;;; Show trailing whitespace and remove whitespace on save
(use-package whitespace
:commands whitespace-mode
:ensure t
:hook (((prog-mode text-mode) . whitespace-mode)
(before-save . whitespace-cleanup))
:init (setq whitespace-style #'(face trailing empty))
;;; Insert newline on save
(setq require-final-newline t)
;;; Tabs are spaces and are general at 2. Guide indent
;;; with lines
(setq-default indent-tabs-mode nil))
;; Function for definiting indentation
;; Use colorful, matching parens
(use-package rainbow-delimiters
:commands rainbow-delimiters-mode
:ensure t
:hook (((prog-mode text-mode) . rainbow-delimiters-mode))
:init
;;; Match parenthasis (left-right)
(electric-pair-mode 1))
;;; Show hex colors as colors
(use-package rainbow-mode
:commands rainbow-mode
:ensure t
:hook ((prog-mode text-mode) . rainbow-mode))
(use-package lsp-mode
:ensure t)
;; Dash integration
(use-package dash-at-point
:commands dash-at-point
:ensure t
:bind (:map prog-mode-map ("C-s C-d" . dash-at-point)
:map text-mode-map ("C-s C-d" . dash-at-point))
:config
(add-to-list 'dash-at-point-mode-alist
;; Configure lookup for Ruby mode
'(enh-ruby-mode . "ruby,rubygems,rails")))
;; Use flycheck globally to check syntax and compile languages
(use-package flycheck
:commands flycheck-define-checker
:ensure t
:defer t
:config (global-flycheck-mode t))
;; By default, use 2 spaces for indentation
(setq tab-width 2)
(setq tab-stop-list (number-sequence tab-width 200 tab-width))
;; Ensure indentation in steps:
(defun set-indent (step)
"Set indentation to X STEPs."
(interactive "NNumber of columns for one step: ")
(setq tab-width step)
(setq tab-stop-list (number-sequence step 200 step)))
(setq-local tab-width step)
(setq-local tab-stop-list (number-sequence step 200 step)))
;; Enforce column width by number
(global-column-enforce-mode 1)
(use-package column-enforce-mode
:ensure t
:config (global-column-enforce-mode t))