My own configuration files
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

218 lines
5.3 KiB

;;; 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))
;; don't show startup messages
(setq inhibit-startup-message t)
(setq initial-scratch-message nil)
(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))
:init (add-hook 'org-mode-hook 'turn-on-auto-fill)
:config
(setq org-clock-persist 'history)
(setq org-todo-keywords '((sequence "TODO" "WORKING" "WAITING" "|" "DONE")))
(org-clock-persistence-insinuate))
(use-package org-journal
:ensure t
:config
(setq org-journal-dir "~/Documents/Engys/")
(setq org-journal-file-format "journal/%Y%m%d.org"))
;; Which key shows commands after the prefix
(use-package which-key
:ensure t
:config
(which-key-mode))
;; LanguageServer
(use-package lsp-mode
:ensure t
:hook ((python-mode . lsp)
(rust-mode . lsp))
:commands lsp
:init (setq lsp-keymap-prefix "C-l")
:hook (lsp-mode . lsp-enable-which-key-integration)
(rust-mode . lsp)
(python-mode . lsp)
:config
(setq lsp-enable-indentation t
lsp-enable-on-type-formatting t)
:commands lsp)
(use-package lsp-pyright
:ensure t
:hook (python-mode . (lambda ()
(require 'lsp-pyright)
(lsp)))) ; or lsp-deferred
;; Markdown mode
(use-package markdown-mode
:ensure t
:init (add-hook 'markdown-mode-hook 'turn-on-auto-fill))
;; install fill-column-indicador: right side gutter
(use-package fill-column-indicator
:ensure t)
;; doom-modeline, the status bar
(use-package doom-modeline
:ensure t
:init (doom-modeline-mode 1))
;; colorschemes
(use-package doom-themes
:ensure t
:config (setq doom-themes-enable-bold t
doom-themes-enable-italic t)
(load-theme 'doom-ayu-dark t))
;; highlights the current line
(use-package hlinum
:ensure t
:config
(set-face-foreground 'linum-highlight-face "white")
(set-face-background 'linum-highlight-face nil)
(hlinum-activate))
;; git gutters
(use-package diff-hl
:ensure t
:init (setq diff-hl-side 'right)
:config
(global-diff-hl-mode 1)
(diff-hl-margin-mode 1)
(diff-hl-flydiff-mode 1))
;; 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
:config
(yas-global-mode 1))
;; colorize parens
(use-package rainbow-delimiters
:ensure t
:config (add-hook 'prog-mode-hook #'rainbow-delimiters-mode))
;; incremental search
(use-package helm
:ensure t
:config
(setq helm-M-x-fuzzy-match t)
(setq helm-buffers-fuzzy-matching t
helm-recent-fuzzy-match t)
(global-set-key (kbd "M-x") 'helm-M-x)
(global-set-key (kbd "C-x C-f") 'helm-find-files)
)
;; Project management
(use-package projectile
:ensure t
:init
(projectile-mode +1)
:bind (:map projectile-mode-map
("s-p" . projectile-command-map)
("C-c p" . projectile-command-map))
)
(use-package helm-projectile
:ensure t)
;; 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
(require 'fill-column-indicator)
(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)
(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.
'(custom-safe-themes
'("835868dcd17131ba8b9619d14c67c127aa18b90a82438c8613586331129dda63" default))
'(package-selected-packages
'(helm-projectile projectile 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.
)