Skip to content

Instantly share code, notes, and snippets.

@fselcukcan
Created July 2, 2019 09:44
Show Gist options
  • Select an option

  • Save fselcukcan/dd73a6a892ea60277f5879db46a4ef3d to your computer and use it in GitHub Desktop.

Select an option

Save fselcukcan/dd73a6a892ea60277f5879db46a4ef3d to your computer and use it in GitHub Desktop.

Revisions

  1. fselcukcan created this gist Jul 2, 2019.
    114 changes: 114 additions & 0 deletions .emacs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,114 @@
    (when (>= emacs-major-version 24)
    (require 'package)
    (add-to-list
    'package-archives
    ;; '("melpa-stable" . "http://stable.melpa.org/packages/") ; many packages won't show if using stable
    '("melpa" . "http://melpa.milkbox.net/packages/")
    t)
    )

    (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 (misterioso)))
    '(package-selected-packages (quote (flycheck web-mode chess))))
    (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.
    )

    ;; make typing delete/overwrites selected text
    (delete-selection-mode 1)

    ;; turn on highlighting current line
    (global-hl-line-mode 1)

    ;; auto close bracket insertion. New in emacs 24
    (electric-pair-mode 1)
    ;; make electric-pair-mode work on more brackets
    (setq electric-pair-pairs
    '(
    (?\" . ?\")
    (?\{ . ?\})))

    ;; turn on bracket match highlight
    (show-paren-mode 1)

    ;; remember cursor position, for emacs 25.1 or later
    (save-place-mode 1)

    (when (version<= "26.0.50" emacs-version )
    (global-display-line-numbers-mode))

    ;; when a file is updated outside emacs, make it update if it's already opened in emacs
    (global-auto-revert-mode 1)

    ; session
    ;; keep a list of recently opened files
    (require 'recentf)
    (recentf-mode 1)
    ;; to list and open recently opened file
    (recentf-open-files)

    ;; save/restore opened files
    (desktop-save-mode 1)
    ; END session

    ; minibuffer
    ;; save minibuffer history
    (savehist-mode 1)

    ;; big minibuffer height, for ido to show choices vertically
    ;; (setq max-mini-window-height 0.5)
    ; END minibuffer

    ; theme
    ;; (set-background-color "#1c2022")
    (load-theme 'misterioso)
    (if (display-graphic-p)
    (setq initial-frame-alist
    '(
    (tool-bar-lines . 0)
    (width . 106)
    (height . 45)
    (background-color . "#1c2022")
    (left . 0)
    (top . 0)))
    (setq initial-frame-alist '( (tool-bar-lines . 0))))

    (setq default-frame-alist initial-frame-alist)
    ; END theme

    ; web-mode
    (add-to-list 'auto-mode-alist '("\\.js\\'" . web-mode))
    (add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode))
    ;; (add-to-list 'auto-mode-alist '("\\.js[x]?\\'" . web-mode))

    ;; JSX syntax highlighting
    (setq web-mode-content-types-alist '(("jsx" . "\\.js[x]?\\'")))

    (setq web-mode-enable-auto-pairing t)

    ;; Indentation and other settings
    (defun web-mode-init-hook ()
    "Hooks for Web mode. Adjust indent."
    (setq web-mode-markup-indent-offset 2))

    ;; (add-hook 'web-mode-hook
    ;; (lambda ()
    ;; ;; short circuit js mode and just do everything in jsx-mode
    ;; (if (equal web-mode-content-type "javascript")
    ;; (web-mode-set-content-type "jsx")
    ;; (message "now set to: %s" web-mode-content-type))))
    ; END web-mode

    ; flycheck
    ;;; Enable flycheck globally
    (add-hook 'after-init-hook #'global-flycheck-mode)
    ; END flycheck