basic settings
This commit is contained in:
parent
5c56ab7a84
commit
b70bfe5cad
|
@ -0,0 +1,101 @@
|
|||
;;; basic-settings.el --- provide basic configuration
|
||||
;;; Commentary:
|
||||
;; Configure basic parameters like linum and filesize
|
||||
;;; Code:
|
||||
|
||||
;; ibuffer settings
|
||||
|
||||
;; Buffers selectin and ibuffer settings
|
||||
(defun configure-ibuffer ()
|
||||
"Make awesome menu and bind it to F2;
|
||||
Integrate projectile with ibuffer."
|
||||
(use-package bs)
|
||||
(use-package ibuffer
|
||||
:bind (("<f2>" . ibuffer)
|
||||
("<f5>" . buffer-menu)))
|
||||
|
||||
;; (defalias 'list-buffers 'ibuffer-list-buffers)
|
||||
(use-package ibuffer-projectile
|
||||
:config
|
||||
(add-hook 'ibuffer-hook
|
||||
(lambda ()
|
||||
(ibuffer-projectile-set-filter-groups)
|
||||
(unless (eq ibuffer-sorting-mode 'alphabetic)
|
||||
(ibuffer-do-sort-by-alphabetic))))))
|
||||
|
||||
;; Linum plugin
|
||||
(defun configure-linum (&optional enabled)
|
||||
"Make linum ENABLED."
|
||||
(use-package linum
|
||||
:config
|
||||
(if enabled
|
||||
(and (line-number-mode t)
|
||||
(global-linum-mode t))
|
||||
(and (line-number-mode nil)
|
||||
(global-linum-mode nil)))
|
||||
(column-number-mode t)
|
||||
(setq linum-format " %d ")))
|
||||
|
||||
;; Comment block
|
||||
(defun comment-dwim-line (&optional arg)
|
||||
"Replacement for 'comment-dwim' ARG."
|
||||
(interactive "*P")
|
||||
(comment-normalize-vars)
|
||||
(if (and (not (region-active-p)) (not (looking-at "[ \t]*$")))
|
||||
(comment-or-uncomment-region (line-beginning-position) (line-end-position))
|
||||
(comment-dwim arg)))
|
||||
|
||||
(defun configure-base (&optional indent)
|
||||
"Set base configuration, configure INDENT."
|
||||
(configure-ibuffer)
|
||||
(configure-linum nil)
|
||||
|
||||
;; Exec path from shell
|
||||
(use-package exec-path-from-shell)
|
||||
|
||||
(global-set-key "\M-;" 'comment-dwim-line)
|
||||
|
||||
(setenv "PATH" (concat (getenv "PATH") ":~/.local/bin"))
|
||||
|
||||
;; Scrolling
|
||||
(setq scroll-step 1)
|
||||
(setq scroll-margin 10)
|
||||
(setq scroll-conservatively 10000)
|
||||
|
||||
;; Fringe settings
|
||||
(fringe-mode '(4 . 0))
|
||||
(setq-default indicate-empty-lines t)
|
||||
(setq-default indicate-buffer-boundaries 'left)
|
||||
;; (global-fringe-mode t)
|
||||
|
||||
;; Display file size in mode-line
|
||||
(setq display-time-24hr-format t)
|
||||
(display-time-mode t)
|
||||
(size-indication-mode t)
|
||||
|
||||
;; Indent settings
|
||||
(setq-default indent-tabs-mode nil)
|
||||
(setq-default tab-width indent)
|
||||
(setq-default c-basic-offset indent)
|
||||
(setq-default standart-indent indent)
|
||||
(setq-default lisp-body-indent indent)
|
||||
(global-set-key (kbd "RET") 'newline-and-indent)
|
||||
|
||||
;; Clipboard settings
|
||||
(setq x-select-enable-clipboard t)
|
||||
|
||||
;; EOF newlines
|
||||
(setq require-final-newline t)
|
||||
(setq next-line-add-newlines nil)
|
||||
|
||||
;; Highlight search results
|
||||
(setq search-highlight t)
|
||||
(setq query-replace-highlight t)
|
||||
|
||||
;; Undo & Redo
|
||||
(global-unset-key "\C-z")
|
||||
(global-set-key "\C-z" 'advertised-undo))
|
||||
|
||||
(provide 'basic-settings)
|
||||
|
||||
;;; basic-settings.el ends here
|
|
@ -3,6 +3,7 @@
|
|||
;;; Code:
|
||||
|
||||
(require 'packages-config)
|
||||
(require 'basic-settings)
|
||||
|
||||
(defun start-server-on-unix ()
|
||||
"If OS is Linux or MacOS start server."
|
||||
|
@ -27,13 +28,20 @@
|
|||
;; Install use-package
|
||||
(when (not (require 'use-package nil 'noerror))
|
||||
(and (message "Installing ")
|
||||
(package-install 'use-package))))
|
||||
(package-install 'use-package)))
|
||||
|
||||
;; Verbosity
|
||||
(setq use-package-verbose t)
|
||||
;; Always download packages
|
||||
(setq use-package-always-ensure t))
|
||||
|
||||
(defun common-setup ()
|
||||
"Setup base GNU Emacs configuration."
|
||||
(start-server-on-unix)
|
||||
(use-package-setup)
|
||||
(basic-setup))
|
||||
(basic-setup)
|
||||
;; Set indent to 4 space
|
||||
(configure-base 4))
|
||||
|
||||
(provide 'common)
|
||||
|
Loading…
Reference in New Issue