summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Lee <me@xiangyangli.com>2017-12-15 07:36:33 +0800
committerSteve Lee <me@xiangyangli.com>2017-12-15 07:36:33 +0800
commit8dd747b1db2b7f51a5077ceefcbbb76203c5bc05 (patch)
tree77b8c475f28b89f5dde89fc23f6068b288bc2bea
parentdbff7cfe3fae6418bd37d897c6b3703d3ccf87cf (diff)
downloaddotfiles-8dd747b1db2b7f51a5077ceefcbbb76203c5bc05.tar.xz
dotfiles-8dd747b1db2b7f51a5077ceefcbbb76203c5bc05.zip
update
-rw-r--r--.emacs.d/init.el3
-rw-r--r--.emacs.d/init.el~4
-rw-r--r--.emacs.d/lisp/init-evil.el1
-rw-r--r--.emacs.d/lisp/init-evil.el~6
-rw-r--r--.emacs.d/lisp/init-helm.el15
-rw-r--r--.emacs.d/lisp/init-helm.el~15
-rw-r--r--.emacs.d/lisp/init-program-basic.el35
-rw-r--r--.emacs.d/lisp/init-program-basic.el~43
8 files changed, 114 insertions, 8 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el
index 7b5b36e..8f985d7 100644
--- a/.emacs.d/init.el
+++ b/.emacs.d/init.el
@@ -42,7 +42,7 @@
'(inhibit-startup-screen t)
'(package-selected-packages
(quote
- (expand-region window-numbering flycheck company oceanic-theme forest-blue-theme org ## evil))))
+ (helm expand-region window-numbering flycheck company oceanic-theme forest-blue-theme org ## evil))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
@@ -65,6 +65,7 @@
(require 'init-company)
(require 'init-flycheck)
(require 'init-expand-region)
+ (require 'init-helm)
(require 'init-window-numbering))
(provide 'init)
diff --git a/.emacs.d/init.el~ b/.emacs.d/init.el~
index e70f1c0..9085cb4 100644
--- a/.emacs.d/init.el~
+++ b/.emacs.d/init.el~
@@ -42,7 +42,7 @@
'(inhibit-startup-screen t)
'(package-selected-packages
(quote
- (expand-region window-numbering flycheck company oceanic-theme forest-blue-theme org ## evil))))
+ (helm expand-region window-numbering flycheck company oceanic-theme forest-blue-theme org ## evil))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
@@ -56,7 +56,7 @@
;; Theme
(load-theme 'oceanic t)
;; Make highlight color differ from the highlight line
-(set-face-attribute 'region nil :background "cyan")
+(set-face-attribute 'region nil :background "#213")
(let ((file-name-handler-alist nil))
(require 'init-evil)
diff --git a/.emacs.d/lisp/init-evil.el b/.emacs.d/lisp/init-evil.el
index b59adc1..956f8c9 100644
--- a/.emacs.d/lisp/init-evil.el
+++ b/.emacs.d/lisp/init-evil.el
@@ -21,6 +21,7 @@
"q" 'quit-window
"e" 'er/expand-region
"f" 'google-search
+ "t" 'test-function
;; switch window
"0" 'select-window-0
diff --git a/.emacs.d/lisp/init-evil.el~ b/.emacs.d/lisp/init-evil.el~
index abb5995..30878ee 100644
--- a/.emacs.d/lisp/init-evil.el~
+++ b/.emacs.d/lisp/init-evil.el~
@@ -20,7 +20,9 @@
"b" 'switch-to-buffer
"q" 'quit-window
"e" 'er/expand-region
- "f" 'google-search
+ "f" 'helm-find-files
+ "ff" 'google-search
+ "t" 'test-function
;; switch window
"0" 'select-window-0
@@ -38,7 +40,7 @@
(interactive)
(let (url)
(setq url (read-string "Enter search content:"))
- (browse-url-firefox url)))
+ (browse-url-firefox (concat "https://www.google.com/search?q=" url))))
(provide 'init-evil)
;;; init-evil ends here
diff --git a/.emacs.d/lisp/init-helm.el b/.emacs.d/lisp/init-helm.el
new file mode 100644
index 0000000..52708c1
--- /dev/null
+++ b/.emacs.d/lisp/init-helm.el
@@ -0,0 +1,15 @@
+;;; helm --- Configuration
+
+;;; Commentary:
+
+;;; Code:
+
+(require 'helm-config)
+
+(global-set-key (kbd "M-x") 'helm-M-x)
+(global-set-key (kbd "C-x p") 'helm-find-files)
+
+(helm-mode 1)
+
+(provide 'init-helm)
+;;; init-helm ends here
diff --git a/.emacs.d/lisp/init-helm.el~ b/.emacs.d/lisp/init-helm.el~
new file mode 100644
index 0000000..0353c64
--- /dev/null
+++ b/.emacs.d/lisp/init-helm.el~
@@ -0,0 +1,15 @@
+;;; helm --- Configuration
+
+;;; Commentary:
+
+;;; Code:
+
+(require 'helm-config)
+
+(global-set-key (kbd "M-x") 'helm-M-x)
+(global-set-key (kbd "C-x C-p") 'helm-find-files)
+
+(helm-mode 1)
+
+(provide 'init-helm)
+;;; init-helm ends here
diff --git a/.emacs.d/lisp/init-program-basic.el b/.emacs.d/lisp/init-program-basic.el
index 092bd3c..04266aa 100644
--- a/.emacs.d/lisp/init-program-basic.el
+++ b/.emacs.d/lisp/init-program-basic.el
@@ -10,11 +10,44 @@
indent-tabs-mode t)
(defun execute-c-program ()
+ "Complie current c file and run it."
(interactive)
+ (save-buffer)
(defvar foo)
(setq foo (concat
- "gcc " (buffer-name) " -o " (buffer-name) ".out && ./" (buffer-name) ".out" ))
+ "gcc " (include-source-file (buffer-name)) " -o " (buffer-name) ".out && ./" (buffer-name) ".out" ))
(shell-command foo))
+(defun include-source-file (file-path)
+ "Get transfer all include header file from FILE-PATH to source file(string)."
+ (let (content)
+ (setq content (format "%s" (get-c-source-file (get-string-from-file file-path))))
+ (if (string= nil content)
+ file-path
+ (substring content 1 -1))))
+
+(defun get-c-source-file (content)
+ "Get the header list of a string CONTENT, for instant a .c file."
+ (defun header-to-source (header)
+ "Whole line of header"
+ (replace-regexp-in-string "[.]h" ".c " (substring header 10 -1)))
+ (let (value)
+ (dolist (element (split-string content "\n" t) value)
+ (if (string-prefix-p "#include \"" element)
+ (setq value (cons (header-to-source element) value))))))
+
+
+(defun read-lines (file-path)
+ "Return a list of lines of a file at FILE-PATH."
+ (with-temp-buffer
+ (insert-file-contents file-path)
+ (split-string (buffer-string) "\n" t)))
+
+(defun get-string-from-file (file-path)
+ "Return FILE-PATH's file content in list."
+ (with-temp-buffer
+ (insert-file-contents file-path)
+ (buffer-string)))
+
(provide 'init-program-basic)
;;; init-program-basic ends here
diff --git a/.emacs.d/lisp/init-program-basic.el~ b/.emacs.d/lisp/init-program-basic.el~
index 2e68074..1e852ad 100644
--- a/.emacs.d/lisp/init-program-basic.el~
+++ b/.emacs.d/lisp/init-program-basic.el~
@@ -1,13 +1,52 @@
-;; C programming
+;;; program-basic --- Some basic configuration
+
+;;; Commentary:
+;; None
+
+;;; Code:
+
(setq-default c-basic-offset 4
tab-width 4
indent-tabs-mode t)
(defun execute-c-program ()
+ "Complie current c file and run it."
(interactive)
(defvar foo)
(setq foo (concat
- "gcc " (buffer-name) " -o " (buffer-name) ".out && ./" (buffer-name) ".out" ))
+ "gcc " (include-source-file (buffer-name)) " -o " (buffer-name) ".out && ./" (buffer-name) ".out" ))
(shell-command foo))
+(defun include-source-file (file-path)
+ "Get transfer all include header file from FILE-PATH to source file(string)."
+ (let (content)
+ (setq content (format "%s" (get-c-source-file (get-string-from-file file-path))))
+ (if (string= nil content)
+ file-path
+ (substring content 1 -1))))
+
+(defun get-c-source-file (content)
+ "Get the header list of a string CONTENT, for instant a .c file."
+ (defun header-to-source (header)
+ "Whole line of header"
+ (replace-regexp-in-string "[.]h" ".c " (substring header 10 -1)))
+ (let (value)
+ (dolist (element (split-string content "\n" t) value)
+ (if (string-prefix-p "#include \"" element)
+ (setq value (cons (header-to-source element) value))))))
+
+
+(defun read-lines (file-path)
+ "Return a list of lines of a file at FILE-PATH."
+ (with-temp-buffer
+ (insert-file-contents file-path)
+ (split-string (buffer-string) "\n" t)))
+
+(defun get-string-from-file (file-path)
+ "Return FILE-PATH's file content in list."
+ (with-temp-buffer
+ (insert-file-contents file-path)
+ (buffer-string)))
+
(provide 'init-program-basic)
+;;; init-program-basic ends here