diff options
author | Rasmus <rasmus.luha@gmail.com> | 2023-04-08 00:27:03 +0300 |
---|---|---|
committer | Rasmus <rasmus.luha@gmail.com> | 2023-04-08 00:27:03 +0300 |
commit | a16bdfe930d89e1a7fb354b78d16e8742118f76d (patch) | |
tree | f32aabd929a485ac24ea2b3fb1c9c9d041f27478 /config/.config/emacs/config.org |
checkers
Diffstat (limited to 'config/.config/emacs/config.org')
-rw-r--r-- | config/.config/emacs/config.org | 394 |
1 files changed, 394 insertions, 0 deletions
diff --git a/config/.config/emacs/config.org b/config/.config/emacs/config.org new file mode 100644 index 0000000..a4d67fd --- /dev/null +++ b/config/.config/emacs/config.org @@ -0,0 +1,394 @@ +#+STARTUP: overview + +* Packaging setup +** Melpa +#+begin_src emacs-lisp + (require 'package) + (setq package-enable-at-startup nil) + + (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) + (package-initialize) +#+end_src + +** use-package +#+begin_src emacs-lisp + (unless (package-installed-p 'use-package) + (package-refresh-contents) + (package-install 'use-package)) +#+end_src + +* Appearence +** Theme +#+begin_src emacs-lisp + (use-package afternoon-theme + :ensure t + :config + (load-theme 'afternoon t)) +#+end_src + +** Font and Cursor +#+begin_src emacs-lisp + (blink-cursor-mode 0) + (set-cursor-color "#ff9000") + + (when (member "Hack Nerd Font Mono" (font-family-list)) + (set-frame-font "Hack Nerd Font Mono-10" t t)) +#+end_src + +** Disable Oppacaty +#+begin_src emacs-lisp + (add-to-list 'default-frame-alist '(alpha 100)) +#+end_src + +** Dashboard +#+begin_src emacs-lisp + (use-package dashboard + :ensure t + :config + (dashboard-setup-startup-hook) + (setq dashboard-items '((recents . 3) + (bookmarks . 2))) + (setq dashboard-startup-banner "~/.config/emacs/avatar.png") + (setq dashboard-banner-logo-title "\"Pretty much everything on the web uses those two things: C and UNIX.\"") + (setq dashboard-center-content t) + (setq dashboard-set-init-info nil) + (setq dashboard-set-footer nil) + (setq initial-buffer-choice (lambda () (get-buffer-create "*dashboard*")))) +#+end_src + +** Modeline +*** Line Theme +#+begin_src emacs-lisp + (use-package doom-modeline + :ensure t + :init + (setq doom-modeline-unicode-fallback t) + (setq doom-modeline-buffer-encoding nil) + (setq doom-modeline-buffer-file-name-style 'relative-to-project) + ;; truncate-nil to change buffer file name to full path + ;;(setq doom-modeline-lsp t) + (doom-modeline-mode 1)) + + ;; M-x all-the-icons-install-fonts - to manually install the icons necessary + (use-package all-the-icons + :ensure t) + +#+end_src +*** Diminish +#+begin_src emacs-lisp + (use-package diminish + :ensure t + :init + (diminish 'which-key-mode) + (diminish 'subword-mode)) +#+end_src + +* Basic behaviour settings +#+begin_src emacs-lisp +(defalias 'yes-or-no-p 'y-or-n-p) +(setq ring-bell-function 'ignore) + +(setq auto-save-default nil) +(setq create-lockfiles nil) +(setq make-backup-files nil) + +(menu-bar-mode -1) +(tool-bar-mode -1) +(scroll-bar-mode -1) + +(setq bookmark-set-fringe-mark nil) + +(setq scroll-conservatively 10) +(setq scroll-margin 7) + +(use-package transpose-frame +:ensure t) +#+end_src + +* Text editing +** General +#+begin_src emacs-lisp + (electric-pair-mode 1) + (setq electric-pair-pairs + '( + (?\" . ?\") + (?\{ . ?\}))) + + (global-subword-mode 1) + + ;; Make sure tab-width is 4 and not 8 +(setq-default indent-tabs-mode nil) +(setq-default tab-width 4) + + (set-language-environment "UTF-8") + (set-default-coding-systems 'utf-8) + + (set-default 'truncate-lines t) + + ;;Line numbers + (global-display-line-numbers-mode) +#+end_src +** Hans VIMmer +#+begin_src emacs-lisp +(use-package evil + :ensure t + :config + (evil-set-undo-system 'undo-redo) + :init + (setq evil-want-keybinding nil) + (evil-mode 1)) + +(use-package evil-collection + :after evil + :ensure t + :config + (evil-collection-init '(dashboard dired bookmark + org-present org magit company ggtags doc-view))) + +(use-package key-chord + :ensure t + :config + ;; Max time delay between two key presses to be considered a key chord + (setq key-chord-one-key-delay .5) + (key-chord-define evil-insert-state-map "jj" 'evil-normal-state) + :init + (key-chord-mode 1)) + +#+end_src +* Org mode +** Bullets +#+begin_src emacs-lisp + (use-package org-bullets + :ensure t + :config + (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))) +#+end_src +* LaTeX +** Basic conf +#+begin_src emacs-lisp + (use-package auctex + :ensure t + :defer t + :hook (LaTeX-mode . + (lambda () + (push (list 'output-pdf "Zathura") + TeX-view-program-selection)))) +#+end_src +** DocView autoRevert +#+begin_src emacs-lisp + (add-hook 'doc-view-mode-hook 'auto-revert-mode) +#+end_src + +* IDE +** Overall +*** Projectile +#+begin_src emacs-lisp + (use-package projectile + :ensure t + :diminish projectile-mode + :bind-keymap + ("C-c p" . projectile-command-map) + :init + (setq projectile-project-p "~/code") + (projectile-mode 1)) +#+end_src +*** Company +#+begin_src emacs-lisp +(use-package company + :ensure t + :config + (setq company-idle-delay 0) + (setq company-minimum-prefix-lenght 3)) + ;; Global mode currently off + +(use-package company-irony + :ensure t + :config + (add-to-list 'company-backends 'company-irony)) + +(use-package irony + :ensure t + :config + (add-hook 'c-mode-hook 'irony-mode) + (add-hook 'c++-mode-hook 'irony-mode) + (add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)) + +;; Because company-global is not true atm +(with-eval-after-load 'company + (add-hook 'c-mode-hook 'company-mode) + (add-hook 'c++-mode-hook 'company-mode)) +#+end_src + +#+RESULTS: +: t + +*** Magit +#+begin_src emacs-lisp + (use-package magit + :ensure t + :config + (setq magit-push-always-verify nil) + (setq git-commit-summary-max-length 50) + :bind + ("M-g" . magit-status)) +#+end_src +*** FlyCheck +#+begin_src emacs-lisp +(use-package flycheck + :ensure t + :init + (global-flycheck-mode t)) +#+end_src + +*** YaSnippets + https://github.com/AndreaCrotti/yasnippet-snippets/tree/master/snippets + #+begin_src emacs-lisp +(use-package yasnippet-snippets + :ensure t + :hook ((prog-mode + conf-mode + snippet-mode) . yas-minor-mode-on)) + #+end_src + +*** Treemacs +#+begin_src emacs-lisp +(use-package treemacs + :ensure t) +#+end_src + +*** AG +#+begin_src emacs-lisp +(use-package ag + :ensure t) + +(setq ag-highlight-search t) +(setq ag-reuse-buffers 't) +#+end_src + +** Lang Specific +*** HTML & CSS +#+begin_src emacs-lisp + (use-package emmet-mode + :ensure t + :init + (add-hook 'sgml-mode-hook 'emmet-mode) + (add-hook 'css-mode-hook 'emmet-mode)) +#+end_src +*** C/C++ +**** Tags +#+begin_src emacs-lisp +;; install package global on machine + (use-package ggtags + :ensure t + :config + (add-hook 'c-mode-common-hook + (lambda () + (when (derived-mode-p 'c-mode 'c++-mode) + (ggtags-mode 1))))) +#+end_src +**** Tabs +#+begin_src emacs-lisp + (setq-default c-basic-offset 4) +#+end_src + +* Useful Functions +** Kill word +#+begin_src emacs-lisp + (defun killWholeWord () + (interactive) + (backward-word) + (kill-word 1)) + (global-set-key (kbd "C-c w") 'killWholeWord) +#+end_src +** Copy Line +#+begin_src emacs-lisp +;; (defun copyWholeLine () +;; (interactive) +;; (save-excursion +;; (kill-new +;; (buffer-substring +;; (point-at-bol) +;; (point-at-eol))))) +;; (global-set-key (kbd "C-c l") 'copyWholeLine) +#+end_src +** Follow Buffer +#+begin_src emacs-lisp + (defun splitFollowHorizontal () + (interactive) + (split-window-below) + (balance-windows) + (other-window 1)) + (global-set-key (kbd "C-x 2") 'splitFollowHorizontal) + + (defun splitFollowVertical () + (interactive) + (split-window-right) + (balance-windows) + (other-window 1)) + (global-set-key (kbd "C-x 3") 'splitFollowVertical) +#+end_src +** Refresh buffer +#+begin_src emacs-lisp +;; (defun revert-buffer-no-confirm () +;; "Revert buffer without confirmation." +;; (interactive) +;; (revert-buffer :ignore-auto :noconfirm)) +;; (global-set-key (kbd "<f5>") 'revert-buffer-no-confirm) +#+end_src +* Other +** WhichKey +#+begin_src emacs-lisp + (use-package which-key + :ensure t + :init + (which-key-mode)) +#+end_src +** Default Kill Buffer +#+begin_src emacs-lisp + (defun killCurBuffer () + (interactive) + (kill-buffer (current-buffer))) + (global-set-key (kbd "C-x k") 'killCurBuffer) +#+end_src + +** Better BottomMenu +*** IDO +#+begin_src emacs-lisp + (setq ido-enable-flex-matching t) + (setq ido-everywhere t) + (ido-mode 1) + + (use-package ido-vertical-mode + :ensure t + :init + (ido-vertical-mode 1)) + (setq ido-vertical-define-keys 'C-n-and-C-p-only) +#+end_src +*** Smex +#+begin_src emacs-lisp + (use-package smex + :ensure t + :init (smex-initialize) + :bind + ("M-x" . smex)) +#+end_src + +** Swiper +#+begin_src emacs-lisp + (use-package swiper + :ensure t + :bind ("C-s" . 'swiper)) +#+end_src + + + +* Notes +** C-programming paths + For flycheck path add, do this in the /myproject/.dir-locals.el + # ((c-mode . ((eval . (setq flycheck-clang-include-path + # (list (expand-file-name "~/myproject/include/"))))))) + And if needed path export for clan + # ((c-mode . ((company-clang-arguments . (list ("-I/your/absolute/paths/here/")))))) + + + |