Refactoring.

This commit is contained in:
tastytea 2019-03-22 00:40:07 +01:00
parent 3ad2623639
commit 00b830d30b
2 changed files with 118 additions and 118 deletions

234
init.el
View File

@ -1,5 +1,5 @@
;;; init.el --- tastytea's Emacs init file.
;;; Time-stamp: <2019-03-21 13:53:37 CET>
;;; Time-stamp: <2019-03-22 00:39:03 CET>
;;; Commentary:
;;; I am using this file with Emacs 26, but most of it will probably work with
@ -164,24 +164,24 @@
(global-set-key (kbd "M-<up>") 'scroll-down-line)
;;;;;;;;;;;;;;;;;;;; Programming / RTags ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(unless slow-computer
(use-package rtags
:if (executable-find "llvm-config")
:if (executable-find "clang++")
:config
(unless (and (rtags-executable-find "rc") (rtags-executable-find "rdm"))
(progn
(message "RTags is not installed!")
(rtags-install)))
(use-package rtags
:unless slow-computer
:if (executable-find "llvm-config")
:if (executable-find "clang++")
:config
(unless (and (rtags-executable-find "rc") (rtags-executable-find "rdm"))
(progn
(message "RTags is not installed!")
(rtags-install)))
(define-key c-mode-base-map (kbd "M-.") 'rtags-find-symbol-at-point)
(define-key c-mode-base-map (kbd "M-,") 'rtags-find-references-at-point)
(define-key c-mode-base-map (kbd "M-?") 'rtags-display-summary)
(rtags-enable-standard-keybindings)
:hook
(c++-mode . (rtags-start-process-unless-running))
(c-mode . (rtags-start-process-unless-running))
(kill-emacs . rtags-quit-rdm)))
(define-key c-mode-base-map (kbd "M-.") 'rtags-find-symbol-at-point)
(define-key c-mode-base-map (kbd "M-,") 'rtags-find-references-at-point)
(define-key c-mode-base-map (kbd "M-?") 'rtags-display-summary)
(rtags-enable-standard-keybindings)
:hook
(c++-mode . (rtags-start-process-unless-running))
(c-mode . (rtags-start-process-unless-running))
(kill-emacs . rtags-quit-rdm))
(use-package flycheck-rtags
:after (flycheck rtags)
@ -211,16 +211,16 @@
(prog-mode . turn-on-eldoc-mode))
;; Syntax checking
(unless slow-computer
(use-package flycheck
:config
(global-flycheck-mode)))
(use-package flycheck
:unless slow-computer
:config
(global-flycheck-mode))
;; Autocompletion
(unless slow-computer
(use-package company
:hook
(after-init . global-company-mode)))
(use-package company
:unless slow-computer
:hook
(after-init . global-company-mode))
;; Fuzzy autocompletion
(use-package company-flx
@ -229,11 +229,11 @@
(company-flx-mode +1))
;; cmake integration
(unless slow-computer
(use-package cmake-ide
:config
(setq cmake-ide-build-dir "build")
(cmake-ide-setup)))
(use-package cmake-ide
:unless slow-computer
:config
(setq cmake-ide-build-dir "build")
(cmake-ide-setup))
;; Indentation
(setq-default indent-tabs-mode nil
@ -242,28 +242,28 @@
c-basic-offset 4)
;; Project management
(unless slow-computer
(use-package projectile
:after neotree
:config
(projectile-mode +1)
(setq projectile-switch-project-action 'neotree-projectile-action
projectile-project-compilation-dir "build"
projectile-project-configure-cmd
"cmake -DCMAKE_BUILD_TYPE=Debug
(use-package projectile
:unless slow-computer
:after neotree
:config
(projectile-mode +1)
(setq projectile-switch-project-action 'neotree-projectile-action
projectile-project-compilation-dir "build"
projectile-project-configure-cmd
"cmake -DCMAKE_BUILD_TYPE=Debug
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON -G 'Unix Makefiles' .."
projectile-project-compilation-cmd "cmake --build .")
projectile-project-compilation-cmd "cmake --build .")
(defun projectile-kill-buffers-and-change-tabbar-grouping ()
"Kill project buffers and change tabbar-ruler grouping to user-buffers."
(interactive)
(projectile-kill-buffers)
(tabbar-ruler-group-user-buffers))
:bind
("C-c p" . 'projectile-command-map)
(:map projectile-command-map
("k" . 'projectile-kill-buffers-and-change-tabbar-grouping))
))
(defun projectile-kill-buffers-and-change-tabbar-grouping ()
"Kill project buffers and change tabbar-ruler grouping to user-buffers."
(interactive)
(projectile-kill-buffers)
(tabbar-ruler-group-user-buffers))
:bind
("C-c p" . 'projectile-command-map)
(:map projectile-command-map
("k" . 'projectile-kill-buffers-and-change-tabbar-grouping))
)
;; Debugger
(use-package realgud
@ -323,14 +323,14 @@
(all-the-icons-install-fonts t)))
;; Theme
(unless slow-computer
(use-package doom-themes
:after (all-the-icons neotree)
:config
(load-theme 'doom-molokai t)
(doom-themes-neotree-config)
:custom
(doom-neotree-file-icons 'icons)))
(use-package doom-themes
:unless slow-computer
:after (all-the-icons neotree)
:config
(load-theme 'doom-molokai t)
(doom-themes-neotree-config)
:custom
(doom-neotree-file-icons 'icons))
;; Modeline
(use-package doom-modeline
@ -362,8 +362,8 @@
:bind
("<f8>" . neotree-toggle))
(unless slow-computer
(use-package git-commit))
(use-package git-commit
:unless slow-computer)
(use-package magit
:config
(defun my-magit-kill-buffers (arg)
@ -421,52 +421,52 @@
;; Replaces stock emacs completion with ido completion wherever it is possible
(use-package ido-completing-read+
:unless slow-computer
:after ido
:config
(ido-ubiquitous-mode t))
;; Tab bar
(unless slow-computer
(use-package tabbar-ruler
:after projectile
:init
(setq tabbar-ruler-global-tabbar t)
:config
;; (tabbar-ruler-group-by-projectile-project) ; Group by projectile
;; (tabbar-ruler-group-buffer-groups) ; Group by file type
(tabbar-ruler-group-user-buffers) ; Group by frame
;; (mode-icons-mode 0) ; Disable modeline symbols
(use-package tabbar-ruler
:unless slow-computer
:after projectile
:init
(setq tabbar-ruler-global-tabbar t)
:config
;; (tabbar-ruler-group-by-projectile-project) ; Group by projectile
;; (tabbar-ruler-group-buffer-groups) ; Group by file type
(tabbar-ruler-group-user-buffers) ; Group by frame
;; (mode-icons-mode 0) ; Disable modeline symbols
;; I have to define these 2 times, don't know why.
(set-face-attribute 'tabbar-selected nil
:background "gray11"
:foreground "light gray"
:family "Sans Serif"
:bold t)
(set-face-attribute 'tabbar-unselected nil
:background "gray18"
:foreground "dark gray"
:family "Sans Serif"
:italic t)
(add-hook 'projectile-after-switch-project-hook ; Does not work under :hook
'tabbar-ruler-group-by-projectile-project)
:bind
("C-<prior>" . 'tabbar-ruler-tabbar-backward-tab)
("C-<next>" . 'tabbar-ruler-tabbar-forward-tab)
:custom-face
;; I Have to define these 2 times, don't know why.
(tabbar-selected (nil
;; I have to define these 2 times, don't know why.
(set-face-attribute 'tabbar-selected nil
:background "gray11"
:foreground "light gray"
:family "Sans Serif"
:bold t))
(tabbar-unselected (nil
:background "gray18"
:foreground "dark gray"
:family "Sans Serif"
:italic t))
))
:bold t)
(set-face-attribute 'tabbar-unselected nil
:background "gray18"
:foreground "dark gray"
:family "Sans Serif"
:italic t)
(add-hook 'projectile-after-switch-project-hook ; Does not work under :hook
'tabbar-ruler-group-by-projectile-project)
:bind
("C-<prior>" . 'tabbar-ruler-tabbar-backward-tab)
("C-<next>" . 'tabbar-ruler-tabbar-forward-tab)
:custom-face
;; I Have to define these 2 times, don't know why.
(tabbar-selected (nil
:background "gray11"
:foreground "light gray"
:family "Sans Serif"
:bold t))
(tabbar-unselected (nil
:background "gray18"
:foreground "dark gray"
:family "Sans Serif"
:italic t)))
;; Keybinding for whitespace, don't visualise newlines
(use-package whitespace
@ -549,25 +549,25 @@
;;;;;;;;;;;;;;;;;;;; Server / Remote editing ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Edit remote files
(unless slow-computer
(use-package tramp
:defer 1
:config
;; ssh is faster than scp and supports ports
(setq tramp-default-method "ssh")
;; Add verification code support
(customize-set-variable
'tramp-password-prompt-regexp
(concat
"^.*"
(regexp-opt
'("passphrase" "Passphrase"
"password" "Password"
"Verification code")
t)
".*:\0? *"))
;; Respect remote PATH
(add-to-list 'tramp-remote-path 'tramp-own-remote-path)))
(use-package tramp
:unless slow-computer
:defer 1
:config
;; ssh is faster than scp and supports ports
(setq tramp-default-method "ssh")
;; Add verification code support
(customize-set-variable
'tramp-password-prompt-regexp
(concat
"^.*"
(regexp-opt
'("passphrase" "Passphrase"
"password" "Password"
"Verification code")
t)
".*:\0? *"))
;; Respect remote PATH
(add-to-list 'tramp-remote-path 'tramp-own-remote-path))
;; Run server if:
;; - Our EUID is not 0

View File

@ -1,2 +1,2 @@
127.0.0.1:51313 23104
127.0.0.1:51313 24224
phahw2ohVoh0oopheish7IVie9desh8aequeenei3uo8wahShe%thuadaeNa4ieh