My emacs configuration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
qorg11 badb1cc67a
Saner indentation
4 days ago
img Added screenshot 5 months ago
.gitignore Added c-eldoc-mode 4 months ago
CONTRIBUTING.org contributing guideliness 4 months ago
LICENSE Added license 5 months ago
config.org Saner indentation 4 days ago
ido-vertical.el Fixed the ido-vertical thing, idk what happened, but using 3 months ago
init.el Cleaned init.el because let's be honest. That thing is completly 5 months ago
markup.el Initial commit 6 months ago
readme.org readme.org 6 months ago
screenshot.png ...Added screenshot 4 months ago

readme.org

emacs config

qorg's Emacs config

This is my Emacs configuration. Hope you like it.

Installation

Just copy this repository to your .emacs.d. Nothing else is needed.

Why?

  • I can

  • I don't like doom emacs

  • I don't like spacemacs

  • I don't want to learn doom emacs

  • I don't want to learn spacemacs

  • I don't like Vim

About me

Here I set variables about personal information i'll use later in this config.

(setq name "qorg11")
(setq email "qorg@vxempire.xyz")
(setq website "qorg11.net")

Dependencies

The only no emacs related dependence in this configuration is the IBM Plex Mono font. Install it from your distribution packages. You can change it before opening Emacs with this configuration for the first time.

For irony-mode (C autocompletion) irony-sever must be installed. You can install it with M-x irony-install-server or via distribution's packages, in Debian case, apt install irony-server. Using M-x irony-install-server requires cmake and a lot of dependences I'm to lazy to install.

Configuration

Yeah, this configuration file has a configuration, ironic ha?

(setq i-just-use-emacs-to-be-cool nil) ;; Repleace to true to use EVIL

melpa crap, and basic packages installation

melpa, where you get the packages. This also installs use-package, and other packages I use.

  (require 'package)
  (let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
                      (not (gnutls-available-p))))
         (proto (if no-ssl "http" "https")))
    ;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired
    (add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
    ;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
    (when (< emacs-major-version 24)
      ;; For important compatibility libraries like cl-lib
      (add-to-list 'package-archives '("gnu" . (concat proto "://elpa.gnu.org/packages/")))))

  (if (< emacs-major-version 27)
       (package-initialize))
  (unless (package-installed-p 'use-package)
    (package-refresh-contents)
    (package-install 'use-package))

Generic packages

Here I install some packages that don't need configuration. Remember to run M-x all-the-icons-install-fonts after the first init to install the fonts.


(use-package markdown-mode
:defer 1
:ensure t)
(use-package web-mode
:defer 1
:ensure t)
(use-package magit
:defer 1
:ensure t)
(use-package all-the-icons
:defer 1
:ensure t)
(use-package which-key
:ensure t
:init (which-key-mode))

Autoindentation

C-c n for indent-buffer. I don't use the rest.

  (setq-default tab-width 5)
  (defun indent-buffer ()
(interactive)
(save-excursion
  (indent-region (point-min) (point-max) nil)))
  (global-set-key (kbd "C-c n") 'indent-buffer)

Shorcuts

Probably this overwrites another keybinding. But since I overwrited it. I don't think i'd ever use the overwritten.

  (global-set-key (kbd "C-c n") 'cleanup-buffer)
  (global-set-key (kbd "M-m") 'mark-whole-buffer)
  (use-package sudo-edit
  :ensure t
  :defer 1
  :init
  (global-set-key (kbd "C-x C-r") 'sudo-edit-find-file))

No idea

(setq package-enable-at-startup nil) (package-initialize)

(setq make-backup-files nil) ; stop creating backup~ files
(setq auto-save-default nil) ; stop creating #autosave# files
(put 'upcase-region 'disabled nil)


(defun contextual-menubar (&optional frame)
"Display the menubar in FRAME (default: selected frame) if on a
graphical display, but hide it if in terminal."
(interactive)
(set-frame-parameter frame 'menu-bar-lines
(if (display-graphic-p frame)
1 0)))

(add-hook 'after-make-frame-functions 'contextual-menubar)
(use-package zencoding-mode
:ensure t
:defer 1
:init
(add-hook 'sgml-mode-hook 'zencoding-mode))

customization

Emacs customization, Here is where most of the configuration is.

Disable bars font and pandoc export optxions.

Basic customization. I also use smex instead of default M-x. I don't like heml


(scroll-bar-mode -1)
(tool-bar-mode -1)
(menu-bar-mode -1)
(set-frame-font "Terminus 18" nil t)
 (load-file "~/.emacs.d/markup.el")
 (use-package smex
 :ensure t
 :defer 1
 :init
(global-set-key (kbd "M-x") 'smex))

 (setq-default major-mode 'text-mode)

Space to - (Like normal M-x)


(defadvice smex (around space-inserts-hyphen activate compile)

(let ((ido-cannot-complete-command
`(lambda ()
(interactive)
(if (string= " " (this-command-keys))
(insert ?-)
(funcall ,ido-cannot-complete-command)))))
ad-do-it))

Highlight matching parentheses

(show-paren-mode 1)
(setq show-paren-style 'mixed)

(setq startup/gc-cons-threshold gc-cons-threshold)
(setq gc-cons-threshold most-positive-fixnum)
(defun startup/reset-gc () (setq gc-cons-threshold startup/gc-cons-threshold))
(add-hook 'emacs-startup-hook 'startup/reset-gc)

Open pdf using zathura

I don't know how necessary this is. But I use it when working with pandoc and that kind of crap.

(defun open-pdf()
(interactive)
(setq file (buffer-substring (mark) (point)))
(shell-command (concat "zathura " file "&")
))
;; Borders
(set-face-attribute 'fringe nil
:foreground (face-foreground 'default)
:background (face-background 'default))

org-mode

org-mode is a markup language which has a lot of stuff (This config file is written in org-mode.

  (use-package org-bullets
  :ensure t
  :init
  (if (display-graphic-p)
  (add-hook 'org-mode-hook 'org-bullets-mode))
  (setq org-hide-emphasis-markers t)
  (setq org-src-window-setup 'current-window))
(if (display-graphic-p)
(let* ((variable-tuple
     (cond ((x-list-fonts "IBM Plex Mono")         '(:font "IBM Plex Mono"))
           ((x-list-fonts "Source Sans Pro") '(:font "IBM Plex Mono"))
           ((x-list-fonts "Lucida Grande")   '(:font "IBM Plex Mono"))
           ((x-list-fonts "IBM Plex Mono")         '(:font "IBM Plex Mono"))
           ((x-family-fonts "IBM Plex Mono")    '(:family "IBM Plex Mono"))
           (nil (warn "Cannot find a Sans Serif Font.  Install Source Sans Pro."))))
    (base-font-color     (face-foreground 'default nil 'default))
    (headline           `(:inherit default :weight bold :foreground ,base-font-color)))

(custom-theme-set-faces
'user
`(org-level-8 ((t (,@headline ,@variable-tuple))))
`(org-level-7 ((t (,@headline ,@variable-tuple))))
`(org-level-6 ((t (,@headline ,@variable-tuple))))
`(org-level-5 ((t (,@headline ,@variable-tuple))))
`(org-level-4 ((t (,@headline ,@variable-tuple :height 1.1))))
`(org-level-3 ((t (,@headline ,@variable-tuple :height 1.1))))
`(org-level-2 ((t (,@headline ,@variable-tuple :height 1.2))))
`(org-level-1 ((t (,@headline ,@variable-tuple :height 1.3))))
`(org-document-title ((t (,@headline ,@variable-tuple :height 2.0 :underline nil)))))))

Theme

(use-package badger-theme
:ensure t
:init (load-theme 'badger t))

Relative lines

 (global-display-line-numbers-mode 1)
 (setq display-line-numbers-type 'relative)

Flycheck

Flycheck is a syntax validator or somehting like that

(use-package flycheck
:ensure t
:init
(add-hook 'after-init-hook #'global-flycheck-mode))

AucTeX

This basically opens zathura when compiling with auctex (C-c C-a)

(with-eval-after-load 'tex
(setq TeX-source-correlate-method 'synctex)
(TeX-source-correlate-mode)
(setq TeX-source-correlate-start-server t)

(add-to-list 'TeX-view-program-selection
'(output-pdf "Zathura")))

Shell

(setq shell "/bin/bash")
(defadvice ansi-term (before force-bash)
(interactive (list shell)))
(ad-activate 'ansi-term)

Swiper

(use-package swiper
:ensure t
:defer 1
:init
(global-set-key "\C-s" 'swiper))

Company and Irony

Some shit for autocompletion and that kind of shit.

  (use-package company
    :ensure t
    :config
    (setq company-idle-delay 0)
    (setq company-minimum-prefix-length 3)
    (global-company-mode))
  (with-eval-after-load 'company
    (define-key company-active-map (kbd "M-n") nil)
    (define-key company-active-map (kbd "M-p") nil)
    (define-key company-active-map (kbd "C-n") #'company-select-next)
    (define-key company-active-map (kbd "C-p") #'company-select-previous))

  (use-package company-irony
    :ensure t
    :config
    (require 'company)
    (add-to-list 'company-backends 'company-irony))

  (use-package irony
    :ensure t
    :config
    (add-hook 'c-mode-hook 'irony-mode)
    (add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options))
  (with-eval-after-load 'company
    (add-hook 'c-mode-hook 'company-mode))

Idk what to name this

Here I put things you can do in M-x or something idk

(blink-cursor-mode 0)
(global-hl-line-mode 0)
(setq-default cursor-type 'block)

Programming language things

Lisp

Parentheses highlight in lisp modes. So you can easily identify them.

  (use-package rainbow-delimiters
  :ensure t
  :init
  (add-hook 'emacs-lisp-mode-hook 'rainbow-delimiters-mode)
  (add-hook 'lisp-mode-hook 'rainbow-delimiters-mode)
  (add-hook 'scheme-mode-hook 'rainbow-delimiters-mode))

Perl

Cperl-mode is better than perl-mode. You can't change my mind.

(defalias 'perl-mode 'cperl-mode)

C*

This use c-eldoc mode so it prints the function's prototype in the minibuffer. Which is very useful since Irony works when it wants to.

(use-package c-eldoc
:ensure t
:init
(add-hook 'c-mode-hook 'c-turn-on-eldoc-mode))
(setq c-default-style "k&r")

erc

Erc is an irc client that is used inside emacs. Here I configure it.

(setq erc-default-server website)
(setq erc-nick name)

Now, erc is annoying as shit for default servers. So here i define a few functions to quickly connect to them

  (defun erc/freenode ()
    (interactive)
    (erc :server "irc.freenode.org" :nick "qorg11"))
  (defun erc/rizon ()
    (interactive)
    (erc :server "irc.rizon.net" :nick "qorg11"))
  (defun erc/kill9 ()
    (interactive)
    (erc :server "kill-9.xyz" :nick "qorg11"))

Extra functions

Here I put functions I won't bother to document because they're so simple.

  (defun git-pushall ()
    (interactive)
    (shell-command "git pushall"))

  (defun kill-inner-word ()
    (interactive)
    (forward-word 1)
    (backward-word)
    (kill-word 1))
  (global-set-key (kbd "M-C-k") 'kill-inner-word)

Hunspell

For some reason, there is no ispell spanish in void linux. so i had to fallback to hunspell. which does the same.

  (defvar ispell-program-name "hunspell") ;; Or whatever you use
                                          ;; (ispell, aspell...)

Dired

Ahhh, the emacs file browser, better than ranger and others…

Hide dotfiles:


  (use-package dired-hide-dotfiles
    :ensure t
    :init

    (defun my-dired-mode-hook ()
      "My `dired' mode hook."
      ;; To hide dot-files by default
      (dired-hide-dotfiles-mode)

      ;; To toggle hiding
      (define-key dired-mode-map "." #'dired-hide-dotfiles-mode))

    (add-hook 'dired-mode-hook #'my-dired-mode-hook))

Highlight identation

yeah i need it lol

  (use-package highlight-indent-guides
      :ensure t
      :init
      (add-hook 'prog-mode-hook 'highlight-indent-guides-mode)
      (setq highlight-indent-guides-method 'bitmap))

kill ring popup

(use-package popup-kill-ring
:ensure t
:bind ("M-y" . popup-kill-ring))

Dired

(add-hook 'dired-mode-hook
   (lambda ()
     (dired-hide-details-mode)))

ido

Ido is a replacement for keybindings such as C-x C-f and C-x b. Here I rebinded C-x C-b to ido-switch-buffer because I always press C-x C-b instead of C-x b

Since for some reason the regular ido-vertical stopped working, i had to use a fork i found in github, so that's why i use (load) instead of (use-package)

(load "~/.emacs.d/ido-vertical.el")
(setq ido-enable-flex-matching nil)
(setq ido-create-new-buffer 'always)
(setq ido-everywhere t)
(ido-mode 1)
(ido-vertical-mode 1)
(setq ido-vertical-define-keys 'C-n-and-C-p-only)
(global-set-key (kbd "C-x C-b") 'ido-switch-buffer)

Dashboard

Dashboard. You can change ~/.emacs.d/img/logo.png own logo instead of Lain.

(use-package dashboard
:ensure t
:init
(dashboard-setup-startup-hook)
(setq dashboard-items '((recents  . 5)
(bookmarks . 5)))
(setq dashboard-startup-banner 'logo)
(setq dashboard-banner-logo-title "Welcome to Editor MACroS")
(setq dashboard-startup-banner "~/.emacs.d/img/banner.txt")
(setq dashboard-set-heading-icons t)
(setq dashboard-set-file-icons t))

Line

Line, lol

(use-package doom-modeline
:ensure t
:defer 1
:config
  (doom-modeline-mode))

Screenshot

/qorg11/emaks/src/branch/master/screenshot.png (add-hook 'prog-mode-hook 'highlight-indent-guides-mode)