Skip to content

Commit

Permalink
basically working
Browse files Browse the repository at this point in the history
  • Loading branch information
潘俊杰 committed Nov 29, 2018
1 parent 5ec0697 commit 5103d74
Show file tree
Hide file tree
Showing 70 changed files with 2,417 additions and 2,808 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,5 @@ site-lisp/package/
/plantuml.jar
/magithub
/.cache
/.youdao
/*.keyfreq
161 changes: 77 additions & 84 deletions init.el
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
;; -*- lexical-binding: t -*-
(setq debug-on-error t)
;; (setq debug-on-error t)

;;; This file bootstraps the configuration, which is divided into
;;; a number of other files.
Expand All @@ -22,9 +22,9 @@
;;----------------------------------------------------------------------------
;; Bootstrap config
;;----------------------------------------------------------------------------
(require 'init-utils)
;; Calls (package-initialize)
(require 'init-elpa) ;; Machinery for installing required packages
(require 'init-utils)
(require 'init-exec-path) ;; Set up $PATH

;;----------------------------------------------------------------------------
Expand All @@ -36,105 +36,98 @@
(require 'init-gui-frames)

(require 'init-osx-keys)
;; ;; TODO here
;; TODO test minimal init-evil
(require 'init-which-key)
(require 'init-evil)

;; (require 'init-editing-utils)
;; (require 'init-whitespace)

;; (require 'init-dired)
;; (require 'init-isearch)
;; (require 'init-grep)
;; (require 'init-uniquify)
;; (require 'init-ibuffer)
;; (require 'init-flycheck)
(require 'init-editing-utils)

;; (require 'init-recentf)
;; (require 'init-smex)
;; (require 'init-ivy)
;; (require 'init-hippie-expand)
;; (require 'init-company)
;; (require 'init-windows)
;; (require 'init-sessions)
;; (require 'init-fonts)
;; (require 'init-mmm)
(require 'init-uniquify)
(require 'init-dired)
(require 'init-file)
(require 'init-buffer)
(require 'init-minibuffer)
(require 'init-flycheck)

;; (require 'init-vc)
;; (require 'init-git)
;; (require 'init-github)
(require 'init-ivy)
(require 'init-company)
(require 'init-yas)
(require 'init-windows)
(require 'init-mode-line)
(require 'init-sessions)
(require 'init-fonts)

;; (require 'init-projectile)
(require 'init-vc)
(require 'init-git)

;; ;; TODO add here maybe??? JJ
;; (require 'init-eyebrowse)
(require 'init-eyebrowse)
(require 'init-avy)

;; (require 'init-compile)
;; (require 'init-org)
;; (require 'init-markdown)
;; (require 'init-csv)
;; (require 'init-web)
;; (require 'init-javascript)
;; (require 'init-nxml)
;; (require 'init-html)
;; (require 'init-css)
;; (require 'init-http)
(require 'init-markdown)
(require 'init-csv)
(require 'init-web)
(require 'init-javascript)
(require 'init-json)
(require 'init-coffeescript)
(require 'init-css)
(require 'init-http)
;; (require 'init-python)
;; ;; (require 'init-haskell)
;; (require 'init-ruby)
;; (require 'init-rails)
;; (require 'init-sql)
;; (require 'init-yaml)
(require 'init-yaml)
;; (require 'init-docker)
;; ;; (maybe-require-package 'nginx-mode)
(require 'init-lua)
(require 'init-dotenv)

(require 'init-paredit)
(require 'init-lisp)
;; (require 'init-scheme)
;; (require 'init-slime)
;; (require 'init-clojure)
;; (require 'init-clojure-cider)
;; (require 'init-common-lisp)

;; TODO pyim
(require 'init-youdao)
(require 'init-keyfreq)
(require 'init-edit-server)
(require 'init-misc)

;; (require 'init-paredit)
;; (require 'init-lisp)
;; ;; (require 'init-slime)
;; ;; (require 'init-clojure)
;; ;; (require 'init-clojure-cider)
;; ;; (require 'init-common-lisp)

;; (require 'init-misc)

;; ;; Extra packages which don't require any configuration

;; ;; TODO defer using auto mode
;; (require-package 'lua-mode)
;; ;; location for calander etc.
;; (when *is-a-mac*
;; (require-package 'osx-location))
;; ;; services at system startup
;; (unless (eq system-type 'windows-nt)
;; (maybe-require-package 'daemons))
;; (maybe-require-package 'dotenv-mode)

;; (when (maybe-require-package 'uptimes)
;; (setq-default uptimes-keep-count 200)
;; (add-hook 'after-init-hook (lambda () (require 'uptimes))))


;; ;;----------------------------------------------------------------------------
;; ;; Allow access from emacsclient
;; ;;----------------------------------------------------------------------------
;; (require 'server)
;; (unless (server-running-p)
;; (server-start))

;; ;;----------------------------------------------------------------------------
;; ;; Variables configured via the interactive 'customize' interface
;; ;;----------------------------------------------------------------------------
;; (setq custom-file "./custom.el")
;; (unless (file-exists-p custom-file)
;; (write-region "" nil custom-file))
;; (when (file-exists-p custom-file)
;; (load custom-file))


;; ;;----------------------------------------------------------------------------
;; ;; Locales (setting them earlier in this file doesn't work in X)
;; ;;----------------------------------------------------------------------------
;; (require 'init-locales)
;; Extra packages which don't require any configuration

;; location for calander etc.
(when *is-a-mac*
(require-package 'osx-location))
;; services at system startup
(unless (eq system-type 'windows-nt)
(maybe-require-package 'daemons))


;;----------------------------------------------------------------------------
;; Allow access from emacsclient
;;----------------------------------------------------------------------------
(require 'server)
(unless (server-running-p)
(server-start))

;;----------------------------------------------------------------------------
;; Variables configured via the interactive 'customize' interface
;;----------------------------------------------------------------------------
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
(unless (file-exists-p custom-file)
(write-region "" nil custom-file))
(when (file-exists-p custom-file)
(load custom-file))


;;----------------------------------------------------------------------------
;; Locales (setting them earlier in this file doesn't work in X)
;;----------------------------------------------------------------------------
(require 'init-locales)


(provide 'init)
Expand Down
13 changes: 13 additions & 0 deletions modes/init-avy.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
(use-package avy)

(use-package link-hint
:after avy
:commands link-hint-open-link
:init
(jester/with-leader
"l o" 'link-hint-open-link)
(general-define-key
:states '(motion)
"o" 'link-hint-open-link))

(provide 'init-avy)
78 changes: 78 additions & 0 deletions modes/init-buffer.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
(setq initial-scratch-message "")

(jester/with-leader
"b b" 'switch-to-buffer
"b i" 'ibuffer
"b k" 'jester/kill-this-buffer
"b r" 'rename-buffer
"b h" (lambda! (switch-to-buffer (help-buffer)))
"b m" (lambda! (switch-to-buffer (messages-buffer)))
"b s" 'jester/switch-to-scratch-buffer
"<return>" 'jester/alternate-buffer)

(general-define-key
:keymaps 'ibuffer-mode-map
"j" 'ibuffer-forward-line
"k" 'ibuffer-backward-line)

;;----------------------------------------------------------------------------
;; switch *scratch* buffer
;;----------------------------------------------------------------------------
(defun jester/switch-to-scratch-buffer (&optional arg)
"Switch to the `*scratch*' buffer, creating it first if needed.
if prefix argument ARG is given, switch to it in an other, possibly new window."
(interactive "P")
(let ((exists (get-buffer "*scratch*")))
(if arg
(switch-to-buffer-other-window (get-buffer-create "*scratch*"))
(switch-to-buffer (get-buffer-create "*scratch*")))
(when (and (not exists)
(not (eq major-mode dotspacemacs-scratch-mode))
(fboundp dotspacemacs-scratch-mode))
(funcall dotspacemacs-scratch-mode))))

;;----------------------------------------------------------------------------
;; switch to last buffer
;;----------------------------------------------------------------------------
(defun jester/alternate-buffer (&optional window)
"Switch back and forth between current and last buffer in the
current window."
(interactive)
(let ((current-buffer (window-buffer window)))
;; if no window is found in the windows history, `switch-to-buffer' will
;; default to calling `other-buffer'.
(switch-to-buffer
(cl-find-if (lambda (buffer)
(not (eq buffer current-buffer)))
(mapcar #'car (window-prev-buffers window))))))

;;----------------------------------------------------------------------------
;; setup ibuffer.
;;----------------------------------------------------------------------------
(defun ibuffer-set-up-preferred-filters ()
(unless (eq ibuffer-sorting-mode 'filename/process)
(ibuffer-do-sort-by-filename/process)))

(add-hook 'ibuffer-hook 'ibuffer-set-up-preferred-filters)

(after-load 'ibuffer
;; Use human readable Size column instead of original one
(define-ibuffer-column size-h
(:name "Size" :inline t)
(cond
((> (buffer-size) 1000000) (format "%7.1fM" (/ (buffer-size) 1000000.0)))
((> (buffer-size) 1000) (format "%7.1fk" (/ (buffer-size) 1000.0)))
(t (format "%8d" (buffer-size))))))

;;----------------------------------------------------------------------------
;; kill this buffer.
;;----------------------------------------------------------------------------
(defun jester/kill-this-buffer (&optional arg)
"Kill the current buffer.
If the universal prefix argument is used then kill also the window."
(interactive)
(if (window-minibuffer-p)
(abort-recursive-edit)
(kill-buffer)))

(provide 'init-buffer)
12 changes: 12 additions & 0 deletions modes/init-coffeescript.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
(use-package coffee-mode
:mode "\\.coffee\\'"
:config
;; the syntax table is totally sh*t
(modify-syntax-entry ?* "." coffee-mode-syntax-table)
(modify-syntax-entry ?+ "." coffee-mode-syntax-table)
(modify-syntax-entry ?- "." coffee-mode-syntax-table)
(modify-syntax-entry ?_ "w" coffee-mode-syntax-table)
(jester/with-major-leader 'coffee-mode
"d" 'coffee-mark-defun))

(provide 'init-coffeescript)
Loading

0 comments on commit 5103d74

Please sign in to comment.