Skip to content

Latest commit

 

History

History
514 lines (445 loc) · 28.2 KB

myinit.org

File metadata and controls

514 lines (445 loc) · 28.2 KB

Interface Tweaks

Startup, general settings

;; Remove initial buffer, set index file
(setq inhibit-startup-message t)
(setq initial-buffer-choice "index.org")

;; Hide Scroll bar,menu bar, tool bar
(scroll-bar-mode -1)
(tool-bar-mode -1)
(menu-bar-mode -1)

;; Line numbering
(global-display-line-numbers-mode)
(setq display-line-numbers-type 'relative)

;; Display battery for when in full screen mode
(display-battery-mode t)

;; Keybindings
(global-set-key (kbd "<f5>") 'revert-buffer)
(global-set-key (kbd "<f3>") 'org-export-dispatch)
(global-set-key (kbd "<f6>") 'eshell) 
(global-set-key (kbd "<f7>") 'ranger) 
(global-set-key (kbd "<f8>") 'magit) 

;; Misc stuff
(fset 'yes-or-no-p 'y-or-n-p)
(setenv "HOME" "/home/trajanus/")
(server-start)

Evil mode stuff

(use-package powerline-evil
  :ensure t)
(powerline-evil-vim-theme)
(powerline-evil-vim-color-theme)
(define-key evil-ex-map "e" 'find-file)
(define-key evil-ex-map "W" 'save-buffer)

Theming & Aesthethic

(use-package dracula-theme
   :config
   (load-theme 'dracula)
   :ensure t)
   

(global-hl-line-mode t) ;; This highlights the current line in the buffer

(use-package beacon ;; This applies a beacon effect to the highlighted line
   :ensure t
   :config
   (beacon-mode 1))

Packages

Try

(use-package try
  :ensure t)

Which-key

(use-package which-key
  :config 
    (setq which-key-idle-delay 0.3)
    (setq which-key-popup-type 'frame)
    (which-key-mode)
    (which-key-setup-minibuffer)
    (set-face-attribute 'which-key-local-map-description-face nil 
       :weight 'bold)
  :ensure t)

Helm for navigation

(use-package helm
  :init
    (require 'helm-config)
    (setq helm-split-window-in-side-p t
          helm-move-to-line-cycle-in-source t)
  :config 
    (helm-mode 1) ;; Most of Emacs prompts become helm-enabled
    (helm-autoresize-mode 1) ;; Helm resizes according to the number of candidates
    (global-set-key (kbd "C-x b") 'helm-buffers-list) ;; List buffers ( Emacs way )
    (define-key evil-ex-map "b" 'helm-buffers-list) ;; List buffers ( Vim way )
    (global-set-key (kbd "C-x r b") 'helm-bookmarks) ;; Bookmarks menu
    (global-set-key (kbd "C-x C-f") 'helm-find-files) ;; Finding files with Helm
    (global-set-key (kbd "M-c") 'helm-calcul-expression) ;; Use Helm for calculations
    (global-set-key (kbd "C-s") 'helm-occur)  ;; Replaces the default isearch keybinding
    (global-set-key (kbd "C-h a") 'helm-apropos)  ;; Helmized apropos interface
    (global-set-key (kbd "M-x") 'helm-M-x)  ;; Improved M-x menu
    (global-set-key (kbd "M-y") 'helm-show-kill-ring)  ;; Show kill ring, pick something to paste
  :ensure t)

Magit

(use-package magit
  :ensure t)

Flycheck

(use-package flycheck
  :ensure t
  :init
  (global-flycheck-mode t))

Elpy

(use-package elpy
  :ensure t
  :config
  (elpy-enable))

Yasnippet

(use-package yasnippet
  :ensure t
  :init
  (yas-global-mode 1))

Treemacs

(use-package treemacs
  :ensure t
  :defer t
  :init
  (with-eval-after-load 'winum
    (define-key winum-keymap (kbd "M-0") 'treemacs-select-window))
  :config
  (progn
    (setq treemacs-collapse-dirs              (if (executable-find "python") 3 0)
          treemacs-deferred-git-apply-delay   0.5
          treemacs-display-in-side-window     t
          treemacs-file-event-delay           5000
          treemacs-file-follow-delay          0.2
          treemacs-follow-after-init          t
          treemacs-follow-recenter-distance   0.1
          treemacs-git-command-pipe           ""
          treemacs-goto-tag-strategy          'refetch-index
          treemacs-indentation                2
          treemacs-indentation-string         " "
          treemacs-is-never-other-window      nil
          treemacs-max-git-entries            5000
          treemacs-no-png-images              nil
          treemacs-no-delete-other-windows    t
          treemacs-project-follow-cleanup     nil
          treemacs-persist-file               (expand-file-name ".cache/treemacs-persist" user-emacs-directory)
          treemacs-recenter-after-file-follow nil
          treemacs-recenter-after-tag-follow  nil
          treemacs-show-cursor                nil
          treemacs-show-hidden-files          nil
          treemacs-silent-filewatch           nil
          treemacs-silent-refresh             nil
          treemacs-sorting                    'alphabetic-desc
          treemacs-space-between-root-nodes   t
          treemacs-tag-follow-cleanup         t
          treemacs-tag-follow-delay           1.5
          treemacs-width                      35)

    ;; The default width and height of the icons is 22 pixels. If you are
    ;; using a Hi-DPI display, uncomment this to double the icon size.
    ;;(treemacs-resize-icons 44)

    (treemacs-follow-mode t)
    (treemacs-filewatch-mode t)
    (treemacs-fringe-indicator-mode t)
    (pcase (cons (not (null (executable-find "git")))
                 (not (null (executable-find "python3"))))
      (`(t . t)
       (treemacs-git-mode 'deferred))
      (`(t . _)
       (treemacs-git-mode 'simple))))
  :bind
  (:map global-map
        ("M-0"       . treemacs-select-window)
        ("C-x t 1"   . treemacs-delete-other-windows)
        ("C-x t t"   . treemacs)
        ("C-x t B"   . treemacs-bookmark)
        ("C-x t C-t" . treemacs-find-file)
        ("C-x t M-t" . treemacs-find-tag)))

(use-package treemacs-evil
  :after treemacs evil
  :ensure t)

(use-package treemacs-projectile
  :after treemacs projectile
  :ensure t)

Reveal.js

(use-package ox-reveal
:ensure ox-reveal)
(setenv "PATH" (concat (getenv "PATH") ":/opt/texlive/2019/bin/x86_64-linux"))

(setq org-reveal-root "http://cdn.jsdelivr.net/reveal.js/3.0.0/")
(setq org-reveal-mathjax t)
(use-package htmlize
   :ensure t)

Dired and Ranger for File Management

;(use-package dired
   ;:ensure t
   ;:config (require 'dired))
   
;;(add-hook 'dired-load-hook
	    ;;(function (lambda () (load "dired-x"))))
(use-package ranger
  :ensure t)
(setq ranger-preview-file true)

Auto-Complete

(use-package auto-complete
  :ensure t
  :config 
  (ac-config-default)
)

Emmet-mode

(use-package emmet-mode
  :ensure t
  :config 
    (add-hook 'sgml-mode-hook 'emmet-mode) ;; Auto-start on any markup modes
    (add-hook 'css-mode-hook  'emmet-mode) ;; enable Emmet's css abbreviation.
)
(use-package ac-emmet
  :ensure t
  :config
    (add-hook 'sgml-mode-hook 'ac-emmet-html-setup)
    (add-hook 'css-mode-hook 'ac-emmet-css-setup)
)

Markdown-mode

(use-package markdown-mode
  :ensure t
  :mode (("README\\.md\\'" . gfm-mode)
         ("\\.md\\'" . markdown-mode)
         ("\\.markdown\\'" . markdown-mode))
  :init (setq markdown-command "multimarkdown"))
  

Yang-mode

(autoload 'yang-mode "yang-mode" "Major mode for editing YANG modules." t)
(add-to-list 'auto-mode-alist '("\\.yang$" . yang-mode))

Restclient

(use-package restclient
  :ensure t)

Chess-mode for fun

;; This also requires an external chess engine such as gnuchess or crafty
(use-package chess
  :ensure t)

Org Mode Stuff

Aesthetics, customizations

(use-package org-superstar  ;; Improved version of org-bullets
  :ensure t
  :config
  (add-hook 'org-mode-hook (lambda () (org-superstar-mode 1))))
  
(setq org-startup-indented t)           ;; Indent according to section
(setq org-startup-with-inline-images t) ;; Display images in-buffer by default

Evil-org for evil-mode integration

This is very fancy, it treats org-mode elements (i.e. sections, source blocks, tables) as regular text objects ( ‘ae’ object ). Additionally, it allows reordering stuff using M-j, M-k, M-l and M-h instead of the regular M-<arrow keys>. Operators that deal with indentation ( < and > ) also indent headers.

(use-package evil-org
  :ensure t
  :after (evil org)
  :config
  (add-hook 'org-mode-hook 'evil-org-mode)
  (add-hook 'evil-org-mode-hook
            (lambda ()
              (evil-org-set-key-theme '(navigation insert textobjects additional calendar))))
  (require 'evil-org-agenda)
  (evil-org-agenda-set-keys))

Org-agenda

(setq org-agenda-custom-commands
   '(("h" "Daily habits"
      ((agenda ""))
      ((org-agenda-show-log t)
       (org-agenda-ndays 7)
       (org-agenda-log-mode-items '(state))
       (org-agenda-skip-function '(org-agenda-skip-entry-if 'notregexp ":DAILY:"))))))

Org-babel

(org-babel-do-load-languages
 'org-babel-load-languages
 '((python . t)))

Elisp Stuff

ParEdit mode

This minor mode for Elisp balances quotes and parenthesis automatically

(use-package paredit
  :ensure t)
(autoload 'enable-paredit-mode "paredit" "Turn on pseudo-structural editing of Lisp code." t)
(add-hook 'emacs-lisp-mode-hook       #'enable-paredit-mode)
(add-hook 'eval-expression-minibuffer-setup-hook #'enable-paredit-mode)
(add-hook 'ielm-mode-hook             #'enable-paredit-mode)
(add-hook 'lisp-mode-hook             #'enable-paredit-mode)
(add-hook 'lisp-interaction-mode-hook #'enable-paredit-mode)
(add-hook 'scheme-mode-hook           #'enable-paredit-mode)

LaTeX Stuff

; Auctex stuff 
 (setq TeX-auto-save t)
 (setq TeX-parse-self t)
 (setq-default TeX-master nil)
 (add-to-list 'org-latex-packages-alist '("" "listings" nil))
 (setq org-latex-listings t)   
 (setq org-latex-listings-options '(("breaklines" "true")))

 (use-package auctex
   :ensure t)    

 (add-hook 'LaTeX-mode-hook 'visual-line-mode)
 (add-hook 'LaTeX-mode-hook 'flyspell-mode)
 (add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)

 (add-hook 'LaTeX-mode-hook 'turn-on-reftex)
 (setq reftex-plug-into-AUCTeX t)

Skeletons

Latex

(define-skeleton latex-skeleton
"Skeleton for article type latex documents"
"Preamble:"
"\\documentclass{article}\n"
"\\usepackage[utf8]{inputenc}\n"
"\\usepackage[margin=1 in]{geometry}\n"
"\\usepackage{graphicx}\n"
"\\setlength{\\parindent}{4em}\n"
"\\setlength{\\parskip}{1em}\n"
"\\renewcommand{\\baselinestretch}{1.5}\n\n"
"\\author{Matheus Augusto da Silva}\n"
"\\title{"_"}\n"
"\\date{\\today}\n\n"
"\\begin{document}\n"
"\\maketitle\n\n"
"\\end{document}\n")

Org mode

(define-skeleton org-latex-summary
"Skeleton for summaries "
"Preamble:"
"#+LATEX_CLASS: article\n"
"#+LATEX_CLASS_OPTIONS: [a5paper,landscape,fourcolumn]\n"
"#+LATEX_COMPILER: lualatex\n"
"#+LATEX_HEADER: \\input{/home/trajanus/Documents/LaTeX/summaryheader.tex}\n"
"#+STARTUP: showeverything\n"
"#+OPTIONS: toc:nil\n"
"\\begin{multicols*}{4}\n"
"* "_"\n"
"\\end{multicols*}\n")
(define-skeleton org-latex-article
"Skeleton for articles "
"Preamble:"
"#+STARTUP: showeverything\n"
"#+TITLE: TITLE\n"
"#+AUTHOR: Matheus Augusto da Silva\n"
"#+DATE: \\today\n"
"#+LATEX_CLASS: article\n"
"#+LATEX_CLASS_OPTIONS: [a4paper]\n"
"#+LATEX_HEADER: \\input{/home/trajanus/Documents/LaTeX/articleheader.tex}\n"
"#+STARTUP: showeverything\n"
"#+OPTIONS: toc:nil\n")
(define-skeleton org-wiki-entry
"Skeleton for articles "
"Preamble:"
"#+STARTUP: showeverything\n"
"#+TITLE: "_"\n"
"#+AUTHOR: Matheus Augusto da Silva\n"
"#+STARTUP: showeverything\n"
"\n"
"* Index")
(define-skeleton org-wiki-index
"Skeleton for articles "
"Preamble:"
"#+STARTUP: showeverything\n"
"#+TITLE: "_"\n"
"#+AUTHOR: Matheus Augusto da Silva\n"
"#+STARTUP: showeverything\n"
"\n"
"* Index\n"
"\n"
"** Summaries\n"
"[[./summaries/summaries.org][Summaries]]"
)

Language Related

 ;; This requires SDCV 
 ;; This little function looks in a stardict file for words that look like
 ;; the word under the cursor. I use it when correcting my spelling in french
(defun dict-search ()
  (interactive)
  (add-hook 'comint-output-filter-functions 'comint-watch-for-password-prompt)
  (shell-command (format "export STARDICT_DATA_DIR=/home/trajanus/Documents/Stardict ;sdcv %s | head -5" (thing-at-point 'word))))

(define-key evil-normal-state-map (kbd "ç") 'ispell-word)
(define-key evil-normal-state-map (kbd "Ç") 'dict-search)