From 124cddbf3e0aa5b6ddd5b2429483e65f1886e744 Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Tue, 12 Jun 2018 06:49:22 +0100 Subject: Organising stuff better in the emacs config Adding padding to urxvt --- X/.Xresources | 2 +- emacs/loader.org | 161 +++++++++++++++++++++---------------------------------- 2 files changed, 61 insertions(+), 102 deletions(-) diff --git a/X/.Xresources b/X/.Xresources index 789a451..a8e06fd 100644 --- a/X/.Xresources +++ b/X/.Xresources @@ -209,7 +209,7 @@ URxvt*hold: false ! URxvt*externalBorder: number ! Internal border of number pixels. This resource is limited to 100 -! URxvt*internalBorder: +URxvt*internalBorder: 24 ! The colour of the border around the text area and between the scrollbar and the text. ! URxvt*borderColor: color diff --git a/emacs/loader.org b/emacs/loader.org index ab14027..175c2bb 100644 --- a/emacs/loader.org +++ b/emacs/loader.org @@ -12,8 +12,8 @@ but also has support for Python, F#, Haskell and Clojure. (setq user-mail-address "ymherklotz@gmail.com") #+END_SRC -** Interface -*** Setup +** Setup +*** Repositories Defining all the package repositories that are going to be used. - ~gnu~ :: The default package repository for emacs @@ -31,7 +31,7 @@ Defining all the package repositories that are going to be used. (defvar gnu '("gnu" . "https://elpa.gnu.org/packages/")) (defvar melpa '("melpa" . "https://melpa.org/packages/")) (defvar melpa-stable '("melpa-stable" . "https://stable.melpa.org/packages/")) - (defvar org-elpa '("org" . "http://orgmode.org/elpa/")) + (defvar org-elpa '("org" . "https://orgmode.org/elpa/")) #+END_SRC These packages are then added to the list of package archives. @@ -49,12 +49,6 @@ Initialise the packages and if the directories don't exist, create them. #+BEGIN_SRC emacs-lisp (setq package-enable-at-startup nil) (package-initialize) - - (unless (and (file-exists-p (concat init-dir "elpa/archives/gnu")) - (file-exists-p (concat init-dir "elpa/archives/melpa")) - (file-exists-p (concat init-dir "elpa/archives/melpa-stable")) - (file-exists-p (concat init-dir "elpa/archives/org"))) - (package-refresh-contents)) #+END_SRC Use ~use-package~ to manage other packages, and improve load times. @@ -69,6 +63,8 @@ Use ~use-package~ to manage other packages, and improve load times. (setq use-package-always-ensure t) #+END_SRC +*** Server Configuration + Server so that a client can connect to it. This makes using emacs much smoother, as frames can be opened using the emacsclient. @@ -79,6 +75,7 @@ as frames can be opened using the emacsclient. (server-start)) #+END_SRC +*** GC Threshold Threshold for faster startup. #+BEGIN_SRC emacs-lisp @@ -95,31 +92,41 @@ way. `((".*" ,temporary-file-directory t))) #+END_SRC -*** Editor -Editor specific options such as adding line numbers and showing. +*** General Configuration +**** UI +Editor specific options such as adding line numbers. Disable UI that starts when starting emacs and also set the y or n instead of -yes or no. - +yes or no. Also stop the start up message from popping up and enter the scratch +buffer instead. #+BEGIN_SRC emacs-lisp (setq inhibit-startup-message t) - (setq vc-follow-symlinks t) (tool-bar-mode -1) (menu-bar-mode -1) (fset 'yes-or-no-p 'y-or-n-p) - (setq global-hl-line-mode t) +#+END_SRC + +**** Global settings +Make emacs follow symlinks every time, this means that it will open the actual +file and go to where the file is actually stored instead of editing it through +the symlink. This enables the use of git and other version control when editing +the file. +#+BEGIN_SRC emacs-lisp + (setq vc-follow-symlinks t) #+END_SRC Make it easier to refresh the buffer by setting it to ~~. +#+BEGIN_SRC emacs-lisp + (global-set-key (kbd "") 'revert-buffer) +#+END_SRC +This stops paren mode with interfering with the modeline. #+BEGIN_SRC emacs-lisp (show-paren-mode 'expression) - (global-set-key (kbd "") 'revert-buffer) #+END_SRC Revert the buffer automatically when a file changes on disc. This is useful when monitoring a file such as a log file. It will also do this silently. - #+BEGIN_SRC emacs-lisp (global-auto-revert-mode 1) (setq auto-revert-verbose nil) @@ -127,20 +134,20 @@ monitoring a file such as a log file. It will also do this silently. Disable tabs, I want to move towards only using spaces everywhere as that is my preferred style. This is just personal preference though. - #+BEGIN_SRC emacs-lisp (setq-default indent-tabs-mode nil) (setq-default tab-width 4) (setq-default python-indent-offset 4) - (setq-default fill-column 80) #+END_SRC - +Set the line number display very high so that it is always shown in the modeline +and set the column width to 80. #+BEGIN_SRC emacs-lisp (setq line-number-display-limit 2000000) + (setq-default fill-column 80) #+END_SRC -*** Font +**** Font Set the font to Hack, which is an opensource monospace font designed for programming and looking at source code. @@ -149,9 +156,6 @@ programming and looking at source code. (setq default-frame-alist '((font . "Hack-11"))) #+END_SRC -#+RESULTS: -: ((font . Hack-11)) - ** Social *** Mail ~mu4e~ is automatically in the load path when installed through a package @@ -241,7 +245,8 @@ Setting up ~smtp~ to send messages using gmail. #+END_SRC ** Utility -*** Discover-ability +*** Discoverability +Used to display what every key combination does when starting to enter it. #+BEGIN_SRC emacs-lisp (use-package which-key :diminish which-key-mode @@ -264,60 +269,39 @@ Setting up ~smtp~ to send messages using gmail. (global-set-key (kbd "C-'") 'avy-goto-char-2)) #+END_SRC -**** Helm +**** Ivy #+BEGIN_SRC emacs-lisp - (use-package helm - :config - (require 'helm-config)) - - (use-package helm-mode - :ensure helm + (use-package ivy + :bind + (("C-s" . 'swiper) + ("M-x" . 'counsel-M-x) + ("C-x C-f" . 'counsel-find-file) + ("C-c g" . 'counsel-git) + ("C-c j" . 'counsel-git-grep) + ("C-c k" . 'counsel-ag) + ("C-c C-r" . 'ivy-resume)) :config - (helm-mode 1)) - - (use-package helm-utils - :ensure helm - ;; Popup buffer-name or filename in grep/moccur/imenu-all etc... - :config (helm-popup-tip-mode 1)) - - (use-package helm-sys - :ensure helm - :commands (helm-top) - :config (helm-top-poll-mode 1)) - - (global-set-key (kbd "M-x") 'undefined) - (global-set-key (kbd "M-x") 'helm-M-x) - (global-set-key (kbd "M-y") 'helm-show-kill-ring) - (global-set-key (kbd "C-x C-f") 'helm-find-files) - (global-set-key (kbd "C-c ") 'helm-all-mark-rings) - (global-set-key (kbd "C-x r b") 'helm-filtered-bookmarks) - (global-set-key (kbd "C-:") 'helm-eval-expression-with-eldoc) - (global-set-key (kbd "C-,") 'helm-calcul-expression) - (global-set-key (kbd "C-h d") 'helm-info-at-point) - (global-set-key (kbd "C-h i") 'helm-info) - (global-set-key (kbd "C-x C-d") 'helm-browse-project) - (global-set-key (kbd "C-h C-f") 'helm-apropos) - (global-set-key (kbd "C-h a") 'helm-apropos) - (global-set-key (kbd "C-h C-d") 'helm-debug-open-last-log) - (global-set-key (kbd "C-c s") 'helm-occur) - (define-key global-map [remap jump-to-register] 'helm-register) - (define-key global-map [remap list-buffers] 'helm-mini) - (define-key global-map [remap dabbrev-expand] 'helm-dabbrev) - (define-key global-map [remap find-tag] 'helm-etags-select) - (define-key global-map [remap xref-find-definitions] 'helm-etags-select) - (define-key global-map (kbd "M-g a") 'helm-do-grep-ag) - (define-key global-map (kbd "M-g g") 'helm-grep-do-git-grep) - (define-key global-map (kbd "M-g i") 'helm-gid) - (define-key global-map (kbd "C-x r p") 'helm-projects-history) - (define-key global-map (kbd "C-x r c") 'helm-addressbook-bookmarks) + (setq ivy-use-virtual-buffers t) + (setq ivy-count-format "(%d/%d) ")) #+END_SRC **** Winner Mode - #+BEGIN_SRC emacs-lisp (setq winner-mode t) #+END_SRC +**** Beacon mode +#+BEGIN_SRC emacs-lisp + (use-package beacon + :config + (beacon-mode 1)) +#+END_SRC + +**** Dumb Jump +#+BEGIN_SRC emacs-lisp + (use-package dumb-jump) +#+END_SRC + *** Visual **** All the icons #+BEGIN_SRC emacs-lisp @@ -332,14 +316,6 @@ Setting up ~smtp~ to send messages using gmail. (global-hungry-delete-mode)) #+END_SRC -**** Multiple Cursors -#+BEGIN_SRC emacs-lisp - (use-package multiple-cursors - :bind (("C->" . mc/mark-next-like-this) - ("C-<" . mc/mark-previous-like-this) - ("C-c C-<" . mc/mark-all-like-this))) -#+END_SRC - **** SmartParens #+BEGIN_SRC emacs-lisp (use-package smartparens @@ -381,7 +357,6 @@ Setting up ~smtp~ to send messages using gmail. **** Undo Tree #+BEGIN_SRC emacs-lisp (use-package undo-tree - :diminish undo-tree-mode :config (global-undo-tree-mode)) @@ -396,14 +371,12 @@ Setting up ~smtp~ to send messages using gmail. *** Misc **** Reducing ringing Reduce the ringing in emacs. - #+BEGIN_SRC emacs-lisp - ;; http://stackoverflow.com/questions/11679700/emacs-disable-beep-when-trying-to-move-beyond-the-end-of-the-document (defun my-bell-function ()) - (setq ring-bell-function 'my-bell-function) (setq visible-bell nil) #+END_SRC + ** Writing *** Spellcheck in emacs #+BEGIN_SRC emacs-lisp @@ -523,29 +496,26 @@ My emacs configuration is mostly focused on programming, therefore there is a lot of different language support. *** Version Control and Project Management - **** Magit - #+BEGIN_SRC emacs-lisp (use-package magit :bind (("C-x g" . magit-status))) #+END_SRC **** Projectile - #+BEGIN_SRC emacs-lisp (use-package projectile :diminish projectile-mode :config (projectile-global-mode 1) - (setq projectile-indexing-method 'alien) (setq projectile-enable-caching t)) - (use-package helm-projectile) + (use-package counsel-projectile + :config + (counsel-projectile-mode t)) #+END_SRC *** Language Support - **** C++ Setting up CC mode with a hook that uses my settings. @@ -610,14 +580,7 @@ to install clang format script). (global-set-key (kbd "C-c u") 'clang-format-buffer)) #+END_SRC -#+BEGIN_SRC emacs-lisp - (use-package rtags - :pin melpa-stable - :config - (rtags-enable-standard-keybindings)) -#+END_SRC - -*** Clojure +**** Clojure Using Cider for clojure environment. #+BEGIN_SRC emacs-lisp @@ -630,10 +593,7 @@ Using Cider for clojure environment. Adding hook to clojure mode to enable strict parentheses mode. #+BEGIN_SRC emacs-lisp - (use-package clojure-mode - :ensure nil - :init - (add-hook 'clojure-mode-hook 'turn-on-smartparens-strict-mode)) + (add-hook 'clojure-mode-hook 'turn-on-smartparens-strict-mode) #+END_SRC **** CMake @@ -693,7 +653,6 @@ Elpy package for python, which provides an IDE type environment for python. **** JSON JSON files should be opened in js-mode. - #+BEGIN_SRC emacs-lisp (add-to-list 'auto-mode-alist '("\\.json\\'" . js-mode)) #+END_SRC -- cgit