Giter Site home page Giter Site logo

jiromacs's Introduction

My Emacs Configuration

Initial setup

Melpa

Setup Package.el to Work with Melpa

(require 'package)
(add-to-list 'package-archives
             '("melpa" . "https://melpa.org/packages/"))
(package-refresh-contents)
(package-initialize)

Install use-package

The ‘:ensure’ keyword causes the package(s) within use-package statements to be installed automatically if not already present on your system.

(unless (package-installed-p 'use-package)
  (package-install 'use-package))

(setq use-package-always-ensure t)

Packages

evil

(use-package evil
  :init      ;; tweak evil's configuration before loading it
  (setq evil-want-integration t      ;; This is optional since it's already set to t by default.
         evil-want-keybinding nil
	 evil-vsplit-window-right t
	 evil-split-window-below t)
    (evil-mode))

(use-package evil-collection
  :after evil
  :config
  (setq evil-collection-mode-list '(dashboard dired ibuffer))
  (evil-collection-init))

(use-package evil-tutor)

doom-themes

(use-package doom-themes
  :config
  (setq doom-themes-enable-bold t     ; if nil, bold is universally disabled
        doom-themes-enable-italic t)
  (load-theme 'doom-one t)) ; if nil, italics is universally disabled

general

Install general.el which helps to easily make keybindings

(use-package general
  :config
  (general-evil-setup t))

doom-modeline

(use-package doom-modeline)
(doom-modeline-mode 1)

toc-org

Toc-org helps you to have an up-to-date table of contents in org files without exporting (useful useful for README files on GitHub). Use :TOC: to create the table.

(use-package toc-org
  :commands toc-org-enable
  :init (add-hook 'org-mode-hook 'toc-org-enable))

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 treemacs-python-executable 3 0)
          treemacs-deferred-git-apply-delay        0.5
          treemacs-directory-name-transformer      #'identity
          treemacs-display-in-side-window          t
          treemacs-eldoc-display                   'simple
          treemacs-file-event-delay                5000
          treemacs-file-extension-regex            treemacs-last-period-regex-value
          treemacs-file-follow-delay               0.2
          treemacs-file-name-transformer           #'identity
          treemacs-follow-after-init               t
          treemacs-expand-after-init               t
          treemacs-find-workspace-method           'find-for-file-or-pick-first
          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-missing-project-action          'ask
          treemacs-move-forward-on-expand          nil
          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-position                        'left
          treemacs-read-string-input               'from-child-frame
          treemacs-recenter-distance               0.1
          treemacs-recenter-after-file-follow      nil
          treemacs-recenter-after-tag-follow       nil
          treemacs-recenter-after-project-jump     'always
          treemacs-recenter-after-project-expand   'on-distance
          treemacs-litter-directories              '("/node_modules" "/.venv" "/.cask")
          treemacs-show-cursor                     nil
          treemacs-show-hidden-files               t
          treemacs-silent-filewatch                nil
          treemacs-silent-refresh                  nil
          treemacs-sorting                         'alphabetic-asc
          treemacs-select-when-already-in-treemacs 'move-back
          treemacs-space-between-root-nodes        t
          treemacs-tag-follow-cleanup              t
          treemacs-tag-follow-delay                1.5
          treemacs-text-scale                      nil
          treemacs-user-mode-line-format           nil
          treemacs-user-header-line-format         nil
          treemacs-wide-toggle-width               70
          treemacs-width                           35
          treemacs-width-increment                 1
          treemacs-width-is-initially-locked       t
          treemacs-workspace-switch-cleanup        nil)

    ;; 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 'always)

    (pcase (cons (not (null (executable-find "git")))
                 (not (null treemacs-python-executable)))
      (`(t . t)
       (treemacs-git-mode 'deferred))
      (`(t . _)
       (treemacs-git-mode 'simple)))

    (treemacs-hide-gitignored-files-mode nil))
  :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 d"   . treemacs-select-directory)
       ;; ("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)

(use-package treemacs-icons-dired
  :hook (dired-mode . treemacs-icons-dired-enable-once)
  :ensure t)

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

(use-package treemacs-persp ;;treemacs-perspective if you use perspective.el vs. persp-mode
  :after (treemacs persp-mode) ;;or perspective vs. persp-mode
  :ensure t
  :config (treemacs-set-scope-type 'Perspectives))

Winum

Windows numbers for changing them easily

(use-package winum)
(winum-mode)

Org mode tweaks

(add-hook 'org-mode-hook 'org-indent-mode)
(setq org-directory "~/Org/"
      org-agenda-files '("~/Org/agenda.org")
      org-default-notes-file (expand-file-name "notes.org" org-directory)
      org-ellipsis ""
      org-log-done 'time
      org-journal-dir "~/Org/journal/"
      org-journal-date-format "%B %d, %Y (%A) "
      org-journal-file-format "%Y-%m-%d.org"
      org-hide-emphasis-markers t)
(setq org-src-preserve-indentation nil
      org-src-tab-acts-natively t
      org-edit-src-content-indentation 0)

Graphical tweaks

Bars

Disable menubar, toolbars and scrollbars

(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)

Line numbers

Display Line Numbers

(global-display-line-numbers-mode 1)

Truncated lines

Display Truncated Lines

(global-visual-line-mode t)

Keybinds

Alternate buffer fn

This is a copy from spacemacs

(defun spacemacs/alternate-buffer (&optional window)
  "Switch back and forth between current and last buffer in the
current window.

If `spacemacs-layouts-restrict-spc-tab' is `t' then this only switches between
the current layouts buffers."
  (interactive)
  (cl-destructuring-bind (buf start pos)
      (if (bound-and-true-p spacemacs-layouts-restrict-spc-tab)
          (let ((buffer-list (persp-buffer-list))
                (my-buffer (window-buffer window)))
            ;; find buffer of the same persp in window
            (seq-find (lambda (it) ;; predicate
                        (and (not (eq (car it) my-buffer))
                             (member (car it) buffer-list)))
                      (window-prev-buffers)
                      ;; default if found none
                      (list nil nil nil)))
        (or (cl-find (window-buffer window) (window-prev-buffers)
                     :key #'car :test-not #'eq)
            (list (other-buffer) nil nil)))
    (if (not buf)
        (message "Last buffer not found.")
      (set-window-buffer-start-and-point window buf start pos))))

General keybinds

(nvmap :keymaps 'override :prefix "SPC"
	   ;; "SPC"   '(counsel-M-x :which-key "M-x")
	   "h r r" '((lambda () (interactive) (load-file "~/.emacs.d/init.el")) :which-key "Reload emacs config")
	   "t t"   '(toggle-truncate-lines                                      :which-key "Toggle truncate lines")
	   "b d"   '(kill-buffer                                                :which-key "Kill current buffer")
       "w -"   '(split-window-below                                         :which-key "Split window below")
       "w /"   '(split-window-right                                         :which-key "Split window right")
       "w d"   '(delete-window                                              :which-key "Delete window")
       "f t"   '(treemacs                                                   :which-key "Toggle treemacs"))

  (global-set-key (kbd "C-=") 'text-scale-increase)
  (global-set-key (kbd "C--") 'text-scale-decrease)

Buffer switch keybinds

(general-define-key
 :states '(normal visual insert emacs treemacs)
 :prefix "SPC"
 :non-normal-prefix "M-SPC"
	   "TAB" '(spacemacs/alternate-buffer :which-key "Last buffer")
       "0"   '(treemacs-select-window     :which-key "Select treemacs buffer")
       "1"   '(winum-select-window-1      :which-key "Select window 1..9")
       "2"   '(winum-select-window-2      :which-key "Select window 1..9")
       "3"   '(winum-select-window-3      :which-key "Select window 1..9")
       "4"   '(winum-select-window-4      :which-key "Select window 1..9")
       "5"   '(winum-select-window-5      :which-key "Select window 1..9")
       "6"   '(winum-select-window-6      :which-key "Select window 1..9")
       "7"   '(winum-select-window-7      :which-key "Select window 1..9")
       "8"   '(winum-select-window-8      :which-key "Select window 1..9")
       "9"   '(winum-select-window-9      :which-key "Select window 1..9"))

Generated stuff

Below is stuff automatically generated and added to this file by emacs packages

jiromacs's People

Contributors

matthewlisp avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.