2020-02-17 17:00:59 +04:00
|
|
|
;;; init.el --- balsoft's config
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
;;; None
|
|
|
|
|
|
|
|
;; -*- lexical-binding: t -*-
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
2020-06-21 13:17:20 +04:00
|
|
|
(require 'package)
|
|
|
|
|
|
|
|
(package-initialize)
|
2020-06-17 12:08:14 +04:00
|
|
|
|
2020-02-17 17:00:59 +04:00
|
|
|
(eval-when-compile
|
|
|
|
(require 'use-package))
|
|
|
|
(setq use-package-always-ensure nil)
|
|
|
|
|
|
|
|
(setq-default tab-width 2)
|
|
|
|
|
|
|
|
(mode-line-bell-mode)
|
|
|
|
|
|
|
|
(line-number-mode)
|
|
|
|
(column-number-mode)
|
|
|
|
|
|
|
|
(setq-default indent-tabs-mode nil)
|
|
|
|
|
2021-05-18 16:50:49 +04:00
|
|
|
(setq-default tab-always-indent 't)
|
2020-02-17 17:00:59 +04:00
|
|
|
|
|
|
|
(setq-default compilation-scroll-output 'first-error)
|
|
|
|
|
2020-03-17 22:45:17 +04:00
|
|
|
(use-package ws-butler
|
|
|
|
:config
|
|
|
|
(ws-butler-global-mode)
|
|
|
|
)
|
|
|
|
|
2020-02-17 17:00:59 +04:00
|
|
|
(global-auto-revert-mode)
|
|
|
|
|
2021-09-16 20:47:47 +04:00
|
|
|
(setq auto-save-default nil)
|
|
|
|
(setq make-backup-files nil)
|
2020-02-17 17:00:59 +04:00
|
|
|
|
2021-10-29 19:51:45 +04:00
|
|
|
;; (use-package xah-fly-keys
|
|
|
|
;; :config
|
|
|
|
;; (xah-fly-keys-set-layout "qwerty")
|
|
|
|
;; (xah-fly-keys 1)
|
|
|
|
;; (define-key xah-fly-insert-map (kbd "M-SPC") 'xah-fly-command-mode-activate)
|
|
|
|
;; )
|
|
|
|
|
|
|
|
(use-package evil
|
2020-02-17 17:00:59 +04:00
|
|
|
:config
|
2021-10-29 19:51:45 +04:00
|
|
|
(evil-mode 1))
|
2020-02-17 17:00:59 +04:00
|
|
|
|
|
|
|
(global-set-key (kbd "C-b") 'switch-to-buffer)
|
|
|
|
|
|
|
|
(global-display-line-numbers-mode)
|
|
|
|
|
|
|
|
(electric-pair-mode)
|
|
|
|
|
|
|
|
(electric-indent-mode)
|
|
|
|
|
|
|
|
(use-package flycheck
|
|
|
|
:config
|
|
|
|
(global-flycheck-mode))
|
|
|
|
|
|
|
|
(menu-bar-mode -1)
|
|
|
|
(scroll-bar-mode -1)
|
|
|
|
(tool-bar-mode -1)
|
|
|
|
(cua-selection-mode 1)
|
|
|
|
|
2021-06-10 19:58:51 +04:00
|
|
|
|
2020-12-18 21:57:31 +04:00
|
|
|
(setq auto-revert-check-vc-info t)
|
|
|
|
|
|
|
|
(vc-mode-line t)
|
2020-02-17 17:00:59 +04:00
|
|
|
|
|
|
|
(when (not window-system)
|
|
|
|
(xterm-mouse-mode 1))
|
|
|
|
|
2021-11-30 16:04:22 +04:00
|
|
|
(use-package fira-code-mode
|
2022-01-11 01:07:34 +04:00
|
|
|
:custom (fira-code-mode-disabled-ligatures '("[]" "#{" "#(" "#_" "#_(" "x")) ;; List of ligatures to turn off
|
2021-11-30 16:04:22 +04:00
|
|
|
:config (global-fira-code-mode))
|
2020-02-17 17:00:59 +04:00
|
|
|
|
|
|
|
(use-package company-ghci
|
|
|
|
:config
|
|
|
|
(push 'company-ghci company-backends))
|
|
|
|
|
|
|
|
(global-set-key [home] 'smart-beginning-of-line)
|
|
|
|
|
|
|
|
(global-unset-key [menu-bar options cua-mode])
|
2022-01-11 01:37:04 +04:00
|
|
|
(global-unset-key (kbd "C-x C-f"))
|
|
|
|
(global-set-key (kbd "C-x C-f") 'find-file-other-frame)
|
|
|
|
(global-unset-key (kbd "C-x b")) ;; Old habits die hard
|
2020-02-17 17:00:59 +04:00
|
|
|
|
|
|
|
(fringe-mode '(0 . 0))
|
|
|
|
|
|
|
|
;; scroll one line at a time (less "jumpy" than defaults)
|
|
|
|
|
|
|
|
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1))) ;; one line at a time
|
|
|
|
|
|
|
|
(setq mouse-wheel-progressive-speed nil) ;; don't accelerate scrolling
|
|
|
|
|
|
|
|
(setq mouse-wheel-follow-mouse 't) ;; scroll window under mouse
|
|
|
|
|
|
|
|
(setq scroll-step 1) ;; keyboard scroll one line at a time
|
|
|
|
|
|
|
|
(use-package frames-only-mode)
|
|
|
|
;; Make new frames instead of new windows
|
2020-06-17 12:08:14 +04:00
|
|
|
(setq pop-up-frames 'graphic-only)
|
|
|
|
(setq gdb-use-separate-io-buffer nil)
|
|
|
|
(setq gdb-many-windows nil)
|
2020-02-17 17:00:59 +04:00
|
|
|
|
|
|
|
;; -------------------
|
|
|
|
;; Projectile
|
|
|
|
;; -------------------
|
|
|
|
;; No deferred loading as bind-keymap
|
|
|
|
;; doesn't handle wakib C-d keymaps
|
|
|
|
(use-package projectile
|
|
|
|
:config
|
|
|
|
(define-key projectile-mode-map (kbd "C-c p") nil)
|
|
|
|
(define-key projectile-mode-map (kbd "C-x p") 'projectile-command-map)
|
|
|
|
(projectile-mode 1)
|
|
|
|
(global-unset-key [menu-bar tools Projectile])
|
2021-05-18 16:50:49 +04:00
|
|
|
(projectile-register-project-type 'flake '("flake.nix")
|
|
|
|
:compile "nix build"
|
|
|
|
:run "nix run")
|
2020-02-17 17:00:59 +04:00
|
|
|
(setq projectile-project-search-path '("~/projects/"))
|
2020-03-17 22:45:17 +04:00
|
|
|
|
2020-02-17 17:00:59 +04:00
|
|
|
(global-set-key (kbd "<f9>") 'projectile-compile-project)
|
|
|
|
(global-set-key (kbd "<f5>") 'projectile-run-project))
|
|
|
|
|
|
|
|
(use-package nix-mode
|
|
|
|
:hook
|
|
|
|
((nix-mode . (lambda () (local-set-key (kbd "<f7>") 'nix-format-buffer))))
|
|
|
|
((nix-mode . (lambda () (setq indent-line-function 'nix-indent-line)))))
|
|
|
|
|
|
|
|
(use-package company
|
|
|
|
:config
|
|
|
|
(global-company-mode 1)
|
|
|
|
;; Number the candidates (use M-1, M-2 etc to select completions).
|
|
|
|
(setq company-show-numbers t)
|
2020-06-17 12:08:14 +04:00
|
|
|
(setq company-idle-delay 0)
|
|
|
|
)
|
2020-02-17 17:00:59 +04:00
|
|
|
|
2020-06-17 12:08:14 +04:00
|
|
|
(use-package company-box
|
|
|
|
:hook (company-mode . company-box-mode))
|
2020-02-17 17:00:59 +04:00
|
|
|
|
|
|
|
|
|
|
|
;; -------------------
|
|
|
|
;; Ivy
|
|
|
|
;; -------------------
|
|
|
|
(use-package ivy
|
|
|
|
:config
|
|
|
|
(ivy-mode 1)
|
|
|
|
(setq ivy-use-virtual-buffers t)
|
|
|
|
(define-key ivy-minibuffer-map [remap keyboard-quit] 'minibuffer-keyboard-quit)
|
|
|
|
(setq ivy-count-format "")
|
|
|
|
(setq ivy-initial-inputs-alist nil))
|
|
|
|
|
2021-05-18 16:50:49 +04:00
|
|
|
(use-package counsel
|
|
|
|
:config
|
|
|
|
counsel-mode)
|
2020-02-17 17:00:59 +04:00
|
|
|
|
2020-06-17 12:08:14 +04:00
|
|
|
(use-package smex)
|
2020-02-17 17:00:59 +04:00
|
|
|
|
|
|
|
(show-paren-mode 1)
|
|
|
|
;; TODO - MOVE Electric Pair Mode to user local
|
|
|
|
|
|
|
|
|
|
|
|
;; MAJOR MODES
|
|
|
|
|
|
|
|
(use-package markdown-mode
|
|
|
|
:mode "\\.\\(m\\(ark\\)?down\\|md\\)$")
|
|
|
|
|
|
|
|
|
|
|
|
;; Setup Splash Screen
|
|
|
|
;; (setq inhibit-startup-screen t)
|
|
|
|
;; (setq-default major-mode 'fundamental-mode)
|
|
|
|
;; (setq-default initial-scratch-message "")
|
|
|
|
|
|
|
|
(setq custom-file (expand-file-name "custom" user-emacs-directory))
|
|
|
|
(load custom-file t t)
|
|
|
|
|
|
|
|
(auto-fill-mode)
|
|
|
|
|
|
|
|
|
2021-06-10 19:58:51 +04:00
|
|
|
(add-to-list 'default-frame-alist '(font . "@font@"))
|
|
|
|
(set-face-attribute 'default nil :font "@font@")
|
2021-03-11 21:28:50 +04:00
|
|
|
|
2020-02-17 17:00:59 +04:00
|
|
|
(setq inhibit-startup-screen t)
|
|
|
|
|
2020-12-04 14:20:51 +04:00
|
|
|
(use-package lsp-mode
|
|
|
|
:config
|
2021-03-01 14:04:17 +04:00
|
|
|
(add-hook 'rust-mode-hook 'lsp)
|
2020-12-04 14:20:51 +04:00
|
|
|
)
|
|
|
|
|
2021-03-01 14:04:17 +04:00
|
|
|
(use-package lsp-haskell
|
|
|
|
:config
|
|
|
|
(add-hook 'haskell-mode-hook 'lsp)
|
|
|
|
(add-hook 'haskell-literate-mode-hook 'lsp)
|
|
|
|
)
|
2021-02-28 20:06:01 +04:00
|
|
|
|
|
|
|
(use-package envrc
|
|
|
|
:config
|
2021-03-01 14:04:17 +04:00
|
|
|
(envrc-global-mode)
|
|
|
|
(advice-add 'lsp :before (lambda (&optional n) (envrc--update))))
|
2021-03-11 02:57:37 +04:00
|
|
|
|
2021-05-08 02:22:06 +04:00
|
|
|
(setq treemacs-position 'right)
|
|
|
|
|
|
|
|
(use-package treemacs)
|
|
|
|
|
|
|
|
(use-package lsp-treemacs)
|
|
|
|
|
|
|
|
(use-package treemacs-projectile)
|
2021-03-30 15:05:31 +04:00
|
|
|
|
2021-06-12 23:31:25 +04:00
|
|
|
(setq initial-major-mode 'text-mode)
|
|
|
|
|
2021-06-21 15:56:54 +04:00
|
|
|
(defun compile-on-save-start ()
|
|
|
|
(let ((buffer (compilation-find-buffer)))
|
|
|
|
(unless (get-buffer-process buffer)
|
|
|
|
(recompile))))
|
|
|
|
|
|
|
|
(define-minor-mode compile-on-save-mode
|
|
|
|
"Minor mode to automatically call `recompile' whenever the
|
|
|
|
current buffer is saved. When there is ongoing compilation,
|
|
|
|
nothing happens."
|
|
|
|
:lighter " CoS"
|
|
|
|
(if compile-on-save-mode
|
|
|
|
(progn (make-local-variable 'after-save-hook)
|
|
|
|
(add-hook 'after-save-hook 'compile-on-save-start nil t))
|
|
|
|
(kill-local-variable 'after-save-hook)))
|
|
|
|
|
2022-01-23 20:39:11 +04:00
|
|
|
(defun maybe-delete-frame-buffer (frame)
|
|
|
|
"When a dedicated FRAME is deleted, also kill its buffer.
|
|
|
|
A dedicated frame contains a single window whose buffer is not
|
|
|
|
displayed anywhere else."
|
|
|
|
(let ((windows (window-list frame)))
|
|
|
|
(when (eq 1 (length windows))
|
|
|
|
(let ((buffer (window-buffer (car windows))))
|
|
|
|
(when (eq 1 (length (get-buffer-window-list buffer nil t)))
|
|
|
|
(kill-buffer buffer))))))
|
|
|
|
|
|
|
|
(add-to-list 'delete-frame-functions #'maybe-delete-frame-buffer)
|
|
|
|
|
2021-06-10 19:58:51 +04:00
|
|
|
(require 'base16-theme)
|
|
|
|
|
|
|
|
(defvar base16-generated-colors
|
|
|
|
'(:base00 "@base00@"
|
|
|
|
:base01 "@base01@"
|
|
|
|
:base02 "@base02@"
|
|
|
|
:base03 "@base03@"
|
|
|
|
:base04 "@base04@"
|
|
|
|
:base05 "@base05@"
|
|
|
|
:base06 "@base06@"
|
|
|
|
:base07 "@base07@"
|
|
|
|
:base08 "@base08@"
|
|
|
|
:base09 "@base09@"
|
|
|
|
:base0A "@base0A@"
|
|
|
|
:base0B "@base0B@"
|
|
|
|
:base0C "@base0C@"
|
|
|
|
:base0D "@base0D@"
|
|
|
|
:base0E "@base0E@"
|
|
|
|
:base0F "@base0F@")
|
|
|
|
"All colors for Base16 are defined here.")
|
|
|
|
|
|
|
|
;; Define the theme
|
|
|
|
(deftheme base16-generated)
|
|
|
|
|
|
|
|
;; Add all the faces to the theme
|
|
|
|
(base16-theme-define 'base16-generated base16-generated-colors)
|
|
|
|
|
|
|
|
;; Mark the theme as provided
|
|
|
|
(provide-theme 'base16-generated)
|
|
|
|
|
|
|
|
(enable-theme 'base16-generated)
|
2021-03-01 14:04:17 +04:00
|
|
|
;;; init.el ends here
|