Skip to content

Instantly share code, notes, and snippets.

@nacho4d
Last active November 22, 2016 12:06
Show Gist options
  • Save nacho4d/7927218 to your computer and use it in GitHub Desktop.
Save nacho4d/7927218 to your computer and use it in GitHub Desktop.
My emacs configuration ...
;; Add ~/.elisp directory to my load path.
;; Not needed since .emacs.d is read by default
(add-to-list 'load-path' "~/.emacs.d")
;; Show trailing white spaces
(setq-default show-trailing-whitespace t)
(set-face-background 'trailing-whitespace "#191970")
;; Adds Other Package manager repositories
(require 'package)
(add-to-list 'package-archives
'("elpa" . "http://tromey.com/elpa/"))
(add-to-list 'package-archives
'("marmalade" . "http://marmalade-repo.org/packages/"))
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/"))
;; Adds TangoTango Theme
(load-theme 'tangotango t)
;; New buffer opens in vertical buffer by default
;; http://stackoverflow.com/q/3389147
(setq split-height-threshold nil)
(setq split-width-threshold 0)
;; Auto-complete mode stuff (Only for c/c++ and maybe other langs)
;; http://cx4a.org/software/auto-complete/
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d//ac-dict")
(ac-config-default)
;; Scroll one line at a time
(setq scroll-step 2)
;; scroll-conservatively 10000)
;; Delay timer for JIT, faster loading of documents
(setq jit-lock-defer-time 0.05)
;; dired stuff
;; Hide uninteresting files
;; http://www.emacswiki.org/emacs/DiredOmitMode
;; http://stackoverflow.com/q/14850103
(require 'dired-x)
(setq-default dired-omit-files-p t) ; this is buffer-local variable
(setq dired-omit-files "^\\.[^.]\\|\\.pdf$\\|\\.meta$")
;; Search quickly in dired mode
;; http://stackoverflow.com/a/20617005/149008
(eval-after-load 'dired
'(progn
(define-key dired-mode-map (kbd "C-s") 'dired-isearch-filenames)
(define-key dired-mode-map (kbd "C-M-s") 'dired-isearch-filenames-regexp)
))
;; Show file structure: "imenu-tree" command
;; http://www.emacswiki.org/emacs/TreeMode
(eval-after-load "tree-widget"
'(if (boundp 'tree-widget-themes-load-path)
(add-to-list 'tree-widget-themes-load-path "~/.emacs.d/")))
(autoload 'imenu-tree "imenu-tree" "Imenu tree" t)
(autoload 'tags-tree "tags-tree" "TAGS tree" t)
;; Show the directories in a tree structure: "dirtree" command
(autoload 'dirtree "dirtree" "Add directory to tree view" t)
(global-set-key "\C-o" 'dirtree-show)
;; C Sharp mode & omnisharp-mode
;; http://www.emacswiki.org/emacs/CSharpMode
;; https://github.com/sp3ctum/omnisharp-emacs
(require 'csharp-mode)
(add-hook 'csharp-mode-hook 'omnisharp-mode)
;; No tabs & Linux mode instead of the default GNU
;; http://www.emacswiki.org/emacs/IndentingC
(setq c-basic-offset 4)
(setq tab-width 4)
(setq indent-tabs-mode nil)
(setq-default indent-tabs-mode nil)
(setq c-default-style "linux" c-basic-offset 4)
;; SQL Editing mode
(require 'sql)
(autoload 'sql-mode "sql-mode" "SQL Editing Mode" t)
(setq auto-mode-alist
(append '(("\\.sql$" . sql-mode)
("\\.proc$" . sql-mode)
("\\.sp$" . sql-mode))
auto-mode-alist))
;; cmake mode
;; http://www.cmake.org/Wiki/CMake/Editors/Emacs
; Add cmake listfile names to the mode list.
(setq auto-mode-alist
(append
'(("CMakeLists\\.txt\\'" . cmake-mode))
'(("\\.cmake\\'" . cmake-mode))
auto-mode-alist))
(autoload 'cmake-mode "~/.emacs.d/cmake-mode.el" t)
;; Mouse scrolling for emacs. Requires MouseTerm - https://bitheap.org/mouseterm/
(unless window-system
(xterm-mouse-mode 1)
(global-set-key [mouse-4] '(lambda ()
(interactive)
(scroll-down 1)))
(global-set-key [mouse-5] '(lambda ()
(interactive)
(scroll-up 1))))
(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.
'(custom-safe-themes (quote ("dbf8cb30319aa88d14c569ef4509bd2c9ad6c8c58e7e7a7ae61a872cb32e9de2" default)))
'(gud-gdb-command-name "gdb --annotate=1")
'(large-file-warning-threshold nil)
'(safe-local-variable-values (quote ((sh-basic-offset . 4) (sh-indent-comment . t)))))
(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.
)
(put 'dired-find-alternate-file 'disabled nil)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment