|
|
|
;;; init.el -*- lexical-binding: t; -*-
|
|
|
|
|
|
|
|
(require 'package)
|
|
|
|
|
|
|
|
(add-to-list
|
|
|
|
'package-archives
|
|
|
|
'("melpa" . "https://melpa.org/packages/")
|
|
|
|
t)
|
|
|
|
(add-to-list
|
|
|
|
'package-archives
|
|
|
|
'("org" . "https://orgmode.org/elpa/")
|
|
|
|
t)
|
|
|
|
|
|
|
|
(package-initialize)
|
|
|
|
|
|
|
|
(unless (package-installed-p 'use-package)
|
|
|
|
(package-refresh-contents)
|
|
|
|
(package-install 'use-package))
|
|
|
|
|
|
|
|
(require 'use-package)
|
|
|
|
(setq use-package-always-ensure t)
|
|
|
|
|
|
|
|
;; update packages
|
|
|
|
(use-package auto-package-update
|
|
|
|
:config (setq auto-package-update-delete-old-versions t)
|
|
|
|
(setq auto-package-update-hide-results t)
|
|
|
|
(auto-package-update-maybe))
|
|
|
|
|
|
|
|
;; rust mode
|
|
|
|
(use-package rust-mode
|
|
|
|
:ensure t
|
|
|
|
:config (setq rust-format-on-save t))
|
|
|
|
|
|
|
|
;; cargo
|
|
|
|
(use-package cargo
|
|
|
|
:ensure t
|
|
|
|
:config (add-hook 'rust-mode-hook 'cargo-minor-mode))
|
|
|
|
|
|
|
|
;; Notes
|
|
|
|
(use-package org
|
|
|
|
:ensure t
|
|
|
|
:bind (("\C-cl" . org-store-link)
|
|
|
|
("\C-ca" . org-agenda)
|
|
|
|
("\C-cb" . org-iswtichb)))
|
|
|
|
|
|
|
|
;; LanguageServer
|
|
|
|
(use-package lsp-mode
|
|
|
|
:ensure t
|
|
|
|
:hook ((python-mode . lsp)
|
|
|
|
(rust-mode . lsp))
|
|
|
|
:commands lsp
|
|
|
|
:config (setq lsp-enable-indentation t
|
|
|
|
lsp-enable-on-type-formatting t))
|
|
|
|
|
|
|
|
(use-package lsp-ui
|
|
|
|
:commands lsp-ui-mode
|
|
|
|
:ensure t
|
|
|
|
:config (setq lsp-ui-sideline-show-diagnostics t))
|
|
|
|
|
|
|
|
;; Markdown mode
|
|
|
|
(use-package markdown-mode
|
|
|
|
:ensure t)
|
|
|
|
|
|
|
|
;; install goto last change (opens the file in the last position)
|
|
|
|
; (use-package goto-last-change
|
|
|
|
; :ensure t)
|
|
|
|
|
|
|
|
;; install fill-column-indicador: right side gutter
|
|
|
|
(use-package fill-column-indicator
|
|
|
|
:ensure t)
|
|
|
|
|
|
|
|
;; better completion
|
|
|
|
(use-package counsel
|
|
|
|
:ensure t
|
|
|
|
:config
|
|
|
|
(global-set-key "\C-s" 'swiper)
|
|
|
|
(global-set-key (kbd "C-c C-r") 'ivy-resume)
|
|
|
|
(global-set-key (kbd "M-x") 'counsel-M-x) ;
|
|
|
|
(global-set-key (kbd "C-x C-f") 'counsel-find-file)
|
|
|
|
(global-set-key (kbd "C-c g") 'counsel-git)
|
|
|
|
(global-set-key (kbd "C-c j") 'counsel-git-grep)
|
|
|
|
(global-set-key (kbd "C-x l") 'counsel-locate)
|
|
|
|
(define-key minibuffer-local-map (kbd "C-r") 'counsel-minibuffer-history)
|
|
|
|
)
|
|
|
|
|
|
|
|
;; powerline
|
|
|
|
(use-package powerline
|
|
|
|
:ensure t
|
|
|
|
:config (powerline-center-theme))
|
|
|
|
|
|
|
|
;; colorschemes
|
|
|
|
(use-package doom-themes
|
|
|
|
:ensure t
|
|
|
|
:config (setq doom-themes-enable-bold t
|
|
|
|
doom-themes-enable-italic t)
|
|
|
|
(load-theme 'doom-molokai t))
|
|
|
|
|
|
|
|
;; highlights the current line
|
|
|
|
(use-package hlinum
|
|
|
|
:ensure t)
|
|
|
|
(set-face-foreground 'linum-highlight-face "white")
|
|
|
|
(set-face-background 'linum-highlight-face nil)
|
|
|
|
(hlinum-activate)
|
|
|
|
|
|
|
|
;; don't show startup messages
|
|
|
|
(setq inhibit-startup-message t)
|
|
|
|
(setq initial-scratch-message nil)
|
|
|
|
|
|
|
|
;; git gutters
|
|
|
|
(use-package diff-hl
|
|
|
|
:ensure t
|
|
|
|
:init (setq diff-hl-side 'right))
|
|
|
|
(global-diff-hl-mode 1)
|
|
|
|
(diff-hl-margin-mode 1)
|
|
|
|
(diff-hl-flydiff-mode 1)
|
|
|
|
|
|
|
|
;; install editorconfig
|
|
|
|
(use-package editorconfig
|
|
|
|
:ensure t
|
|
|
|
:config (editorconfig-mode 1))
|
|
|
|
|
|
|
|
(require 'whitespace)
|
|
|
|
(setq whitespace-style '(face empty tabs lines-tail trailing))
|
|
|
|
(global-whitespace-mode t)
|
|
|
|
|
|
|
|
;; Snippets (snippets reside in ~/.emacs.d/snippets/ and should be
|
|
|
|
;; kept in a directory with mode name)
|
|
|
|
(use-package yasnippet
|
|
|
|
:ensure t)
|
|
|
|
(yas-global-mode 1)
|
|
|
|
|
|
|
|
;; colorize parens
|
|
|
|
(use-package rainbow-delimiters
|
|
|
|
:ensure t
|
|
|
|
:config (add-hook 'prog-mode-hook #'rainbow-delimiters-mode))
|
|
|
|
|
|
|
|
;; auto-pairs
|
|
|
|
(electric-pair-mode 1)
|
|
|
|
|
|
|
|
;; disable the menubar and tabbar
|
|
|
|
(menu-bar-mode 0)
|
|
|
|
(tool-bar-mode 0)
|
|
|
|
|
|
|
|
;; highlight matching paren
|
|
|
|
(show-paren-mode 1)
|
|
|
|
|
|
|
|
;; display line and column in the statusbar
|
|
|
|
(line-number-mode 1)
|
|
|
|
(column-number-mode 1)
|
|
|
|
|
|
|
|
;; column highlight
|
|
|
|
(setq-default fill-column 80)
|
|
|
|
(define-globalized-minor-mode global-fci-mode fci-mode (lambda () (fci-mode 1)))
|
|
|
|
(global-fci-mode 1)
|
|
|
|
|
|
|
|
;; line numbers
|
|
|
|
(global-linum-mode 1)
|
|
|
|
(defun configure-linum-colors ()
|
|
|
|
(set-face-foreground 'linum "#555555"))
|
|
|
|
(configure-linum-colors)
|
|
|
|
;; redefine the format; otherwise, the number will get "glued" to the code.
|
|
|
|
(setq linum-format " %5d ")
|
|
|
|
|
|
|
|
;; answer questions with 'y' instead of full 'yes'
|
|
|
|
(defalias 'yes-or-no-p 'y-or-n-p)
|
|
|
|
|
|
|
|
;; Create backup files directly in the .Trash directory
|
|
|
|
(setq backup-directory-alist '((".*" . "~/.Trash")))
|
|
|
|
|
|
|
|
;; Lock files should not be created
|
|
|
|
(setq create-lockfiles nil)
|
|
|
|
|
|
|
|
(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.
|
|
|
|
'(package-selected-packages
|
|
|
|
'(editorconfig diff-hl hlinum use-package rust-mode doom-themes auto-package-update)))
|
|
|
|
(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.
|
|
|
|
)
|