-(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.
- '(blink-cursor-mode nil)
- '(column-number-mode t)
- '(show-paren-mode t)
- '(tool-bar-mode nil))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
'(whitespace-space ((t (:foreground "gray30"))))
'(whitespace-tab ((t (:foreground "gray30")))))
-(setq inhibit-startup-screen t)
-(load-theme 'misterioso)
+;;
+(setq inhibit-startup-message t)
+;; package manager
+(require 'package)
+(setq package-enable-at-startup nil)
+(add-to-list 'package-archives
+ '("melpa" . "http://melpa.org/packages/"))
+
+(package-initialize)
-(global-linum-mode 1) ; display line numbers in margin
+(unless (package-installed-p 'use-package)
+ (package-refresh-contents)
+ (package-install 'use-package))
+;; theme
+(load-theme 'misterioso)
+
+;; generic
+(blink-cursor-mode -1)
+(column-number-mode t)
+(tool-bar-mode -1)
+(global-linum-mode 1)
+
+;; line numbers custom format
(defvar my-linum-format-string "%4d")
(add-hook 'linum-before-numbering-hook 'my-linum-get-format-string)
(defun my-linum-format (line-number)
(propertize (replace-regexp-in-string " " "\u2002" (format my-linum-format-string line-number)) 'face 'linum))
-
+;; display column numbers
(column-number-mode 1)
-;(setq make-backup-files nil) ; stop creating backup~ files
+
+;; highlight current line
+(global-hl-line-mode 1)
+(set-face-background 'hl-line "gray24")
+(set-face-foreground 'highlight nil)
+
+;; auto backup
(setq version-control t)
(setq vc-make-backup-files t)
(setq delete-old-versions t)
-(setq auto-save-default nil) ; stop creating #autosave# files
-;; save/restore opened files and windows config
-;; (desktop-save-mode 1) ; 0 for off
-(when window-system
-(set-frame-position (selected-frame) 50 10)
-(set-frame-size (selected-frame) 160 60 nil))
+(setq auto-save-default nil)
+
+;; delete trailing whitespaces on saving
+(add-hook 'before-save-hook 'delete-trailing-whitespace)
+
+;; ibuffer
+(global-set-key (kbd "C-x C-b") 'ibuffer)
+
+;; overwrite selected text
+(delete-selection-mode 1)
+;; horizontal split
+(setq split-width-threshold nil)
+(setq ediff-split-window-function 'split-window-horizontally)
+
+;; default frame size and position
+(when window-system
+ (toggle-frame-maximized))
+;; indentation
(setq-default tab-width 4)
(setq-default c-basic-offset 4)
+
+;;
(setq-default scroll-conservatively 1)
+
+;; show parentesis couple
+(setq show-paren-mode t)
(setq show-paren-delay 0)
(show-paren-mode 1)
+;; whitespace
(global-whitespace-mode 1)
(setq whitespace-style (quote (face spaces tabs newline space-mark tab-mark newline-mark)))
(setq whitespace-display-mappings
- '(
+ '(
(space-mark 32 [183] [46])
(newline-mark 10 [182 10])
(tab-mark 9 [8594 9] [92 9])))
-(setq ediff-split-window-function 'split-window-horizontally)
-
-(require 'package)
-(add-to-list 'package-archives
- '("melpa" . "http://melpa.org/packages/") t)
-
-(setq package-enable-at-startup nil)
-(package-initialize)
-
-(require 'linum-off)
-(add-to-list 'linum-disabled-modes-list '(Speedbar))
-
-(require 'spaceline-config)
-(spaceline-spacemacs-theme)
-(setq spaceline-buffer-position-p 'nil)
-(setq spaceline-hud-p 'nil)
-
-(require 'autopair)
-(autopair-global-mode)
-
-(require 'yasnippet)
-(yas-global-mode 1)
-;(define-key yas-minor-mode-map (kbd "<tab>") nil)
-;(define-key yas-minor-mode-map (kbd "TAB") nil)
-;(define-key yas-minor-mode-map (kbd "C-<tab>") 'yas-expand)
+;; dired-x
+;; omit dot files
+(require 'dired-x)
+(setq dired-omit-files "^\\...+$")
+(add-hook 'dired-mode-hook (lambda () (dired-omit-mode 1)))
+;; disable line numbers
+(use-package linum-off
+ :ensure t
+ :config
+ (require 'linum-off)
+ (add-to-list 'linum-disabled-modes-list '(Speedbar)))
+
+;; spaceline
+(use-package spaceline
+ :ensure t
+ :config
+ (require 'spaceline-config)
+ (spaceline-spacemacs-theme)
+ (setq spaceline-buffer-position-p 'nil)
+ (setq spaceline-hud-p 'nil))
+
+;; autopair
+(use-package autopair
+ :ensure t
+ :config
+ (require 'autopair)
+ (autopair-global-mode))
+
+;; yasnippet
+(use-package yasnippet
+ :ensure t
+ :config
+ (require 'yasnippet)
+ (yas-global-mode 1))
+
+;; smart-tabs-mode
+(use-package smart-tabs-mode
+ :ensure t
+ :config
+ (smart-tabs-insinuate 'c))
+
+;; sr-speedbar
+(use-package sr-speedbar
+ :ensure t
+ :config
+ (require 'sr-speedbar)
+ (setq sr-speedbar-right-side nil))
+
+;; auto-complete-nxml
+(use-package auto-complete-nxml
+ :ensure t
+ :config
+ (require 'auto-complete-nxml))
+
+;; recentf
+(use-package recentf
+ :ensure t
+ :config
+ (require 'recentf)
+ (recentf-mode 1)
+ (setq recentf-max-menu-items 25)
+ (global-set-key "\C-x\ \C-r" 'recentf-open-files)
+ (put 'upcase-region 'disabled nil))
+
+;; diff-hl
+(use-package diff-hl
+ :ensure t
+ :config
+ (global-diff-hl-mode)
+ (add-hook 'dired-mode-hook 'diff-hl-dired-mode))
+
+;; C environment
+
+;; flycheck
+(use-package flycheck
+ :ensure t
+ :config
+ (add-hook 'after-init-hook #'global-flycheck-mode)
+ (add-hook 'c-mode-hook (lambda () (setq flycheck-gcc-include-path (list "/usr/lib/x86_64-linux-gnu/glib-2.0/include"
+ "/usr/include/atk-1.0"
+ "/usr/include/at-spi-2.0"
+ "/usr/include/at-spi2-atk/2.0"
+ "/usr/include/cairo"
+ "/usr/include/dbus-1.0"
+ "/usr/include/evolution-data-server"
+ "/usr/include/gdk-pixbuf-2.0"
+ "/usr/include/gio-unix-2.0"
+ "/usr/include/glib-2.0"
+ "/usr/include/gnome-vfs-2.0"
+ "/usr/include/gobject-introspection-1.0"
+ "/usr/include/gtk-3.0"
+ "/usr/include/freetype2"
+ "/usr/include/harfbuzz"
+ "/usr/include/libpeas-1.0"
+ "/usr/include/libpng16"
+ "/usr/include/libsoup-2.4"
+ "/usr/include/libsoup-gnome-2.4"
+ "/usr/include/libxml2"
+ "/usr/include/nspr"
+ "/usr/include/nss"
+ "/usr/include/pixman-1"
+ "/usr/include/pango-1.0"
+ "/usr/include/poppler"
+ "/usr/include/poppler/glib"
+ "/usr/local/include"
+ "/usr/local/include/libgda-5.0"
+ "/usr/local/include/libgda-5.0/libgda"
+ "/usr/include/postgresql"
+ ))))
+ (setq-default flycheck-disabled-checkers '(c/c++-clang)))
+
+;; autocomplete
(semantic-mode 1)
(defun my-semantic-hook ()
(semantic-add-system-include "/usr/lib/x86_64-linux-gnu/glib-2.0/include")
)
(add-hook 'c-mode-common-hook 'my:add-semantic-to-autocomplete)
+(use-package auto-complete-c-headers
+ :ensure t)
+
(require 'auto-complete-config)
(ac-config-default)
(defun my:ac-c-header-init ()
(add-hook 'c++-mode-hook 'my:ac-c-header-init)
(add-hook 'c-mode-hook 'my:ac-c-header-init)
-(add-hook 'before-save-hook 'delete-trailing-whitespace)
-
-(global-set-key (kbd "C-x C-b") 'ibuffer)
-
-(require 'function-args)
-(fa-config-default)
+;; function-args
+(use-package function-args
+ :ensure t
+ :config
+ (require 'function-args)
+ (fa-config-default))
+;; code folding
(add-hook 'c-mode-common-hook 'hs-minor-mode)
-
-(global-hl-line-mode 1)
-(set-face-background 'hl-line "gray24")
-(set-face-foreground 'highlight nil)
-
-(global-diff-hl-mode)
-(add-hook 'dired-mode-hook 'diff-hl-dired-mode)
-
-(require 'sr-speedbar)
-(setq sr-speedbar-right-side nil)
-
-(add-hook 'after-init-hook #'global-flycheck-mode)
-(add-hook 'c-mode-hook (lambda () (setq flycheck-gcc-include-path (list "/usr/lib/x86_64-linux-gnu/glib-2.0/include"
- "/usr/include/atk-1.0"
- "/usr/include/at-spi-2.0"
- "/usr/include/at-spi2-atk/2.0"
- "/usr/include/cairo"
- "/usr/include/dbus-1.0"
- "/usr/include/evolution-data-server"
- "/usr/include/gdk-pixbuf-2.0"
- "/usr/include/gio-unix-2.0"
- "/usr/include/glib-2.0"
- "/usr/include/gnome-vfs-2.0"
- "/usr/include/gobject-introspection-1.0"
- "/usr/include/gtk-3.0"
- "/usr/include/freetype2"
- "/usr/include/harfbuzz"
- "/usr/include/libpeas-1.0"
- "/usr/include/libpng16"
- "/usr/include/libsoup-2.4"
- "/usr/include/libsoup-gnome-2.4"
- "/usr/include/libxml2"
- "/usr/include/nspr"
- "/usr/include/nss"
- "/usr/include/pixman-1"
- "/usr/include/pango-1.0"
- "/usr/include/poppler"
- "/usr/include/poppler/glib"
- "/usr/local/include"
- "/usr/local/include/libgda-5.0"
- "/usr/local/include/libgda-5.0/libgda"
- "/usr/include/postgresql"
- ))))
-(setq-default flycheck-disabled-checkers '(c/c++-clang))
-
-; split orizzontale
-(setq split-width-threshold nil)
-
-(require 'auto-complete-nxml)
-
-(require 'recentf)
-(recentf-mode 1)
-(setq recentf-max-menu-items 25)
-(global-set-key "\C-x\ \C-r" 'recentf-open-files)
-(put 'upcase-region 'disabled nil)
-
-(delete-selection-mode 1)
-
-(require 'dired-x)
-(setq dired-omit-files "^\\...+$")
-(add-hook 'dired-mode-hook (lambda () (dired-omit-mode 1)))
-
-(smart-tabs-insinuate 'c)