Skip to content

Instantly share code, notes, and snippets.

@gbluma
Created October 19, 2016 03:15
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 gbluma/989443a75cc0a2dbfb01bf73279f1f2b to your computer and use it in GitHub Desktop.
Save gbluma/989443a75cc0a2dbfb01bf73279f1f2b to your computer and use it in GitHub Desktop.
;; Turn off auto save
(setq auto-save-default nil)
;; Turn off the toolbar
(tool-bar-mode -1)
;; set theme
;; change colors based on time
(let ((hour (nth 2 (decode-time))))
(if (or (< hour 7)
(> hour 17))
(load-theme 'wombat)
(load-theme 'leuven)))
;;(set-background-color "#fffff0")
;; Set the fonts
(set-face-attribute 'default nil :font "Consolas-10")
;(set-face-attribute 'default nil :font "Microsoft YaHei UI-9")
;; change cursor style to a bar
(setq-default cursor-type '(bar . 3))
;; Windows style copy-and-paste
;(cua-mode)
; ctrl-z in a buffer will return to shell
(global-set-key (kbd "C-z") 'eshell)
; ctrl-z in a shell will return to buffer
(add-hook 'eshell-mode-hook
(lambda ()
(local-set-key (kbd "C-z") 'bury-buffer)))
;; set auto-complete to M-n
(global-set-key (kbd "M-n") 'dabbrev-expand)
;; Turn on ido-mode (better file navigation)
(setq ido-enable-flex-matching t
ido-auto-merge-work-directories-length -1
ido-create-new-buffer 'always
ido-use-filename-at-point 'guess
ido-everywhere t
ido-default-buffer-method 'selected-window)
(ido-mode 1)
(put 'ido-exit-minibuffer 'disabled nil)
(when (require 'ido-ubiquitous nil t)
(ido-ubiquitous-mode 1))
(load-file "~/.emacs.d/felix-mode.el")
;; Compilation
(setq makescript "build.bat")
(setq compilation-directory-locked nil)
(defun find-project-directory-recursive ()
"Recursively search for a makefile."
(interactive)
(if (file-exists-p makescript) t
(cd "../")
(find-project-directory-recursive)))
(defun lock-compilation-directory ()
"The compilation process should NOT hunt for a makefile"
(interactive)
(setq compilation-directory-locked t)
(message "Compilation directory is locked."))
(defun unlock-compilation-directory ()
"The compilation process SHOULD hunt for a makefile"
(interactive)
(setq compilation-directory-locked nil)
(message "Compilation directory is roaming."))
(defun find-project-directory ()
"Find the project directory."
(interactive)
(setq find-project-from-directory default-directory)
(switch-to-buffer-other-window "*compilation*")
(if compilation-directory-locked (cd last-compilation-directory)
(cd find-project-from-directory)
(find-project-directory-recursive)
(setq last-compilation-directory default-directory)))
(defun make-without-asking ()
"Make the current build."
(interactive)
(if (find-project-directory) (compile makescript))
(other-window 1))
(define-key global-map "\em" 'make-without-asking)
; Commands
(set-variable 'grep-command "findstr -s -n -i -l ")
; Smooth scroll
(setq scroll-step 3)
; Clock
(display-time)
;(define-key global-map [S-tab] 'indent-for-tab-command)
;(define-key global-map [C-tab] 'indent-region)
(setq ring-bell-function 'ignore)
(show-paren-mode 1)
(setq show-paren-delay 0)
;(setq-default indent-tabs-mode t)
(setq tab-width 4)
;; configure git to work
(setenv "GIT_EDITOR" "notepad")
;; gnus setup
(setenv "EMAIL" "garrett.bluma@gmail.com")
(setenv "NAME" "Garrett Bluma")
(setenv "SMTPSERVER" "smtp.gmail.com")
(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.
'(ansi-color-faces-vector
[default default default italic underline success warning error])
'(custom-enabled-themes (quote (wombat))))
(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