diff --git a/anmol-test-theme.el b/anmol-test-theme.el new file mode 100644 index 0000000..32de6cb --- /dev/null +++ b/anmol-test-theme.el @@ -0,0 +1,111 @@ +;; foreground : #fcffdc +;; background : #100f1f +;; color0 #212125 +;; color1 #c24949 +;; color2 #3eca3e +;; color3 #dcdc0f +;; color4 #6d6df3 +;; color5 #d068d0 +;; color6 #00cbcb +;; color7 #e2e2e2 +;; color8 #80776f +;; color9 #c25959 +;; color10 #3eca3e +;; color11 #dcdc00 +;; color12 #915bf3 +;; color13 #d040d0 +;; color14 #78dada +;; color15 #f5f5f5 + +(deftheme anmol-test + "Add some description here") + +(let ((class '((class color) (min-colors 89)))) + (custom-theme-set-faces + 'anmol-test + `(default ((,class (:background "#100f1f" :foreground "#fcffdc")))) + `(cursor ((,class (:background "#fcffdc" :foreground "#fcffdc")))) + ;; Highlighting faces + `(fringe ((,class (:background "#100f1f")))) + `(highlight ((,class (:background "#100f1f" :underline t)))) + ;; background during selection, this tends to be weird so feel free to experiment + `(region ((t (:background "#80776f" :foreground "#f5f5f5")))) + `(secondary-selection ((,class (:background "#100f1f")))) + `(isearch ((,class (:background "#100f1f" :foreground "#6d6df3" :weight bold)))) + `(isearch-fail ((t (:foreground "#fcffdc" :background "#c24949")))) + `(lazy-highlight ((,class (:background "#100f1f" :foreground "#dcdc0f" :weight bold)))) + ;; Mode line faces + `(mode-line ((,class (:background "#212125" :foreground "#e2e2e2")))) + `(mode-line-inactive ((,class (:background "#80776f" :foreground "#f5f5f5")))) + ;; Escape and prompt faces + `(minibuffer-prompt ((,class (:foreground "#00cbcb")))) + `(escape-glyph ((,class (:foreground "#dcdc0f" :weight bold)))) + `(homoglyph ((,class (:foreground "#3eca3e" :weight bold)))) + ;; Font lock faces, this is where all source file highlighing is done + `(font-lock-builtin-face ((,class (:foreground "#fcffdc" :weight bold)))) + `(font-lock-comment-face ((,class (:foreground "#3eca3e")))) + `(font-lock-constant-face ((,class (:foreground "#3eca3e")))) + `(font-lock-function-name-face ((,class (:foreground "#00cbcb")))) + `(font-lock-keyword-face ((,class (:foreground "#c25959" :weight bold)))) + `(font-lock-string-face ((,class (:foreground "#3eca3e")))) + `(font-lock-type-face ((,class (:foreground "#dcdc00" :weight bold)))) + `(font-lock-variable-name-face ((,class (:foreground "#e2e2e2")))) + `(font-lock-warning-face ((,class (:foreground "#c24949" :weight bold)))) + ;; Button and link faces + `(link ((,class (:foreground "#6d6df3" :underline t)))) + `(link-visited ((,class (:foreground "#915bf3" :underline t)))) + `(button ((,class (:background "#80776f" :foreground "#f5f5f5")))) + `(header-line ((,class (:background "#100f1f" :foreground "#dcdc00")))) + ;; Gnus faces + ;; `(gnus-group-news-1 ((,class (:weight bold :foreground "#95e454")))) + ;; `(gnus-group-news-1-low ((,class (:foreground "#95e454")))) + ;; `(gnus-group-news-2 ((,class (:weight bold :foreground "#cae682")))) + ;; `(gnus-group-news-2-low ((,class (:foreground "#cae682")))) + ;; `(gnus-group-news-3 ((,class (:weight bold :foreground "#ccaa8f")))) + ;; `(gnus-group-news-3-low ((,class (:foreground "#ccaa8f")))) + ;; `(gnus-group-news-4 ((,class (:weight bold :foreground "#99968b")))) + ;; `(gnus-group-news-4-low ((,class (:foreground "#99968b")))) + ;; `(gnus-group-news-5 ((,class (:weight bold :foreground "#cae682")))) + ;; `(gnus-group-news-5-low ((,class (:foreground "#cae682")))) + ;; `(gnus-group-news-low ((,class (:foreground "#99968b")))) + ;; `(gnus-group-mail-1 ((,class (:weight bold :foreground "#95e454")))) + ;; `(gnus-group-mail-1-low ((,class (:foreground "#95e454")))) + ;; `(gnus-group-mail-2 ((,class (:weight bold :foreground "#cae682")))) + ;; `(gnus-group-mail-2-low ((,class (:foreground "#cae682")))) + ;; `(gnus-group-mail-3 ((,class (:weight bold :foreground "#ccaa8f")))) + ;; `(gnus-group-mail-3-low ((,class (:foreground "#ccaa8f")))) + ;; `(gnus-group-mail-low ((,class (:foreground "#99968b")))) + ;; `(gnus-header-content ((,class (:foreground "#8ac6f2")))) + ;; `(gnus-header-from ((,class (:weight bold :foreground "#95e454")))) + ;; `(gnus-header-subject ((,class (:foreground "#cae682")))) + ;; `(gnus-header-name ((,class (:foreground "#8ac6f2")))) + ;; `(gnus-header-newsgroups ((,class (:foreground "#cae682")))) + + ;; set ansi-colors + `(ansi-color-black ((t (:foreground "#212125")))) + `(ansi-color-white ((t (:foreground "#e2e2e2")))) + `(ansi-color-red ((t (:foreground "#c24949")))) + `(ansi-color-yellow ((t (:foreground "#dcdc0f")))) + `(ansi-color-green ((t (:foregrounB "#3eca3e")))) + `(ansi-color-cyan ((t (:foreground "#00cbcb")))) + `(ansi-color-blue ((t (:foreground "#6d6df3")))) + `(ansi-color-magenta ((t (:foregrou0E "#d068d0")))) + `(ansi-color-bright-black ((t (:foreground "#80776f")))) + `(ansi-color-bright-white ((t (:foreground "#f5f5f5")))) + `(ansi-color-bright-red ((t (:foreground "#c25959")))) + `(ansi-color-bright-yellow ((t (:foreground "#dcdc00")))) + `(ansi-color-bright-green ((t (:foreground "#3eca3e")))) + `(ansi-color-bright-cyan ((t (:foreground "#78dada")))) + `(ansi-color-bright-blue ((t (:foreground "#915bf3" )))) + `(ansi-color-bright-magenta ((t (:foreground "#d040d0")))) + + ;; Message faces + ;; `(message-header-name ((,class (:foreground "#8ac6f2" :weight bold)))) + ;; `(message-header-cc ((,class (:foreground "#95e454")))) + ;; `(message-header-other ((,class (:foreground "#95e454")))) + ;; `(message-header-subject ((,class (:foreground "#cae682")))) + ;; `(message-header-to ((,class (:foreground "#cae682")))) + ;; `(message-cited-text ((,class (:foreground "#99968b")))) + `(message-separator ((,class (:foreground "#e2e2e2" :weight bold)))))) + +(provide-theme 'anmol-test) diff --git a/init.el b/init.el new file mode 100644 index 0000000..0f54ae5 --- /dev/null +++ b/init.el @@ -0,0 +1,140 @@ +;; Set default encoding for files +;; UTF-8 as default encoding +(set-language-environment "UTF-8") +(set-default-coding-systems 'utf-8) +(set-keyboard-coding-system 'utf-8-unix) +;; do this especially on Windows, else python output problem +(set-terminal-coding-system 'utf-8-unix) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Basic Changes ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(setq visible-bell 1) +(tool-bar-mode -1) +(scroll-bar-mode -1) +(menu-bar-mode -1) + +;; Set line number to relative globally +(global-display-line-numbers-mode 1) +(setq display-line-numbers-type 'relative) +;; Use Shitft+ArrowKeys to switch windows. +(windmove-default-keybindings) + +;; Set the auto generated code to another file +(setq custom-file (concat user-emacs-directory "autogen-custom.el")) +(when (file-exists-p custom-file) + (load custom-file)) + +(when (eq nil (file-directory-p "~/.emacs.d/emacs-backup")) + (make-directory "~/.emacs.d/emacs-backup")) + +(setq + backup-by-copying t ; don't clobber symlinks + backup-directory-alist + '(("." . "~/.emacs.d/emacs-backup")) ; don't litter my fs tree + delete-old-versions t + kept-new-versions 6 + kept-old-versions 2 + version-control t) ; use versioned backups + +;; Fold long lines +(global-visual-line-mode) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Package Management ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + (require 'package) + (package-initialize) + + ;; Adding Melpa + ;; (add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t) + (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) + (when (not package-archive-contents) + (package-refresh-contents)) + + ;; Add all packages to install in this list + (setq package-selected-packages + '(ivy counsel swiper magit company god-mode challenger-deep-theme)) +(package-install-selected-packages) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Compilation Mode ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Add colors in compilation mode +(require 'ansi-color) +(defun colorize-compilation-buffer () + (toggle-read-only) + (ansi-color-apply-on-region compilation-filter-start (point)) + (toggle-read-only)) +(add-hook 'compilation-filter-hook 'colorize-compilation-buffer) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Ivy, Counsel and Swiper ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Keybindings for ivy-counsel +(ivy-mode) +(setq ivy-use-virtual-buffers t) +(setq enable-recursive-minibuffers t) +(global-set-key "\C-s" 'swiper) +(global-set-key (kbd "C-c C-r") 'ivy-resume) +(global-set-key (kbd "") 'ivy-resume) +(global-set-key (kbd "M-x") 'counsel-M-x) +(global-set-key (kbd "C-x C-f") 'counsel-find-file) +(global-set-key (kbd " f") 'counsel-describe-function) +(global-set-key (kbd " v") 'counsel-describe-variable) +(global-set-key (kbd " o") 'counsel-describe-symbol) +(global-set-key (kbd " l") 'counsel-find-library) +(global-set-key (kbd " i") 'counsel-info-lookup-symbol) +(global-set-key (kbd " u") 'counsel-unicode-char) +(global-set-key (kbd "C-c g") 'counsel-git) +(global-set-key (kbd "C-c j") 'counsel-git-grep) +(global-set-key (kbd "C-c k") 'counsel-ag) +(global-set-key (kbd "C-x l") 'counsel-locate) +(global-set-key (kbd "C-S-o") 'counsel-rhythmbox) +(define-key minibuffer-local-map (kbd "C-r") 'counsel-minibuffer-history) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Dired ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; allow to use 'a' key in dired buffers to open the folders/files in the same buffer rather than make a new one +(put 'dired-find-alternate-file 'disabled nil) +;; show file sizes in human readable format in dired +(setq dired-listing-switches "-alh") +;; Auto-refresh dired on file change +(add-hook 'dired-mode-hook 'auto-revert-mode) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Company ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(add-hook 'after-init-hook 'global-company-mode) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Rice ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;; Setting font +(set-face-attribute 'default nil + :family "VictorMono Nerd Font" + :height 150 + :weight 'normal + :width 'normal) +(load-theme 'anmol-test 't) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Resize Windows ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Function to resize window +(defun v-resize (key) + "interactively resize the window" + (interactive "cHit '['/']' to enlarge/shrink vertically and '{'/'}' for horizontally") + (cond + ((eq key (string-to-char "[")) + (enlarge-window 1) + (call-interactively 'v-resize)) + ((eq key (string-to-char "]")) + (enlarge-window -1) + (call-interactively 'v-resize)) + ((eq key (string-to-char "{")) + (shrink-window-horizontally 1) + (call-interactively 'v-resize)) + ((eq key (string-to-char "}")) + (enlarge-window-horizontally 1) + (call-interactively 'v-resize)) + (t (push key unread-command-events)))) + +(defun switch-buffer-recompile () + "switch to compilation buffer and then recompile" + (interactive) + (switch-to-buffer '"*compilation*") + (recompile)) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; God Mode ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(global-set-key (kbd "") #'god-local-mode) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Keybindings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(global-set-key "\C-x[" 'v-resize) +(global-set-key "\C-x&" 'switch-buffer-recompile) +;; Overwrite suspend frame keybinding to avoid accidental suspend. +(global-set-key "\C-z" 'backward-char)