Skip to content

Instantly share code, notes, and snippets.

@erenesmer
Created February 19, 2019 19:24
Show Gist options
  • Save erenesmer/5f3597fa64605527b6aa8f142cfc192e to your computer and use it in GitHub Desktop.
Save erenesmer/5f3597fa64605527b6aa8f142cfc192e to your computer and use it in GitHub Desktop.
.emacs conf
;; Added by Package.el. This must come before configurations of
;; installed packages. Don't delete this line. If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
;(package-initialize)
(split-window-horizontally)
;(split-window-vertically)
(add-to-list 'auto-mode-alist '("components\\/.*\\.js\\'" . rjsx-mode))
(with-eval-after-load 'rjsx-mode
(define-key rjsx-mode-map "<" nil)
(define-key rjsx-mode-map (kbd "C-d") nil)
(define-key rjsx-mode-map ">" nil))
(setq-local indent-line-function 'js-jsx-indent-line)
(put 'downcase-region 'disabled nil)
(custom-set-variables
'(js-indent-level 2)
'(package-selected-packages
(quote
(react-snippets rjsx-mode base16-oceanicnext-dark multi-term xref-js2 js2-refactor auto-complete)))
'(tool-bar-mode nil))
(require 'package) ;; You might already have this line
(add-to-list 'package-archives
'("melpa" . "http://melpa.org/packages/") t)
(add-to-list 'package-archives
'("melpa-stable" . "https://stable.melpa.org/packages/") t)
(package-initialize)
(setenv "PATH" (concat (getenv "PATH") ":/usr/local/bin"))
(global-linum-mode 1)
(setq linum-format "%d ")
;;(setq linum-format "%4d \u2502 ")
(setq-default indent-tabs-mode nil)
(setq-default tab-width 2)
(setq indent-line-function 'insert-tab)
(setq c-default-style "linux")
(setq c-basic-offset 2)
(c-set-offset 'comment-intro 0)
(require 'auto-complete)
(global-auto-complete-mode t)
;(setq-default left-fringe-width 20)
;(setq-default right-gringe-width 0)
;(set-face-attribute 'fringe nil :background "black")
;;myColorScheme
(set-face-foreground 'mode-line "#000000")
(set-face-background 'mode-line "#d2be9c")
(set-face-foreground 'mode-line-inactive "#000000")
(set-face-background 'mode-line-inactive "#d2d2d2")
(set-face-attribute 'mode-line-buffer-id nil :foreground "#000000")
(set-face-attribute 'region nil :background "#e08ea4")
(set-face-attribute 'lazy-highlight nil :background "#e08ea4" :foreground "#000000")
(set-face-attribute 'font-lock-builtin-face nil :foreground "#DAB98F")
(set-face-attribute 'font-lock-comment-face nil :foreground "gray50")
(set-face-attribute 'font-lock-constant-face nil :foreground "olive drab")
(set-face-attribute 'font-lock-doc-face nil :foreground "gray50")
(set-face-attribute 'font-lock-function-name-face nil :foreground "burlywood3")
(set-face-attribute 'font-lock-keyword-face nil :foreground "DarkGoldenrod3")
(set-face-attribute 'font-lock-string-face nil :foreground "olive drab")
(set-face-attribute 'font-lock-type-face nil :foreground "burlywood3")
(set-face-attribute 'font-lock-variable-name-face nil :foreground "burlywood3")
;multi-term
(when (require 'multi-term nil t)
(global-set-key (kbd "<f5>") 'multi-term)
(global-set-key (kbd "<C-next>") 'multi-term-next)
(global-set-key (kbd "<C-prior>") 'multi-term-prev)
(setq multi-term-buffer-name "term"
multi-term-program "/bin/zsh"))
(setq-default tab-width 2)
(defun post-load-stuff ()
(interactive)
(menu-bar-mode -1)
(set-foreground-color "burlywood3")
(set-background-color "#161616")
(set-cursor-color "indianred")
)
(add-hook 'window-setup-hook 'post-load-stuff t)
; Accepted file extensions and their appropriate modes
(setq auto-mode-alist
(append
'(("\\.cpp$" . c++-mode)
("\\.hin$" . c++-mode)
("\\.cin$" . c++-mode)
("\\.inl$" . c++-mode)
("\\.rdc$" . c++-mode)
("\\.h$" . c++-mode)
("\\.c$" . c++-mode)
("\\.cc$" . c++-mode)
("\\.c8$" . c++-mode)
("\\.txt$" . indented-text-mode)
("\\.emacs$" . emacs-lisp-mode)
("\\.gen$" . gen-mode)
("\\.ms$" . fundamental-mode)
("\\.m$" . objc-mode)
("\\.mm$" . objc-mode)
) auto-mode-alist))
(defun thez-header-format ()
"Format the given file as a header file."
(interactive)
(setq BaseFileName (file-name-sans-extension (file-name-nondirectory buffer-file-name)))
(insert "#ifndef ")
(push-mark)
(insert BaseFileName)
(upcase-region (mark) (point))
(pop-mark)
(insert "_H\n")
(insert "#define ")
(push-mark)
(insert BaseFileName)
(upcase-region (mark) (point))
(pop-mark)
(insert "_H\n")
(insert "/* ========================================================================\n")
(insert " #File: $\n")
(insert " #Date: $\n")
(insert " #Revision: $\n")
(insert " #Creator: eesmer $\n")
(insert " #Notice: (C) Copyright 2019 by eesmer, Inc. All Rights Reserved. $\n")
(insert " ======================================================================== */\n")
(insert "\n")
(insert "#endif")
(insert "\n")
)
(defun thez-source-format ()
"Format the given file as a source file."
(interactive)
(setq BaseFileName (file-name-sans-extension (file-name-nondirectory buffer-file-name)))
(insert "/* ========================================================================\n")
(insert " #File: $\n")
(insert " #Date: $\n")
(insert " #Revision: $\n")
(insert " #Creator: eesmer $\n")
(insert " #Notice: (C) Copyright 2019 by eesmer, Inc. All Rights Reserved. $\n")
(insert " ======================================================================== */\n")
)
;;thez KeyMaps
(define-key global-map [f2] 'thez-header-format)
(define-key global-map [f3] 'thez-source-format)
(define-key global-map [f5] 'eval-buffer)
;;npm
(load-file ".emacs.d/npm.el")
(global-set-key (kbd "M-n i") 'npm-install)
(global-set-key (kbd "M-n n") 'npm-new)
(global-set-key (kbd "M-n d") 'npm-new-dependency)
(global-set-key (kbd "M-n e") 'npm-nodemon-exec)
(global-set-key (kbd "M-n p") 'npm-publish)
(global-set-key (kbd "M-n t") 'npm-test)
(global-set-key (kbd "M-n v") 'npm-version)
;; Disable Menu Tool Bar
(menu-bar-showhide-tool-bar-menu-customize-disable)
;; Frame Maximized
(toggle-frame-maximized)
;;Mode Line Color
(setq-default truncate-lines t)
(setq inhibit-splash-screen t)
(menu-bar-mode -1)
(scroll-bar-mode -1)
(tool-bar-mode -1)
(setq visible-bell 1)
(column-number-mode t)
;(set-face-attribute ‘default nil :font “Fira Code” :height 105 :weight ‘normal :width ‘normal)
(setq-default indent-tabs-mode nil)
(electric-pair-mode 1)
(ac-config-default)
(add-to-list 'default-frame-alist
'(font . "Menlo-12"))
(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