diff options
-rw-r--r-- | emacs/.emacs | 147 |
1 files changed, 53 insertions, 94 deletions
diff --git a/emacs/.emacs b/emacs/.emacs index 77e8843..164715c 100644 --- a/emacs/.emacs +++ b/emacs/.emacs @@ -1,110 +1,69 @@ +;; Package init and install (require 'package) - -(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3") - -(setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/") - ("melpa" . "https://melpa.org/packages/"))) - +(add-to-list 'package-archives + '("melpa" . "https://melpa.org/packages/")) (package-initialize) -(defvar my-packages '( auto-complete - evil - evil-surround - org - org-evil - go-mode - dired-narrow - ace-window - magit - yaml-mode)) - -(setq evil-want-C-u-scroll t) - -(dolist (p my-packages) - (unless (package-installed-p p) - (package-refresh-contents) - (package-install p)) - (add-to-list 'package-selected-packages p)) - - -;; Use up to 20mb before running garbage collector -(setq gc-cons-threshold 20000000) - -;; Use tmp as backup dir -(setq backup-directory-alist - `((".*" . ,temporary-file-directory))) -(setq auto-save-file-name-transforms - `((".*" ,temporary-file-directory t))) - -(setq vc-follow-symlinks t) -(setq confirm-kill-emacs 'y-or-n-p) - -;; Use a to goto dired directory -(put 'dired-find-alternate-file 'disabled nil) -;; Direc fuzzy searching, use g to go back to file listing -(require 'dired) -(define-key dired-mode-map (kbd "/") 'dired-narrow-fuzzy) - -(fset 'yes-or-no-p 'y-or-n-p) -(global-auto-revert-mode t) -(display-time-mode t) -(tool-bar-mode 0) - -(ac-config-default) +(defvar packages (list + 'use-package + 'geiser-chez + 'company + 'nix-mode + 'lsp-mode + )) + +(mapc (lambda (pack) + (unless (package-installed-p pack) + (package-install pack)) + ) packages) + +(require 'use-package) +(require 'nix-mode) + +(use-package evil + :ensure t + :init + (setq evil-want-integration t) ;; This is optional since it's already set to t by default. + (setq evil-want-keybinding nil) + (setq evil-want-C-u-scroll t) + :config + (evil-mode 1)) + +(use-package evil-collection + :after evil + :ensure t + :config + (evil-collection-init)) + +;; General settings +(global-hl-line-mode) +(global-display-line-numbers-mode) +(setq display-line-numbers-type 'relative) + +;; Completion +;; (add-hook 'after-init-hook 'global-company-mode) + +(require 'lsp-mode) +(mapc (lambda (mode) (add-hook mode #'lsp)) (list + 'c-mode-hook + 'python-mode-hook + )) -(setq save-place-file "~/.emacs.d/saveplace") -(setq-default save-place t) -(require 'saveplace) -(when (fboundp 'windmove-default-keybindings) - (windmove-default-keybindings)) - -(evil-mode t) -(global-set-key (kbd "M-x") 'execute-extended-command) - -(require 'evil-surround) -(global-evil-surround-mode 1) (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-enabled-themes (quote (tango-dark))) - '(package-selected-packages (quote (yaml-mode magit evil-surround evil auto-complete)))) + '(ansi-color-faces-vector + [default default default italic underline success warning error]) + '(ansi-color-names-vector + ["black" "red3" "ForestGreen" "yellow3" "blue" "magenta3" "DeepSkyBlue" "gray50"]) + '(custom-enabled-themes '(deeper-blue)) + '(package-selected-packages '(use-package evil-surround evil-collection))) (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. ) - -(defun save-and-quit () - "Save the document and exit buffer" - (interactive) - (save-buffer (current-buffer)) - (kill-this-buffer)) - -(evil-ex-define-cmd "q[uit]" 'kill-this-buffer) -(evil-ex-define-cmd "wq" 'save-and-quit) -(evil-ex-define-cmd "describe-function" 'describe-function) - -(defun my-jump-advice (oldfun &rest args) - (let ((old-pos (point))) - (apply oldfun args) - (when (> (abs (- (line-number-at-pos old-pos) (line-number-at-pos (point)))) - 1) - (evil-set-jump old-pos)))) - -(advice-add 'evil-next-line :around #'my-jump-advice) -(advice-add 'evil-previous-line :around #'my-jump-advice) - - -(global-set-key (kbd "M-w") 'ace-window) - -(evil-add-command-properties #'evil-scroll-down :jump t) -(evil-add-command-properties #'evil-scroll-up :jump t) - - -;; Go mode - -(add-hook 'before-save-hook 'gofmt-before-save) |