Skip to content

Instantly share code, notes, and snippets.

@yozhsh
Last active December 28, 2023 04:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yozhsh/da7a579101e3a3ef1e7c27b5b76c2a26 to your computer and use it in GitHub Desktop.
Save yozhsh/da7a579101e3a3ef1e7c27b5b76c2a26 to your computer and use it in GitHub Desktop.
.emacs config file
;; System-type definition
(defun system-is-linux()
(string-equal system-type "gnu-linux"))
;; Start Emacs as server
(when (system-is-linux)
(require 'server)
(unless (server-running-p)
(server-start)))
;; Unix path-variable
(when (system-is-linux)
(setq unix-sbcl-bin "/usr/bin/sbcl")
(setq unix-init-path "~/.emacs.d")
(setq unix-init-ct-path "~/.emacs.d/plugins/color-theme")
(setq unix-init-ac-path "~/.emacs.d/plugins/auto-complete")
(setq unix-init-slime-path "/usr/share/emacs/site-lisp/slime/")
(setq unix-init-ac-dict-path "~/.emacs.d/plugins/auto-complete/dict"))
;; My name and e-mail adress
(setq user-full-name "ecl")
(setq user-mail-adress "eclypze@protonmail.com")
;; Dired
(require 'dired)
(setq dired-recursive-deletes 'top)
;; Imenu
(require 'imenu)
(setq imenu-auto-rescan t)
(setq imenu-use-popup-menu nil)
(global-set-key (kbd "<f9>") 'imenu)
;; Display the name of the current buffer in the title bar
(setq frame-title-format "GNU Emacs: %b")
;; Inhibit startup/splash screen
(setq inhibit-splash-screen t)
(setq ingibit-startup-message t) ;; экран приветствия можно вызвать комбинацией C-h C-a
;; Show-paren-mode settings
(show-paren-mode t) ;; включить выделение выражений между {},[],()
(setq show-paren-style 'expression) ;; выделить цветом выражения между {},[],()
;; Electric-modes settings
(electric-pair-mode 1) ;; автозакрытие {},[],() с переводом курсора внутрь скобок
(electric-indent-mode -1) ;; отключить индентацию electric-indent-mod'ом (default in Emacs-24.4)
;; Disable GUI components
(tooltip-mode -1)
(menu-bar-mode -1) ;; отключаем графическое меню
(tool-bar-mode -1) ;; отключаем tool-bar
(scroll-bar-mode -1) ;; отключаем полосу прокрутки
(blink-cursor-mode -1) ;; курсор не мигает
(setq use-dialog-box nil) ;; никаких графических диалогов и окон - все через минибуфер
(setq redisplay-dont-pause t) ;; лучшая отрисовка буфера
(setq ring-bell-function 'ignore) ;; отключить звуковой сигнал
;; Disable backup/autosave files
(setq make-backup-files nil)
(setq auto-save-default nil)
(setq auto-save-list-file-name nil) ;; я так привык... хотите включить - замените nil на t
;; Linum plugin
(require 'linum) ;; вызвать Linum
(line-number-mode t) ;; показать номер строки в mode-line
(global-linum-mode t) ;; показывать номера строк во всех буферах
(column-number-mode t) ;; показать номер столбца в mode-line
(setq linum-format " %d") ;; задаем формат нумерации строк
;; Fringe settings
(fringe-mode '(8 . 0)) ;; органичиталь текста только слева
(setq-default indicate-empty-lines t) ;; отсутствие строки выделить глифами рядом с полосой с номером строки
(setq-default indicate-buffer-boundaries 'left) ;; индикация только слева
;; Display file size/time in mode-line
(setq display-time-24hr-format t) ;; 24-часовой временной формат в mode-line
(display-time-mode t) ;; показывать часы в mode-line
(size-indication-mode t) ;; размер файла в %-ах
;; Start window size
(when (window-system)
(set-frame-size (selected-frame) 100 50))
;; IDO plugin
(require 'ido)
(ido-mode t)
(icomplete-mode t)
(ido-everywhere t)
(setq ido-vitrual-buffers t)
(setq ido-enable-flex-matching t)
; Buffer Selection and ibuffer settings
(require 'bs)
(require 'ibuffer)
(defalias 'list-buffers 'ibuffer) ;; отдельный список буферов при нажатии C-x C-b
(global-set-key (kbd "<f2>") 'bs-show) ;; запуск buffer selection кнопкой F2
;; Syntax highlighting
(require 'font-lock)
(global-font-lock-mode t) ;; включено с версии Emacs-22. На всякий...
(setq font-lock-maximum-decoration t)
;; Indent settings
(setq-default indent-tabs-mode nil) ;; отключить возможность ставить отступы TAB'ом
(setq-default tab-width 4) ;; ширина табуляции - 4 пробельных символа
(setq-default c-basic-offset 4)
(setq-default standart-indent 4) ;; стандартная ширина отступа - 4 пробельных символа
(setq-default lisp-body-indent 4) ;; сдвигать Lisp-выражения на 4 пробельных символа
(global-set-key (kbd "RET") 'newline-and-indent) ;; при нажатии Enter перевести каретку и сделать отступ
(setq lisp-indent-function 'common-lisp-indent-function)
;; Scrolling settings
(setq scroll-step 1) ;; вверх-вниз по 1 строке
(setq scroll-margin 10) ;; сдвигать буфер верх/вниз когда курсор в 10 шагах от верхней/нижней границы
(setq scroll-conservatively 10000)
;; Short messages
(defalias 'yes-or-no-p 'y-or-n-p)
;; Clipboard settings
(setq x-select-enable-clipboard t)
;; End of file newlines
(setq require-final-newline t) ;; добавить новую пустую строку в конец файла при сохранении
(setq next-line-add-newlines nil) ;; не добавлять новую строку в конец при смещении
;; курсора стрелками
;; Highlight search resaults
(setq search-highlight t)
(setq query-replace-highlight t)
(setq package-archives '(("melpa-stable" . "https://stable.melpa.org/packages/")))
(setq ergoemacs-theme nil)
(setq ergoemacs-keyboard-layout "us")
(require 'ergoemacs-mode)
(ergoemacs-mode 1)
;; Spacemacs dark theme
(load-theme 'spacemacs-dark t)
;; Neotree
(require 'neotree)
(global-set-key [f10] 'neotree-toggle)
(when (system-is-linux)
(when (and (file-exists-p unix-sbcl-bin) (file-directory-p unix-init-slime-path))
(setq inferior-lisp-program unix-sbcl-bin)
(add-to-list 'load-path unix-init-slime-path)
(run-slime)))
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(package-selected-packages '(neotree ergoemacs-mode spacemacs-theme)))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment