   ;; Set the highlight background of current line to black, this make selected region become more
   ;; distinct.
   (set-face-background 'hl-line "#000000")
+
+  ;; Below settings maybe failed in some platform, in order to avoid affecting the executing of
+  ;; other settings, so place them at the bottom of "dotspacemacs/user-config".
+
+  ;; Copy to or paste from system clipboard when spacemacs is running in terminal.
+  (xclip-mode 1)
   )
 
-
-;; User defined functions.
+;; User defined macros and functions.
+
+;; Split window below or right according to the value of parameter "direction" and focus on it, then
+;; switch to scratch buffer.
+(defmacro split-and-focus-scratch (direction)
+  `(lambda ()
+     (interactive)
+     (,(intern (concat "split-window-" (symbol-name direction) "-and-focus")))
+     (spacemacs/switch-to-scratch-buffer)))
+
+;; Enter "evil-emacs-state" firstly, and then move cursor to next or previous line according to the
+;; value of parameter "direction".
+(defmacro enter-emacs-state-and-move-line (direction)
+  `(lambda ()
+     (interactive)
+     (evil-emacs-state)
+     (,(intern (concat (symbol-name direction) "-line")))))
+
+(defun enter-emacs-state-and-set-mark (arg)
+  "Enter \"evil-emacs-state\" firstly, and then set mark at the current position of cursor."
+  (interactive "P")
+  (evil-emacs-state)
+  (set-mark-command arg))
 
 ;; Save user's current buffer if there are any changes.
 (defun save-user-current-buffer ()

  (interactive)
  (if (not (string-match-p "^\*" (buffer-name)))
      (save-buffer)))

(defun split-below-and-focus-scratch ()
  "Split window below and focus on it, then switch to scratch buffer."
  (interactive)
  (split-window-below-and-focus)
  (spacemacs/switch-to-scratch-buffer))

(defun split-right-and-focus-scratch ()
  "Split window right and focus on it, then switch to scratch buffer."
  (interactive)
  (split-window-right-and-focus)
  (spacemacs/switch-to-scratch-buffer))

;; Do not write anything past this comment. This is where Emacs will
;; auto-generate custom variable definitions.

  (put 'dired-find-alternate-file 'disabled nil)
  (with-eval-after-load 'dired
    (define-key dired-mode-map (kbd "RET") 'dired-find-alternate-file))
  ;; The default value is (5 ((shift) . 1) ((control) . nil)), it means emacs will scroll 5 lines
  ;; when mouse wheel spin one step without any modifier key depressed, if the "shift" key depressed
  ;; when mouse wheel spinning, then emacs only will scroll 1 line, if the "control" key depressed
  ;; then emacs will scroll one screen. Scrolling 1 line per mouse wheel spin step is more smooth.
  (setq mouse-wheel-scroll-amount '(1))
  ;; Set right margin to 100, and turn it on for all text and programming modes.
  (setq-default fill-column 100)
  (spacemacs/add-to-hooks 'turn-on-fci-mode '(text-mode-hook prog-mode-hook))
  ;; Save the current user buffer automatically when exit the evil emacs state.
  (add-hook 'evil-emacs-state-exit-hook 'save-user-current-buffer)
  ;; Enable company mode globally and enable both vim and emacs style key bindings of company mode.
  ;; Only key bindings of the style which represented by dotspacemacs-editing-style will be set by
  ;; default, even though auto-completion layer add "spacemacs//company-active-navigation" to the
