123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- ;; System-type definition
- (defun system-is-linux()
- (string-equal system-type "gnu/linux"))
- (defun system-is-windows()
- (string-equal system-type "windows-nt"))
- (defun system-is-macos()
- (string-equal system-type "darwin"))
- ;; Start Emacs as a server
- (when (system-is-linux)
- (require 'server)
- (unless (server-running-p)
- (server-start))) ;; launch emacs as a server if OS - GNU/Linux
- ;; MS Windows path-variable
- (when (system-is-windows)
- (setq win-sbcl-exe "C:/sbcl/sbcl.exe")
- (setq win-init-path "C:/.emacs.d/lisp")
- (setq win-init-ct-path "C:/.emacs.d/plugins/color-theme")
- (setq win-init-ac-path "C:/.emacs.d/plugins/auto-complete")
- (setq win-init-slime-path "C:/slime")
- (setq win-init-ac-dict-path "C:/.emacs.d/plugins/auto-complete/dict"))
- ;; Unix path-variable
- (when (system-is-linux)
- (setq unix-sbcl-bin "/usr/bin/sbcl")
- (setq unix-init-path "~/.emacs.d/lisp")
- (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/common-lisp/source/slime/")
- (setq unix-init-ac-dict-path "~/.emacs.d/plugins/auto-complete/dict"))
- ;; Dired
- (require 'dired)
- (setq dired-recursive-deletes 'top) ;; so we can delete non-empty directories
- ;; Imenu
- (require 'imenu)
- (setq imenu-auto-rescan t) ;; automatically update the list of functions in the buffer
- (setq imenu-use-popup-menu nil) ;; Imenu dialog only in the mini-buffer
- (global-set-key (kbd "<f6>") 'imenu) ;; press F6 to launch Imenu
- ;; Display the name of the current buffer in the title bar
- (setq frame-title-format "GNU Emacs: %b")
- ;; Load path for plugins
- (if (system-is-windows)
- (add-to-list 'load-path win-init-path)
- (add-to-list 'load-path unix-init-path))
- ;; Inhibit startup/splash screen
- (setq inhibit-splash-screen t)
- (setq ingibit-startup-message t) ;;startup screen can be open with C-h
- ;; Show-paren-mode settings
- (show-paren-mode t) ;; turn on text highlight within {},[],()
- (setq show-paren-style 'expression) ;; highlight text inside {}, [], ()
- ;; Electric-modes settings
- (electric-pair-mode 1) ;; automatically close brackets {},[],()
- (electric-indent-mode -1) ;; turn off auto indent with electric-indent-mod (default in Emacs-24.4)
- ;; Delete selection
- (delete-selection-mode t)
- ;; Disable GUI components
- (tooltip-mode -1)
- (menu-bar-mode -1) ;; turn off GUI menu bar
- (tool-bar-mode -1) ;; turn off toolbar
- (scroll-bar-mode -1) ;; turn off scrollbar
- (blink-cursor-mode -1) ;; turn off cursor blink
- (setq use-dialog-box nil) ;; all dialogs through mini-buffer
- (setq redisplay-dont-pause t) ;; better buffer display
- (setq ring-bell-function 'ignore) ;; turn off sound notification
- ;; Coding-system settings
- (set-language-environment 'UTF-8)
- (if (system-is-linux) ;; utf-8 for GNU/Linux and macOS, windows-1251 for MS Windows
- (progn
- (setq default-buffer-file-coding-system 'utf-8)
- (setq-default coding-system-for-read 'utf-8)
- (setq file-name-coding-system 'utf-8)
- (set-selection-coding-system 'utf-8)
- (set-keyboard-coding-system 'utf-8-unix)
- (set-terminal-coding-system 'utf-8)
- (prefer-coding-system 'utf-8))
- (progn
- (prefer-coding-system 'windows-1251)
- (set-terminal-coding-system 'windows-1251)
- (set-keyboard-coding-system 'windows-1251-unix)
- (set-selection-coding-system 'windows-1251)
- (setq file-name-coding-system 'windows-1251)
- (setq-default coding-system-for-read 'windows-1251)
- (setq default-buffer-file-coding-system 'windows-1251)))
- ;; Linum plugin
- (require 'linum) ;; call Linum
- (line-number-mode t) ;; show line number in mode-line
- (global-linum-mode t) ;; show line number in all buffers
- (column-number-mode t) ;; show column number in mode-line
- (setq linum-format " %d") ;; set up line numbering format
- ;; Fringe settings
- (fringe-mode '(8 . 0)) ;; fringe is only on the left side
- (setq-default indicate-empty-lines t) ;; empty lines are marked
- (setq-default indicate-buffer-boundaries 'left) ;; indication are shown on the left side
- ;; Display file size/time in mode-line
- (setq display-time-24hr-format t) ;; 24-hour time format in the mode-line
- (display-time-mode t) ;; show time in mode-line
- (size-indication-mode t) ;; file size in %
- ;; Line wrapping
- (setq word-wrap t) ;; word wrapping
- (global-visual-line-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) ;; separate buffer list with C-x C-b
- (global-set-key (kbd "<f2>") 'bs-show) ;; start buffer selection by pressing F2
- ;; Syntax highlighting
- (require 'font-lock)
- (global-font-lock-mode t) ;; just in case... set on since Emacs-22
- (setq font-lock-maximum-decoration t)
- ;; Indent settings
- (setq-default indent-tabs-mode nil) ;; turn off indentation via tab
- (setq-default tab-width 2) ;; tab size
- (setq-default c-basic-offset 2)
- (setq-default standart-indent 2) ;; standard offset
- (setq-default lisp-body-indent 2) ;; offset in lisp
- (global-set-key (kbd "RET") 'newline-and-indent) ;; with enter, make new line and indent
- (setq lisp-indent-function 'common-lisp-indent-function)
- ;; Scrolling settings
- (setq scroll-step 1) ;; up-down scrolling speed is 1
- (setq scroll-margin 10) ;; set up scrolling margin
- (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) ;; add additional newline while saving file
- (setq next-line-add-newlines nil) ;; do not add new line with arrow keys
- ;; Highlight search resaults
- (setq search-highlight t)
- (setq query-replace-highlight t)
- ;; Easy transition between buffers: M-arrow-keys
- (if (equal nil (equal major-mode 'org-mode))
- (windmove-default-keybindings 'meta))
- ;; Delete trailing whitespaces, format buffer and untabify when save buffer
- ;;(defun format-current-buffer()
- ;; (indent-region (point-min) (point-max)))
- ;;(defun untabify-current-buffer()
- ;; (if (not indent-tabs-mode)
- ;; (untabify (point-min) (point-max)))
- ;; nil)
- ;;(add-to-list 'write-file-functions 'format-current-buffer)
- ;;(add-to-list 'write-file-functions 'untabify-current-buffer)
- ;;(add-to-list 'write-file-functions 'delete-trailing-whitespace)
- ;; Mouse support
- (xterm-mouse-mode 1)
|