Klimi's new dotfiles with stow.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

9.6 KiB

Font Inconsolata

(set-default-font "Inconsolata-12")

Define Default packages

(defvar abedra/packages '(ac-slime
                          auto-complete
                          autopair
                          cider
                          clojure-mode
                          elpy
                          f
                          feature-mode
                          flycheck
                          graphviz-dot-mode
                          htmlize
                          magit
                          markdown-mode
                          org
                          paredit
                          powerline
                          rvm
                          smex
                          solarized-theme
                          web-mode
                          writegood-mode
                          yaml-mode)
  "Default packages")

Install Default packages

(defun abedra/packages-installed-p ()
  (cl-loop for pkg in abedra/packages
        when (not (package-installed-p pkg)) do (cl-return nil)
        finally (cl-return t)))

(unless (abedra/packages-installed-p)
  (message "%s" "Refreshing package database...")
  (package-refresh-contents)
  (dolist (pkg abedra/packages)
    (when (not (package-installed-p pkg))
      (package-install pkg))))

Backup files

(setq make-backup-files nil)

Yes and No

(defalias 'yes-or-no-p 'y-or-n-p)

Misc

(setq echo-keystrokes 0.1
      use-dialog-box nil
      visible-bell t)
(show-paren-mode t)

repos

(add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t)

Reveal.js

  (use-package org-reveal
  :ensure t
  :config
    
    (setq org-reveal-root "http://cdn.jsdelivr.net/reveal.js/3.0.0/")
    (setq org-reveal-mathjax t)
)
    (use-package htmlize
    :ensure t)

Better Shell

  (use-package better-shell
      :ensure t
      :bind (("C-\"" . better-shell-shell)
             ("C-:" . better-shell-remote-open)))

c++

(use-package ggtags
:ensure t
:config 
(add-hook 'c-mode-common-hook
          (lambda ()
            (when (derived-mode-p 'c-mode 'c++-mode 'java-mode)
              (ggtags-mode 1))))
)

Orgmode

(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cc" 'org-capture)
;;(add-hook 'after-init-hook 'org-agenda-list)
;;(delete-other-windows)
(add-to-list 'org-modules "org-habit")
(require 'org)
(require 'org-install)
(require 'org-habit)
(add-to-list 'org-modules "org-habit")
(setq org-habit-preceding-days 7
      org-habit-following-days 1
      org-habit-graph-column 50
      org-habit-show-habits-only-for-today t
      org-habit-show-all-today t
)

;; ORG REVEAL
;(use-package org-reveal
;:ensure t
;(setq org-reveal-root "https://cdn.jsdelivr.net/npm/reveal.js")
;; DOCUMENTS MINTED
;(require 'ox-latex)
;(add-to-list 'org-latex-packages-alist '("" "minted"))
;(setq org-latex-listings 'minted)
;(require 'org-latex)
;(setq org-export-latex-listings 'minted)
;(add-to-list 'org-export-latex-packages-alist '("" "minted"))            
;; Minted
;  (require 'ox-latex)
;  (setq org-latex-listings 'minted)
;(setq org-latex-pdf-process
;        '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
;          "bibtex $(basename %b)"
;          "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
;          "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))
;; Babel src evaluator
;(setq debug-on-error t)
;(org-babel-do-load-languages
;'org-babel-load-languages
;'((python . t)))

;; Custom colors for the keywords
(setq org-todo-keywords
      '((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d)")
	(sequence "WAITING(w@/!)" "INACTIVE(i)" "|" "CANCELLED(c@/!)" "MEETING")
	(sequence "LEARN(l)" "REVISE(r)" "|" "PASSED(p!)")))
(setq org-todo-keyword-faces
      '(("TODO" :foreground "red" :background "gold" :weight bold)
	("NEXT" :foreground "DodgerBlue" :background "LightCyan" :weight bold)
	("DONE" :foreground "forest green" :background "MediumSpringGreen" :weight bold)
	("WAITING" :foreground "orange" :background "LightGoldenrodYellow" :weight bold)
	("INACTIVE" :foreground "magenta" :background "violet" :weight bold)
	("CANCELLED" :foreground "forest green" :background "LimeGreen" :weight bold)
	("MEETING" :foreground "forest green" :background "PaleGreen" :weight bold)
	("LEARN" :foreground "yellow1" :background "red2" :weight bold)
	("REVISE" :foreground "RosyBrown1" :background "OrangeRed2" :weight bold)
	("PASSED" :foreground "green yellow" :background "forest green" :weight bold)
))
;; Auto-update tags whenever the state is changed
(setq org-todo-state-tags-triggers
      '(("CANCELLED" ("CANCELLED" . t))
	("WAITING" ("WAITING" . t))
	("INACTIVE" ("WAITING") ("INACTIVE" . t))
	(done ("WAITING") ("INACTIVE"))
	("TODO" ("WAITING") ("CANCELLED") ("INACTIVE"))
	("NEXT" ("WAITING") ("CANCELLED") ("INACTIVE"))
	("DONE" ("WAITING") ("CANCELLED") ("INACTIVE"))))






(setq org-agenda-files (list "~/Documents/org/todo.org"
			     "~/Documents/org/i.org"
			     "~/Documents/org/habits.org"
			     "~/Documents/org/links.org"
			     "~/Documents/org/school.org"
			     "~/Documents/org/ideas.org"))

(setq org-agenda-start-on-weekday 1)

(setq org-agenda-custom-commands
      '(("h" "Daily habits" 
         ((agenda ""))
         ((org-agenda-show-log t)
          (org-agenda-ndays 7)
          (org-agenda-log-mode-items '(state))
          (org-agenda-skip-function '(org-agenda-skip-entry-if 'notregexp ":DAILY:"))))
        ;; other commands here
        ))

(setq org-capture-templates
'(("a" "Appointment" entry (file  "~/Documents/org/i.org" )
"* %^{Appointment:}%?\n\n%^T\n\n:PROPERTIES:\n\n:END:\n\n")
("l" "Link" entry (file+headline "~/Documents/org/links.org" "Links")
"* %? %^L %^g \n%T" :prepend t)
("b" "Blog idea" entry (file+headline "~/Documents/org/i.org" "Blog Topics:")
"* %?\n%T" :prepend t)

("t" "To Do Item" entry (file+headline "~/Documents/org/todo.org" "To Do")
"* TODO %^{TODO:}\nSCHEDULED: %^t\nPROPERTIES:\n:CREATED: %u\n:END:\n\n" )
("m" "Meeting" entry (file "~/Documents/org/i.org")
"* MEETING with %? :MEETING:\n%t" :clock-in t :clock-resume t)
("i" "Idea" entry (file+headline "~/Documents/org/ideas.org" "IDEA")
"* INACTIVE %? :IDEA:\n")

("n" "Note" entry (file+headline "~/Documents/org/i.org" "Note space")
"* %?\n%u" :prepend t)
("j" "Journal" entry (file+datetree "~/Documents/org/journal.org")
"* %?\nEntered on %U\n  %i\n  %a")
("s" "Screencast" entry (file "~/Documents/org/screencastnotes.org")
"* %?\n%i\n")


;; School templates
("T" "Test" entry (file+headline "~/Documents/org/school.org" "Testy")
	 "* LEARN [#A] %^{Test:}%?\n\tDEADLINE: %^t\n:PROPERTIES:\n:CREATED: %U\n:END:\n\n" :empty-lines 1)
)) ;; end

 (setq org-log-done 'time)

Themes and modeline

  (use-package moe-theme
    :ensure t)  
  (load-theme 'moe-dark t)

Htmlize

  (use-package htmlize
    :ensure t)

yasnippet

;(global-set-key "\C-i" 'yas-expand)
(setq yas-trigger-key "TAB")
(setq yas-triggers-in-field t)

;;; use popup menu for yas-choose-value


;; trigger using TAB and disable auto-start
;(custom-set-variables
; '(ac-trigger-key "TAB")
; '(ac-auto-start nil)
; '(ac-use-menu-map t))
;(define-key ac-menu-map (kbd "<tab>") nil)
;(define-key ac-menu-map (kbd "<S-tab>") nil)




(use-package validate
:ensure t)

(defmacro validate-setq (&rest svs)
  "Like `setq', but throw an error if validation fails.
VALUE is validated against SYMBOL's custom type.
\(fn [SYM VAL] ...)"
  (let ((out))
    (while svs
      (let ((symbol (pop svs))
            (value (if (not svs)
                       (error "`validate-setq' takes an even number of arguments")
                     (pop svs))))
        (push `(if (boundp ',symbol)
                   (setq ,symbol (validate-value ,value (custom-variable-type ',symbol)))
                 (user-error "Trying to validate a variable that's not defined yet: `%s'.\nYou need to require the package before validating"
                             ',symbol))
              out)))
    `(progn ,@(reverse out))))

(use-package yasnippet
:ensure t
:diminish yas-minor-mode
:init (yas-global-mode t))
;; Autocomplete



;; Code-comprehension server

  (defun check-expansion ()
    (save-excursion
      (if (looking-at "\\_>") t
        (backward-char 1)
        (if (looking-at "\\.") t
          (backward-char 1)
          (if (looking-at "->") t nil)))))

  (defun do-yas-expand ()
    (let ((yas/fallback-behavior 'return-nil))
      (yas/expand)))

  (defun tab-indent-or-complete ()
    (interactive)
    (if (minibufferp)
        (minibuffer-complete)
      (if (or (not yas/minor-mode)
              (null (do-yas-expand)))
          (if (check-expansion)
              (company-complete-common)
            (indent-for-tab-command)))))

  (global-set-key [tab] 'tab-indent-or-complete)
(use-package yasnippet-snippets
:ensure t)

Multiple cursors

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; multiple cursors                                                       ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(use-package multiple-cursors
:ensure t)
(global-set-key (kbd "C-c m c") 'mc/edit-lines)