Skip to content

Instantly share code, notes, and snippets.

@minorugh
minorugh / doom-nano-modeline.el
Created June 26, 2023 10:09
doom-nano-modeline
(leaf doom-nano-modeline
:doc "Nice look modeline based on N Λ N O"
:url "https://github.com/ronisbr/doom-nano-modeline"
:el-get "ronisbr/doom-nano-modeline"
:hook (emacs-startup-hook . doom-nano-modeline-mode)
:custom-face
(region . '((t (:background "#6272a4" :extend t))))
(hl-line . '((t (:background "#3B4252" :extend t))))
(doom-nano-modeline-active-face . '((t (:foreground "#f8f8f2" :background "#44475a" :weight bold))))
(doom-nano-modeline-evil-emacs-state-face . '((t (:foreground "#f4a460" :background "#6272a4" :weight bold))))
@minorugh
minorugh / kill-word-at-point
Created June 24, 2023 22:04
kill-word-at-point
(defun kill-word-at-point ()
"Kill word at cursor position."
(interactive)
(let ((char (char-to-string (char-after (point)))))
(cond
((string= " " char) (delete-horizontal-space))
((string-match "[\t\n -@\[-`{-~],.、。" char) (kill-word 1))
(t (forward-char) (backward-word) (kill-word 1)))))
@minorugh
minorugh / backward-kill-word-or-region.el
Created June 24, 2023 22:02
backward-kill-word-or-rigion
(defun backward-kill-word-or-region ()
"If the region is active, `clipboard-kill-region'.
If the region is inactive, `backward-kill-word'."
(interactive)
(if (use-region-p)
(clipboard-kill-region (region-beginning) (region-end))
(backward-kill-word 1)))
(defun my:kill-whole-line-or-region ()
"If the region is active, to kill region.
If the region is inactive, to kill whole line."
(interactive)
(if (use-region-p)
(clipboard-kill-region (region-beginning) (region-end))
(kill-whole-line)))
@minorugh
minorugh / doom-nano-modeline.el
Created June 21, 2023 08:15
doom-nano-modeline
(leaf doom-nano-modeline
:el-get "ronisbr/doom-nano-modeline"
:config
(doom-nano-modeline-mode 1)
(global-hide-mode-line-mode 1)
:custom-face
(hl-line . '((t (:background "#3B4252" :extend t ))))
(doom-nano-modeline-active-face . '((t (:inherit mode-line :background "#44475a" :weight bold))))
(doom-nano-modeline-cursor-position-face . '((t (:inherit font-lock-comment-face :background "#44475a"))))
(doom-nano-modeline-evil-emacs-state-face . '((t (:inherit (font-lock-builtin-face bold) :background "#6272a4"))))
@minorugh
minorugh / doom-modeline.el
Created June 20, 2023 09:57
doom-modeline
(leaf doom-modeline
:ensure t
:hook (after-init-hook . doom-modeline-mode)
:custom
`((doom-modeline-icon . t)
(doom-modeline-major-mode-icon . nil)
(doom-modeline-minor-modes . nil))
:config
(line-number-mode 0)
(column-number-mode 0)
@minorugh
minorugh / sudo-open
Created June 17, 2023 00:17
sudo-open
;; Automatically open root permission file with sudo
(leaf *sudo-open
:doc "https://ameblo.jp/grennarthmurmand1976/entry-12151018656.html"
:config
(defun file-root-p (filename)
"Return t if file FILENAME created by root."
(eq 0 (nth 2 (file-attributes filename))))
(defadvice find-file (around my:find-file activate)
"Open FILENAME using tramp's sudo method if it's root permission."
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Scroll deactive window
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(leaf cus-scrroll-window-key-bind
:bind (("C-<next>" . my:scroll-other-window)
("C-<prior>" . my:scroll-other-window-down))
:init
(defun my:scroll-other-window ()
"If there are two windows, `scroll-other-window'."
(interactive)
@minorugh
minorugh / sequential-command
Created June 10, 2023 01:15
sequential-command
;; Sequential-command
(leaf sequential-command
:el-get HKey/sequential-command
:config
(leaf sequential-command-config
:hook (emacs-startup-hook . sequential-command-setup-keys)))
@minorugh
minorugh / evil-swap-key.el
Created December 18, 2022 08:37
evil-swap-key
;; Customized functions
(defun evil-swap-key (map key1 key2)
"Swap KEY1 and KEY2 in MAP."
(let ((def1 (lookup-key map key1))
(def2 (lookup-key map key2)))
(define-key map key1 def2)
(define-key map key2 def1)))
(evil-swap-key evil-motion-state-map "j" "gj")
(evil-swap-key evil-motion-state-map "k" "gk")