Emojify

I don't use it much, but it is nice to have the option to insert emojis 😄 Write a script to convert emojis.json into ultimately yasnippet files. Then you can type out keys to see a preview and insert.



(use-package emojify
  :commands (emojify-mode emojify-insert-emoji)
  :config
  ;(emojify-mode 1)
  ;emojify-mode-line-mode
  ;emojify-apropos-emoji
  ;emojify-insert-emoji
  ;emojify-describe-emoji-at-point
  ;emojify-list-emojis
  ;emojify-describe-emoji
  ;emojify-composed-text-p nil
  ;(setq emojify-emoji-styles 'github) ; ascii|unicode
  (emojify-set-emoji-styles '(github ascii unicode))
  ;(emojify-set-emoji-styles 'ascii)
  ;(emojify-set-emoji-styles 'unicode)
  ; emojify-display-style image|unicode|ascii
  ;(set emojify-display-style 'unicode)
  ; emojify-inhibit-major-modes
  ;emojify-inhibit-in-buffer-functions
  ; emojify-mode
  ;emojify-prog-contexts comments|string|both|none
  ;emojify-inhibit-functions text|beg|end
  ;emojify-show-help nil
  ;emojify-download-emoji
  (setq emojify-emoji-set "twemoji-v2") ; twemoji-v2-22, emojione-v2.2.6, emojione-v2.2.6-22, twemoji-v2, emojione-v2, emojione-v2-22, openmoji-v13-0

  ;custom set some emojis

  ;(setq emojify-user-emojis '((":head_green:" . (("name" . "Green Header")
  ;                                              ("image" . "~/.emacs.d/emojis/emojione-v2.2.6-22/rect851.png")
  ;                                              ("style" . "github")))
  ;                            (":head_green2:" . (("name" . "Green Header 2")
  ;                                              ("image" . "~/.emacs.d/emojis/emojione-v2.2.6-22/rect845.png")
  ;                                              ("style" . "github")))))
  ;(when (featurep 'emojify)
  ;  (emojify-set-emoji-data))
  :hook
  (org-mode-hook . emojify-mode)
  );end emojify



insert date and time



;; Date and time functions
(setq current-date-time-format "%a %b %d %Y %H:%M:%S %Z ")
(setq current-date-format "%Y-%m-%d")
(setq current-time-format "%a %H:%M:%S")

(defun insert-current-date-time ()
  "insert the current date and time into current buffer.
Uses `current-date-time-format' for the formatting the date/time."
       (interactive)
;       (insert (let () (comment-start)))
       (insert (format-time-string current-date-time-format (current-time)))
       )

(defun insert-current-date ()
  "insert the current date and time into current buffer.
Uses `current-date-format' for the formatting the date/time."
       (interactive)
;       (insert (let () (comment-start)))
       (insert (format-time-string current-date-format (current-time)))
   )

(defun insert-current-time ()
  "insert the current time (1-week scope) into the current buffer."
       (interactive)
       (insert (format-time-string current-time-format (current-time)))
       )
(bind-key "\C-c\C-y" 'insert-current-date)
(bind-key "\C-c\C-t" 'insert-current-time)



new frame scratch buffer



;Create scratch buffer in new frame
(defun new-frame-scratch-buffer ()
"Create a new scratch buffer -- \*hello-world\*"
(interactive)
  (let ((n 0)
        bufname buffer)
    (catch 'done
      (while t
        (setq bufname (concat "*hello-world"
          (if (= n 0) "" (int-to-string n))
            "*"))
        (setq n (1+ n))
        (when (not (get-buffer bufname))
          (setq buffer (get-buffer-create bufname))
          (with-current-buffer buffer
            (emacs-lisp-mode))
          ;; When called non-interactively, the `t` targets the other window (if it exists).
          (throw 'done (display-buffer buffer '(display-buffer-pop-up-frame .( (window-height .8) (window-width .8)))
)) )))))

; to make a new scratch buffer in a new frame
(bind-key "C-c b" 'new-frame-scratch-buffer)
(bind-key "C-c v" 'new-window-scratch-buffer)
;to kill a frame in emacs (also, C-x 0)
(bind-key "C-x C-c" 'delete-frame)
 ;make a new frame
(bind-key "C-x C-n" 'make-frame-command)



new window scratch buffer



;create scratch buffer in new window
(defun new-window-scratch-buffer ()
  "Create a new scratch buffer -- \*hello-world\*"
(interactive)
(let (($buf (generate-new-buffer "hello-world")))
(switch-to-buffer $buf)
(funcall initial-major-mode)
(setq buffer-offer-save t)
$buf
))



new org write buffer





(defun pos:open-temp-buffer ()
  "Open/create a temporary buffer for writing."
  (interactive)
  (let ((buf (get-buffer-create "*write*")))
    (with-current-buffer buf
      (org-mode)
;      (pjones:markdown-visual-line);
)
    (pop-to-buffer buf)))




delete all buffers




;delete-all-buffers
(defun delete-all-other-buffers ()
  (interactive)
    (mapc 'kill-buffer (cdr (buffer-list (current-buffer)))))




kill this buffer




;Bind Kill This Buffer
(bind-key "\C-x\C-k" 'kill-this-buffer)



cursor and scroll defaults





;cursors, and mouse
(setq mouse-yank-at-point t)
(setq cursor-in-non-selected-windows t)
(blink-cursor-mode 0)                           ; Disable the cursor blinking
(setq x-stretch-cursor t)
(mouse-avoidance-mode 'banish)

;scrolling buffers, movement top to bottom
(setq fast-but-imprecise-scrolling t )
(setq scroll-conservatively 10000) ; Always scroll by one line
(setq scroll-conservatively 1000)

;"Don't hscroll unless needed"- ? More voodoo lisp.
;(setq hscroll-margin 1)
(setq scroll-margin 1)
;(setq scroll-margin 8)
(setq scroll-step 1)  ; keyboard scroll one line at a
;Keeps cursor in the same relative row during pgups and dwns
(setq scroll-preserve-screen-position t)

(setq recenter-positions '(5 top bottom))
;(recenter-top-bottom)

; Don't highlight matches with jump-char - it's distracting
(setq jump-char-lazy-highlight-face nil)
; Scroll 1 line at a time

;Fix the whole huge-jumps-scrolling-between-windows nastiness

;Accelerate the cursor when scrolling.
(load "accel" t)
; scroll N lines to screen edge
;speed up cursor
(setq auto-window-vscroll nil)

;cursor
(blink-cursor-mode 0)
;Push the mouse out of the way when the cursor approaches.
(mouse-avoidance-mode 'jump)
(use-package smooth-scrolling
:config
(require 'smooth-scrolling)
(smooth-scrolling-mode t)
(setq smooth-scroll/vscroll-step-size 1)
(setq smooth-scroll/hscroll-step-size 1)
(setq fast-but-imprecise-scrolling t)
:diminish)
;backward/forward paragraph
(bind-key "M-p" 'backward-paragraph)
(bind-key "M-n" 'forward-paragraph)
;pop-to-mark-command
;(bind-key "<prior>" 'pop-to-mark-command)
;(bind-key "<next>" 'pop-to-mark-command)
;enables C-u C-<SPC>, to return to last mark, followed by C-<SPC> to cycle through all marks set
(setq set-mark-command-repeat-pop t)
;beginning end of buffer
(bind-key "<home>" 'beginning-of-buffer)
(bind-key "<end>" 'end-of-buffer)



multiple cursors





(use-package multiple-cursors
;:ensure t
;:commands (lots)
:config
(global-set-key (kbd "C-S-<mouse-1>") 'mc/add-cursor-on-click)
;(add-to-list 'mc/cmds-to-run-once '())
;(add-to-list 'mc/always-run-for-all '())
);




multiple cursors hydra




;define a title function
(setq multiple-cursors-title (with-faicon "desktop" "Multiple Cursors Command"))
;generate hydra
(pretty-hydra-define multiple-cursors-hydra (:foreign-keys warn :title multiple-cursors-title :quit-key "q" :color pink )
("A"
   (

    ("a" mc/mark-all-like-this "+ cursor/region all parts buffer match region")
    ("w" mc/mark-all-words-like-this "+ cursor/region buffers words match region" )
    ("s" mc/mark-all-in-region "+ cursor/region match strings in region")
    ("@" mc/mark-all-symbols-like-this "+ cursor/region buffer matching symbols")
    ("F" mc/mark-all-like-this-in-defun "+ cursor/region all part matches in function")
    ("W" mc/mark-all-words-like-this-in-defun "+ cursor/region all word matches in function")
    ("$" mc/mark-all-symbols-like-this-in-defun "+ cursor/regionall symbol matches in function")
    ("A" set-rectangular-region-anchor "set rectangular region anchor")
    ("H" mc-hide-unmatched-lines-mode "Hide/show unmatched lines")
    ("}" mc-cycle-forward "Cycle forward cursors")
    ("{" mc-cycle-backward "Cycle backward cursors")
);end A
"B"
   (
    ("n"  mc/mark-next-like-this "+ cursor/region next region match in buffer")
    ("p"  mc/mark-previous-like-this "+ cursor/region previous region match in buffer")    
    ("f"  mc/mark-next-like-this-word "+ cursor/region next word match in buffer")
    ("b"  mc/mark-previous-like-this-word "+ cursor/region previous word match in buffer")
    ("\)"  mc/mark-next-like-this-symbol "+ cursor/region next symbol match in buffer")
    ("\("  mc/mark-previous-like-this-symbol "+ cursor/region previous symbol match in buffer")
    ("\/"  mc/mark-next-word-like-this "Mark next word match in buffer")
    ("\\"  mc/mark-previous-word-like-this "Mark next word match in buffer")
    (">"  mc/mark-next-symbol-like-this "Mark next symbol match in buffer")
    ("<"  mc/mark-previous-symbol-like-this "Mark previous symbol match in buffer")
    
);end B
"C"
   (
    ("m" multiple-cursors-mode "Multiple Cursors Mode"  :toggle t)
    ("B" mc/edit-beginings-of-lines "Add cursor to start of each line in region" )    
    ("E" mc/edit-ends-of-lines "Add cursor to end of each line in region" )
    ("d" mc/mark-all-dwim "Mark all dwim ?")    
    ("t" mc/mark-all-like-this-dwim "Mark all similar tags - html")
    ("r" mc/reverse-regions "Mark all similar tags - html")
    ("<left>"  mc/mark-more-like-this-extended "Arrow keys mark/skip n/p occurances")
    ("P"  mc/mark-pop "Leave a cursor, move to next spot")
    ("h" hydra-helm/body "Return To Helm" :color blue )
    ("<SPC>" nil "Quit" :color blue )
);end miscellaneous
);end hydra body
);end pretty-hydra-multiple cursors
(bind-key "<C-m> c" 'multiple-cursors-hydra/body)



better scroll




(use-package better-scroll
;:ensure t
:config
(global-set-key (kbd "C-M-n") 'better-scroll-down)
;(global-set-key (kbd "<prior> ") 'better-scroll-down)
(global-set-key (kbd "C-M-p") 'better-scroll-up)
;(global-set-key (kbd "<next>") 'better-scroll-up)

(global-set-key (kbd "<next>") 'better-scroll-down-other-window)
(global-set-key (kbd "<prior>") 'better-scroll-up-other-window)
;(setq better-scroll-align-type 'center)
);end better scroll





buffer move





(use-package buffer-move
:ensure t
;:init
:commands (buf-move)
;:config
;bind (
;:bind (
;("C-x" . package-function)
;:map minibuffer-local-map
;("C-r" . 'counsel-minibuffer-history))
;hook
);end package)




shackle




(use-package shackle
;:ensure t
:commands shackle-mode
:config
(setq shackle-default-rule '(:same t))
;(setq shackle-rules '((compilation-mode :noselect t))
;      shackle-default-rule '(:select t))
;(setq helm-display-function 'pop-to-buffer) ; make helm play nice
;(setq shackle-rules '(("\\`\\*helm.*?\\*\\'" :regexp t :align t :size 0.4)))
)





beacon




;highlight cursor when jump window/buffer
(use-package beacon
:diminish
:commands beacon-mode
:init
(beacon-mode 1)
:config
;; only flash on window/buffer changes...
(setq beacon-blink-when-window-changes t)
(setq beacon-blink-when-window-scrolls nil)
(setq beacon-blink-when-point-moves nil)
(setq beacon-blink-duration .2)
(setq beacon-blink-delay .2)
(setq beacon-size 20)
);end beacon



goto line with feedback




; go to line with feedback
;quit-selection-here
 (defun goto-line-with-feedback ()
   "Show line numbers temporarily, while prompting for the line number input"
   (interactive)
   (unwind-protect
       (progn
 (display-line-numbers-mode 1)
 (goto-line (read-number "Goto line: ")))
     (display-line-numbers-mode 0)))




append lines



(defun append-lines ()
"add next line to current line"
    (lambda ()
        (interactive)
            (join-line -1)))



mwim - beginning of line & end of line





(use-package mwim
:bind
("C-a" . mwim-beginning-of-code-or-line)
("C-e" . mwim-end-of-code-or-line)
);end mwim




avy jump to character



(use-package avy
:commands (avy-goto-char avy-goto-char2 avy-goto-char-timer avy-goto-word avy-goto-word-1 avy-org-goto-heading-timer avy-org-refile-as-child)
;:config
;(global-set-key (kbd "C-;") 'avy-goto-char)
:bind
("C-;" . avy-goto-char)
);end avy



buffers hydra




;define a title function
(setq buffers-title (with-fileicon "broccoli" "Buffers Command"))
;generate hydra
(pretty-hydra-define buffers-hydra (:foreign-keys warn :title buffers-title :quit-key "q" :color pink )
("TABS"
   (

    ("T" tab-bar-mode "Toggle Tab-bar Mode"  :toggle t)
    ("6" tab-new "Open New Tab C-6" )
    ("9" tab-next "Next Tab C-9")
    ("3" tab-previous "Previous Tab C-3" )
    ("l" tab-bar-switch-to-previous-tab "Switch to last Tab" )
    ("@" tab-rename "Rename Current Tab C-M-n" )
    ("7" close-tab "Kill Tab C-7" )
    ("u" tab-bar-undo-close-tab "Undo closed Tab" )
    ("}" tab-move "Move Current Tab L/R"  )
    ("N" tab-bar-select-by-name "Select Tab Bar By name")
    ("*" switch-to-buffer-other-tab "Switch to Buffer Other tab C-8")
    ("$" find-file-other-tab "Find File Other Tab C-4")
    ("#" dired-other-tab "Dired Other Tab C-0")
;    ("t" new-window-scratch-buffer "New Scratch Tab in tab-mode")

);end A
"B"
   (
    ("d"  delete-all-other-buffers "Delete All Other Buffers" :color red)
    ("i" counsel-ibuffer "Quick switch to buffer" :color blue)
    ("I" ibuffer "Edit buffer list")
    ("R" pos-rename-current-file "Rename this file (and save)")
    ("<" previous-buffer "Previous Buffer")
    (">" next-buffer "Next Buffer")
    ("a" elwm-swap-left "Swap with buffer to left")
    ("e" elwm-swap-right "Swap with buffer to right")
    ("p" elwm-swap-up "Swap with buffer above")
    ("n" elwm-swap-down "Swap with buffer below")
    
);end B
"C"
   (
    ("s"  shackle-mode "Shackle Buffers")
    ("f"  new-frame-scratch-buffer "Make New Scratch Frame" )
    ("t"  new-window-scratch-buffer "Make New Scratch Tab or buffer")
    ("o" pos:open-temp-buffer "New Org Write Buffer")
    ("k" kill-buffer-and-window "Kill Buffer and Window")
    ("K" kill-this-buffer "Kill This Buffer C-x C-k")
    ;    ("x" centaur-tabs-open-in-external-application "Open in External App")
;    ("X" centaur-tabs-open-directory-in-external-application "Open Directory External")
;    ("1" centaur-tabs-select-beg-tab "Select First Tab")
;    ("0" centaur-tabs-select-end-tab "Select Last Tab")
    ("h" hydra-helm/body "Return To Helm" :color blue )
    ("<SPC>" nil "Quit" :color blue )
);end miscellaneous
);end hydra body
);end pretty-hydra-CentaurTabs
(bind-key "<C-m> t" 'buffers-hydra/body)



That’s all folks..

comments powered by Disqus