(ivy-done)
(ivy-shrink-after-dispatching))
+ (defun sd/exit-ivy-and-swith-to-buffer ()
+ "exit ivy complete, and call swith to buffer"
+ (interactive)
+ (ivy--exhibit)
+ (ivy-set-action (lambda (buf)
+ (ivy-switch-buffer)))
+ (when (ivy-read-action)
+ (ivy-done))
+ (ivy-shrink-after-dispatching))
+
(with-eval-after-load "ivy"
(define-key ivy-minibuffer-map (kbd "C-o") 'ivy-dispatching-done)
- (define-key ivy-minibuffer-map (kbd "C-k") #'sd/swith-buffer-other-window))
+ (define-key ivy-minibuffer-map (kbd "C-k") #'sd/swith-buffer-other-window)
+ ;; (define-key ivy-minibuffer-map (kbd "M-o") nil)
+ (define-key ivy-minibuffer-map (kbd "C-o") #'sd/exit-ivy-and-swith-to-buffer))
#+END_SRC
stolen from [[https://github.com/mariolong/emacs.d/blob/f6a061594ef1b5d1f4750e9dad9dc97d6e122840/emacs-init.org][here]]
;; Install Ubuntu Mono fonts and apply it in org-table to align Chinese fonts
- ;; (with-eval-after-load "org"
- ;; (mapc (lambda (face)
- ;; (set-face-attribute face nil :inherit 'fixed-pitch))
- ;; (list
- ;; 'org-code
- ;; 'org-block
- ;; 'org-block-background
- ;; 'org-block-begin-line
- ;; 'org-block-end-line))
- ;; (set-face-attribute 'org-table nil :family "Ubuntu Mono" :height 140)
- ;; (set-face-attribute 'org-formula nil :family "Ubuntu Mono" :height 140)
- ;; ;; org-special-keyword inherited from font-lock-keywork originally; as org is changed to variable-pitch, it cause
- ;; ;; the font in special-keywords are not monospace
- ;; (set-face-attribute 'org-special-keyword nil :inherit '(font-lock-keyword-face fixed-pitch))
- ;; ;; same as above
- ;; (set-face-attribute 'org-verbatim nil :inherit '(shadow fixed-pitch))
- ;; (set-face-attribute 'org-block-begin-line nil :inherit 'shadow :slant 'italic :foreground nil)
- ;; (set-face-attribute 'org-block-end-line nil :inherit 'shadow :slant 'italic :foreground nil)
+ (with-eval-after-load "org"
+ (mapc (lambda (face)
+ (set-face-attribute face nil :inherit 'fixed-pitch))
+ (list
+ 'org-code
+ 'org-block
+ 'org-block-background
+ 'org-block-begin-line
+ 'org-block-end-line))
+ (set-face-attribute 'org-table nil :family "Ubuntu Mono" :height 100)
+ (set-face-attribute 'org-formula nil :family "Ubuntu Mono" :height 100)
+ ;; org-special-keyword inherited from font-lock-keywork originally; as org is changed to variable-pitch, it cause
+ ;; the font in special-keywords are not monospace
+ (set-face-attribute 'org-special-keyword nil :inherit '(font-lock-keyword-face fixed-pitch))
+ ;; same as above
+ (set-face-attribute 'org-verbatim nil :inherit '(shadow fixed-pitch))
+ (set-face-attribute 'org-block-begin-line nil :inherit 'shadow :slant 'italic :foreground nil)
+ (set-face-attribute 'org-block-end-line nil :inherit 'shadow :slant 'italic :foreground nil)
- ;; ;; fix indent broken by variable-pitch-mode
- ;; ;; http://emacs.stackexchange.com/questions/26864/variable-pitch-face-breaking-indentation-in-org-mode
- ;; (require 'org-indent)
- ;; (set-face-attribute 'org-indent nil :inherit '(org-hide fixed-pitch)))
+ ;; fix indent broken by variable-pitch-mode
+ ;; http://emacs.stackexchange.com/questions/26864/variable-pitch-face-breaking-indentation-in-org-mode
+ (require 'org-indent)
+ (set-face-attribute 'org-indent nil :inherit '(org-hide fixed-pitch)))
;; (with-eval-after-load "org"
;; (let ((default-font-size (- (face-attribute 'default :height) (if (display-graphic-p) 20 0))))
"Projectile: "
("s" projectile-switch-open-project "Switch" :exit t)
("f" projectile-find-file "File" :exit t)
- ("b" projectile-switch-to-buffer "Buffer" :exit t))
-
-
-
+ ("b" projectile-switch-to-buffer "Buffer" :exit t)
+ ("p" projectile-switch-project "Project" :exit t))
#+END_SRC
*** hydra launcher
;; (setq c-default-style "stroustrup"
;; c-basic-offset 4)
- ;; "C-M-j" is my global binding for avy goto line below
- ;; disable it in c mode
- (mapcar #'(lambda (map)
- (define-key map (kbd "C-M-j") nil))
- (list c-mode-map
- c++-mode-map
- objc-mode-map))
+ ;; ;; "C-M-j" is my global binding for avy goto line below
+ ;; ;; disable it in c mode
+ ;; (mapcar #'(lambda (map)
+ ;; (define-key map (kbd "C-M-j") nil))
+ ;; (list c-mode-map
+ ;; c++-mode-map
+ ;; objc-mode-map))
;; objective c
(add-to-list 'auto-mode-alist '("\\.mm\\'" . objc-mode))
- (setq c-hungry-delete-key t)
+ (setq-default c-hungry-delete-key t)
;; Looks `c-hanging-braces-alist' doesn't work as expected when `electric-pair-mode' is enabled.
;; (advice-add 'c-electric-brace :after (lambda (arg) "Add new line after insert {}" (newline-and-indent)))
#+END_SRC
-
*** irony
**** install irony server
Install clang, on mac, it has =libclang.dylib=, but no develop headers. Install by =brew=
(define-key irony-mode-map [remap complete-symbol]
'irony-completion-at-point-async))
- (add-hook 'irony-mode-hook 'my-irony-mode-hook)
- (add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)
+ ;; (add-hook 'irony-mode-hook 'my-irony-mode-hook)
+ ;; (add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)
- (add-hook 'c++-mode-local-vars-hook #'sd/c++-mode-local-vars)
+ ;; (add-hook 'c++-mode-local-vars-hook #'sd/c++-mode-local-vars)
;; add C++ completions, because by default c++ file can not complete
;; c++ std functions, another method is create .dir-local.el file, for p
(setq out-file-name (shell-quote-argument (concat (file-name-sans-extension buffer-file-name) ".out"))))
(setq-local compilation-read-command t)
(set (make-local-variable 'compile-command)
- (concat "g++ -Wall "
+ (concat "g++ -Wall -std=c++11 "
current-file-name
" -o "
out-file-name
:ensure t)
#+END_SRC
+* Iedit
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+ (use-package iedit
+ :ensure t
+ :init
+ (global-set-key (kbd "C-;") #'iedit-mode))
+#+END_SRC
* Gnus
** Gmail setting
Refer [[https://www.emacswiki.org/emacs/GnusGmail][GnusGmail]]
#+BEGIN_SRC emacs-lisp :tangle yes :results silent
(global-set-key (kbd "C-h") 'delete-backward-char)
(global-set-key (kbd "s-m") 'man)
+ (global-set-key (kbd "<s-return>") 'toggle-frame-fullscreen)
+ (global-set-key (kbd "s-f") 'projectile-find-file)
+ (global-set-key (kbd "s-=") 'text-scale-increase)
+ (global-set-key (kbd "s--") 'text-scale-decrease)
#+END_SRC
Refer [[https://github.com/fnwiya/dotfiles/blob/c9ca79f1b22c919d9f4c3a0f944ba8281255a594/setup/.emacs.d/loader-init/_90-kill-region-or-backward-kill-word.el][kill-region-or-backward-kill-word]]
(message "rg is not found"))
#+END_SRC
-*** project config =super= keybindings
-#+BEGIN_SRC emacs-lisp :tangle yes :results silent
- ;; (global-set-key (kbd "s-h") 'keyboard-quit)
- ;; (global-set-key (kbd "s-j") 'ido-switch-buffer)
- ;; (global-set-key (kbd "s-k") 'ido-find-file)
- ;; (global-set-key (kbd "s-l") 'sd/delete-current-window)
- ;; s-l --> goto-line
- ;; (global-set-key (kbd "s-/") 'swiper)
- ;; s-; -->
- ;; s-' --> 'next-multiframe-window
- (global-set-key (kbd "<s-return>") 'toggle-frame-fullscreen)
-
- (global-set-key (kbd "s-f") 'projectile-find-file)
- ;; (global-set-key (kbd "s-`") 'mode-line-other-buffer)
-
- ;; (global-set-key (kbd "s-n") 'persp-next)
- ;; (global-set-key (kbd "s-p") 'persp-prev)
- ;; (global-set-key (kbd "s-;") 'persp-switch-last)
-
- (global-set-key (kbd "s-=") 'text-scale-increase)
- (global-set-key (kbd "s--") 'text-scale-decrease)
-
- ;; (global-set-key (kbd "s-u") 'undo-tree-visualize)
-#+END_SRC
-
** Windown & Buffer - =C-o=
Defind a =hydra= function for windows, buffer & bookmark operations. And map it to =C-o= globally.
Most use =C-o C-o= to switch buffers; =C-o x, v= to split window; =C-o o= to delete other windows
;; (global-set-key (kbd "M-g e") 'avy-goto-word-0)
;; (global-set-key (kbd "M-g f") 'avy-goto-char-timer)
;; (global-set-key (kbd "M-g c") 'avy-goto-char-in-line)
+ (global-set-key (kbd "M-g c") 'avy-goto-char)
+ (global-set-key (kbd "M-g b") 'avy-goto-word-0-above)
+ (global-set-key (kbd "M-g w") 'avy-goto-word-0-below)
#+END_SRC
*** =Imenu= goto tag
(el-get-bundle seudut/perspeen
:features perspeen
(setq perspeen-use-tab nil)
- (perspeen-mode))
+ ;; (perspeen-mode)
+ )
;; super-i to switch to ith workspace