Giant refactor! (part 1)
This commit is contained in:
parent
f38d868504
commit
a984bf4f26
20 changed files with 490 additions and 541 deletions
|
@ -57,8 +57,8 @@
|
|||
(or macro (read-char "@-"))))))
|
||||
|
||||
;;; Custom argument handlers
|
||||
;;;###autoload
|
||||
(defun narf/-ex-match-init (name &optional face update-hook)
|
||||
(defvar narf-buffer-match-global evil-ex-substitute-global "")
|
||||
(defun narf--evil-ex-match-init (name &optional face update-hook)
|
||||
(with-current-buffer evil-ex-current-buffer
|
||||
(cond
|
||||
((eq flag 'start)
|
||||
|
@ -70,8 +70,7 @@
|
|||
((eq flag 'stop)
|
||||
(evil-ex-delete-hl name)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/-ex-buffer-match (arg &optional hl-name flags beg end)
|
||||
(defun narf--evil-ex-buffer-match (arg &optional hl-name flags beg end)
|
||||
(when (and (eq flag 'update)
|
||||
evil-ex-substitute-highlight-all
|
||||
(not (zerop (length arg))))
|
||||
|
@ -94,6 +93,21 @@
|
|||
(user-error
|
||||
(evil-ex-pattern-update-ex-info nil (format "?%s" lossage))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/evil-ex-buffer-match (flag &optional arg)
|
||||
(let ((hl-name 'evil-ex-buffer-match))
|
||||
(with-selected-window (minibuffer-selected-window)
|
||||
(narf--evil-ex-match-init hl-name)
|
||||
(narf--evil-ex-buffer-match arg hl-name (list (if narf-buffer-match-global ?g))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/evil-ex-global-match (flag &optional arg)
|
||||
(let ((hl-name 'evil-ex-global-match))
|
||||
(with-selected-window (minibuffer-selected-window)
|
||||
(narf--evil-ex-match-init hl-name)
|
||||
(let ((result (car-safe (evil-ex-parse-global arg))))
|
||||
(narf--evil-ex-buffer-match result hl-name nil (point-min) (point-max))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/evil-ex-undefine-cmd (cmd)
|
||||
(if (string-match "^[^][]*\\(\\[\\(.*\\)\\]\\)[^][]*$" cmd)
|
||||
|
|
24
core/defuns/defuns-git.el
Normal file
24
core/defuns/defuns-git.el
Normal file
|
@ -0,0 +1,24 @@
|
|||
;;; defuns-git.el
|
||||
|
||||
;;;### (autoload 'narf/git-remote-browse "defuns-git" nil t)
|
||||
(evil-define-command narf:git-remote-browse (&optional bang)
|
||||
"Open the website for the current (or specified) version controlled FILE. If BANG,
|
||||
then use hub to do it."
|
||||
(interactive "<!>")
|
||||
(let (url)
|
||||
(condition-case err
|
||||
(setq url (browse-at-remote/get-url))
|
||||
(error
|
||||
(setq url (shell-command-to-string "hub browse -u --"))
|
||||
(setq url (if url
|
||||
(concat (s-trim url) "/" (f-relative (buffer-file-name) (narf/project-root))
|
||||
(when (use-region-p) (format "#L%s-L%s"
|
||||
(line-number-at-pos (region-beginning))
|
||||
(line-number-at-pos (region-end)))))))))
|
||||
(when url
|
||||
(if bang
|
||||
(message "Url copied to clipboard: %s" (kill-new url))
|
||||
(browse-url url)))))
|
||||
|
||||
(provide 'defuns-git)
|
||||
;;; defuns-git.el ends here
|
|
@ -73,5 +73,23 @@ buffers."
|
|||
(let ((narf-helm-force-project-buffers (and (not all-p) (narf/project-p))))
|
||||
(helm-buffers-list)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf*helm-replace-prompt (plist)
|
||||
(if (keywordp (car plist))
|
||||
(setq plist (plist-put plist :prompt helm-global-prompt))
|
||||
(setcar (nthcdr 2 plist) helm-global-prompt))
|
||||
plist)
|
||||
|
||||
;;;###autoload
|
||||
(defun narf*helm-hide-header (source &optional force)
|
||||
(setq header-line-format nil)
|
||||
(narf|hide-mode-line))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf*helm-hide-source-header-maybe ()
|
||||
(if (<= (length helm-sources) 1)
|
||||
(set-face-attribute 'helm-source-header nil :height 0.1 :foreground "#111111")
|
||||
(set-face-attribute 'helm-source-header nil :height 1.0 :foreground narf-helm-header-fg)))
|
||||
|
||||
(provide 'defuns-helm)
|
||||
;;; defuns-helm.el ends here
|
||||
|
|
|
@ -85,6 +85,20 @@ evil-window-move-* (e.g. `evil-window-move-far-left')"
|
|||
((memq direction '(above below))
|
||||
(evil-window-increase-height count)))))
|
||||
|
||||
;;;###autoload (autoload 'narf/evil-window-resize-r "defuns-window" nil t)
|
||||
(evil-define-command narf/evil-window-resize-r (&optional count)
|
||||
(interactive "<c>") (narf/evil-window-resize 'right count))
|
||||
;;;###autoload (autoload 'narf/evil-window-resize-l "defuns-window" nil t)
|
||||
(evil-define-command narf/evil-window-resize-l (&optional count)
|
||||
(interactive "<c>") (narf/evil-window-resize 'left count))
|
||||
;;;###autoload (autoload 'narf/evil-window-resize-u "defuns-window" nil t)
|
||||
(evil-define-command narf/evil-window-resize-u (&optional count)
|
||||
:repeat nil
|
||||
(interactive "<c>") (narf/evil-window-resize 'above count))
|
||||
;;;###autoload (autoload 'narf/evil-window-resize-d "defuns-window" nil t)
|
||||
(evil-define-command narf/evil-window-resize-d (&optional count)
|
||||
(interactive "<c>") (narf/evil-window-resize 'below count))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/window-reorient ()
|
||||
"Reorient all windows that are scrolled to the right."
|
||||
|
|
|
@ -1,17 +1,5 @@
|
|||
;;; macros-evil.el
|
||||
|
||||
;;;###autoload
|
||||
(defmacro def-textobj! (key start-regex end-regex)
|
||||
(let ((inner-name (make-symbol "narf--inner-name"))
|
||||
(outer-name (make-symbol "narf--outer-name")))
|
||||
`(progn
|
||||
(evil-define-text-object ,inner-name (count &optional beg end type)
|
||||
(evil-select-paren ,start-regex ,end-regex beg end type count nil))
|
||||
(evil-define-text-object ,outer-name (count &optional beg end type)
|
||||
(evil-select-paren ,start-regex ,end-regex beg end type count t))
|
||||
(define-key evil-inner-text-objects-map ,key (quote ,inner-name))
|
||||
(define-key evil-outer-text-objects-map ,key (quote ,outer-name)))))
|
||||
|
||||
;;;###autoload
|
||||
(defmacro def-tmp-excmd! (cmd-on cmd-off &rest commands)
|
||||
"Creates a toggle for a set of ex commands, named CMD-ON and CMD-OFF."
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue