Skip to content

Instantly share code, notes, and snippets.

@Programator2
Last active March 21, 2023 10:59
Show Gist options
  • Save Programator2/b8b4cdeb6f54d35226ee5f24ec4d0838 to your computer and use it in GitHub Desktop.
Save Programator2/b8b4cdeb6f54d35226ee5f24ec4d0838 to your computer and use it in GitHub Desktop.
Programator2's Emacs config
;;; init.el --- Personal EMACS config by Programator2 -*- lexical-binding: t; -*-
;; Copyright (C) 2018-2023 Roderik Ploszek
;; Author: Roderik Ploszek <[email protected]>
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; Nothing too spectacular, I put it here so I can copy it quickly to other
;; machines. This is my quick and dirty config for new machines. I'm currently
;; using something more elaborate and I may someday finally put it on GitHub
;; once I get to clean it up a bit.
;;; Code:
;; MELPA
(require 'package)
(add-to-list 'package-archives (cons "melpa" "https://melpa.org/packages/") t)
(package-initialize)
;; garbage collection actiavates above 100 MB
(setq gc-cons-threshold 100000000 gc-cons-percentage 0.1)
;; org global keybindings
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cc" 'org-capture)
(global-set-key "\C-cb" 'org-switchb)
;; ENTER jumps to a link
(setq org-return-follows-link t)
;; (setq org-todo-keywords '((type "work" "personal" "|" "DONE")))
(setq org-log-done 'time)
;; org-journal
(global-set-key (kbd "C-c j") 'org-journal-new-entry)
(global-set-key (kbd "C-c l") 'org-store-link)
(setq org-journal-enable-agenda-integration t)
;; org clocking time
(setq-default org-clock-mode-line-total 'current)
;; org-present
(add-hook 'org-present-mode-hook
(lambda ()
(org-present-big)
(org-display-inline-images)))
(add-hook 'org-present-mode-quit-hook
(lambda ()
(org-present-small)
(org-remove-inline-images)))
;; org-babel
(org-babel-do-load-languages
'org-babel-load-languages
'((perl . t)))
;; bodka za vetou konci jednou medzerou
(setq-default sentence-end-double-space nil)
;; recentf-mode
(recentf-mode 1)
(setq recentf-max-saved-items 1000)
;; show parantheses
(show-paren-mode 1)
;; for org-present
;;(tool-bar-mode -1)
;;(tooltip-mode -1)
;;(menu-bar-mode -1)
(blink-cursor-mode 0)
;; set if you want to highlight current line
(global-hl-line-mode 0)
;; modernization of editor
;;(scroll-bar-mode -1)
;; return mark to the previous position if scrolled to the end
(setq scroll-error-top-bottom t)
;; Useless whitespace
;; Automaticky oznac prazdne znaky na konci riadku
(setq-default show-trailing-whitespace t)
;; But not in the calendar
(add-hook 'calendar-mode-hook
(function (lambda () (setq show-trailing-whitespace nil))))
;; Oznac prazdne riadky na konci suboru
(setq-default indicate-empty-lines t)
;; Display time in the modeline, in 24-hour format
(setq display-time-24hr-format t)
(display-time-mode)
;; helm
(require 'helm-config)
(helm-mode 1)
(global-set-key (kbd "M-x") 'helm-M-x)
(global-set-key (kbd "C-x b") 'helm-mini)
(global-set-key (kbd "C-x C-b") 'helm-mini)
(global-set-key (kbd "C-x C-f") 'helm-find-files)
(global-set-key (kbd "C-x C-r") 'helm-recentf)
;; July 2019 default keybindings for <left> and <right> were changed, this changes them back
(customize-set-variable 'helm-ff-lynx-style-map t)
;; which-key-mode
(which-key-mode)
;; move between windows using S-<arrow_key>
(windmove-default-keybindings)
;; restore window configuration using C-c left and C-c right
(winner-mode t)
;; Vim-like bindings
;; ffap (gf in Vim, so M-g M-f in Emacs)
(global-set-key (kbd "M-g M-f") 'ffap)
;; set auto fill mode for org-mode
(setq-default fill-column 80)
(add-hook 'org-mode-hook 'turn-on-auto-fill)
;; dni v tyzdni do kalendara
(copy-face font-lock-constant-face 'calendar-iso-week-face)
(set-face-attribute 'calendar-iso-week-face nil
:height 0.8)
(setq calendar-intermonth-text
'(propertize
(format "%2d"
(car
(calendar-iso-from-absolute
(calendar-absolute-from-gregorian (list month day year)))))
'font-lock-face 'calendar-iso-week-face))
;; Monday is the first day of the week
(setq calendar-week-start-day 1)
;; zalohy ukladaj do jednotneho priecinka
(setq backup-directory-alist
'(("." . "~/.emacs.d/backups")))
;; Aby sa subory otvarali tam, kde som ich zanechal
(save-place-mode 1)
;; template system yas
(setq yas-snippet-dirs
'("~/.emacs.d/snippets" ;; personal snippets
))
(yas-global-mode)
;; use M-x eval-buffer to reload this file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment