Remove unused files; extract tmux/writing elisp into lib-*.el
This commit is contained in:
parent
1a0fb629a8
commit
ed7d45e36b
5 changed files with 104 additions and 391 deletions
File diff suppressed because one or more lines are too long
|
@ -1,60 +0,0 @@
|
|||
;;; defuns-tmux.el
|
||||
|
||||
;;;###autoload
|
||||
(defun tmux (command &optional run)
|
||||
(shell-command (format (concat "tmux send-keys " (if run "C-u %s Enter" "%s"))
|
||||
(shell-quote-argument command))))
|
||||
|
||||
(evil-define-interactive-code "<term>"
|
||||
"Ex tmux argument (a mix between <sh> <f> and <fsh>)"
|
||||
:ex-arg shell
|
||||
(list (when (evil-ex-p) (evil-ex-file-arg))))
|
||||
|
||||
;;;###autoload (autoload 'narf:tmux-cd "defuns-term" nil t)
|
||||
(evil-define-command narf:tmux-cd (&optional bang)
|
||||
(interactive "<!>")
|
||||
(if bang
|
||||
(narf/tmux-cd-to-project)
|
||||
(narf/tmux-cd-to-here)))
|
||||
|
||||
;;;###autoload (autoload 'narf:tmux "defuns-term" nil t)
|
||||
(evil-define-operator narf:tmux (beg end &optional command bang)
|
||||
"Sends input to tmux. Use `bang' to append to tmux"
|
||||
:type inclusive
|
||||
:repeat t
|
||||
(interactive "<r><term><!>")
|
||||
(if (not command)
|
||||
(os-switch-to-term)
|
||||
(when (use-region-p)
|
||||
(setq command (concat command (buffer-substring-no-properties beg end))))
|
||||
(tmux command bang)
|
||||
(when (evil-ex-p)
|
||||
(message "[Tmux] %s" command))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/tmux-new-window ()
|
||||
(interactive)
|
||||
(tmux "tmux new-window" t))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/tmux-split-window (&optional vertical)
|
||||
(interactive)
|
||||
(tmux (concat "tmux split-window" (if vertical " -h"))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/tmux-vsplit-window ()
|
||||
(interactive)
|
||||
(narf/tmux-split-window t))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/tmux-cd-to-here (&optional dir)
|
||||
(interactive)
|
||||
(tmux (format "cd '%s'" (or dir default-directory))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/tmux-cd-to-project ()
|
||||
(interactive)
|
||||
(narf/tmux-cd-to-here (narf/project-root)))
|
||||
|
||||
(provide 'defuns-tmux)
|
||||
;;; defuns-tmux.el ends here
|
95
modules/lib-tmux.el
Normal file
95
modules/lib-tmux.el
Normal file
|
@ -0,0 +1,95 @@
|
|||
;;; lib-tmux.el
|
||||
|
||||
;; This library offers:
|
||||
;; + TODO An integration/abstraction layer to make it seem like tmux and emacs are one
|
||||
;; program.
|
||||
;; + TODO A way to manage tmux sessions and layouts from emacs; possibly trigger them
|
||||
;; depending on current project.
|
||||
|
||||
;;;###autoload
|
||||
(defun tmux (command &optional modes)
|
||||
(let ((format
|
||||
(concat "tmux send-keys "
|
||||
(if (or (eq modes t)
|
||||
(eq modes 'clear)
|
||||
(memq 'clear modes))
|
||||
"C-u " "")
|
||||
"%s"
|
||||
(if (or (eq modes t)
|
||||
(eq modes 'run)
|
||||
(memq 'run modes))
|
||||
" Enter" ""))))
|
||||
(shell-command (format format (shell-quote-argument command)))))
|
||||
|
||||
(evil-define-interactive-code "<term>"
|
||||
"Ex tmux argument (a mix between <sh> <f> and <fsh>)"
|
||||
:ex-arg shell
|
||||
(list (when (evil-ex-p) (evil-ex-file-arg))))
|
||||
|
||||
;;;###autoload (autoload 'narf:tmux-cd "lib-tmux" nil t)
|
||||
(evil-define-command narf:tmux-cd (&optional bang)
|
||||
(interactive "<!>")
|
||||
(if bang
|
||||
(narf/tmux-cd-to-project)
|
||||
(narf/tmux-cd-to-here)))
|
||||
|
||||
;;;###autoload (autoload 'narf:tmux "lib-tmux" nil t)
|
||||
(evil-define-operator narf:tmux (&optional command bang)
|
||||
"Sends input to tmux. Use `bang' to append to tmux"
|
||||
:type inclusive
|
||||
:repeat t
|
||||
(interactive "<term><!>")
|
||||
(if (not command)
|
||||
(os-switch-to-term)
|
||||
(tmux command bang)
|
||||
(when (evil-ex-p)
|
||||
(message "[Tmux] %s" command))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/tmux-new-window ()
|
||||
(interactive)
|
||||
(tmux "tmux new-window" t))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/tmux-cd-to-here (&optional dir)
|
||||
(interactive)
|
||||
(tmux (format "cd '%s'" (or dir default-directory))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/tmux-cd-to-project ()
|
||||
(interactive)
|
||||
(narf/tmux-cd-to-here (narf/project-root)))
|
||||
|
||||
;;;;;;;;;;
|
||||
|
||||
;; TODO
|
||||
;; (defun narf/window (direction)
|
||||
;; )
|
||||
|
||||
;;;###autoload (autoload 'narf/evil-window-or-tmux "lib-tmux" nil t)
|
||||
(evil-define-command narf/evil-window-or-tmux (count direction)
|
||||
:repeat nil
|
||||
(interactive "p")
|
||||
(let ((start-window (selected-window)))
|
||||
(ignore-errors (funcall (intern (format "evil-window-%s" direction)) count))
|
||||
(when (eq start-window (selected-window))
|
||||
(os-switch-to-term))))
|
||||
|
||||
;;;###autoload (autoload 'narf/evil-window-left "lib-tmux" nil t)
|
||||
(evil-define-command narf/evil-window-left (count)
|
||||
:repeat nil (interactive "p") (narf/evil-window-or-tmux count 'left))
|
||||
|
||||
;;;###autoload (autoload 'narf/evil-window-right "lib-tmux" nil t)
|
||||
(evil-define-command narf/evil-window-right (count)
|
||||
:repeat nil (interactive "p") (narf/evil-window-or-tmux count 'right))
|
||||
|
||||
;;;###autoload (autoload 'narf/evil-window-up "lib-tmux" nil t)
|
||||
(evil-define-command narf/evil-window-up (count)
|
||||
:repeat nil (interactive "p") (narf/evil-window-or-tmux count 'up))
|
||||
|
||||
;;;###autoload (autoload 'narf/evil-window-down "lib-tmux" nil t)
|
||||
(evil-define-command narf/evil-window-down (count)
|
||||
:repeat nil (interactive "p") (narf/evil-window-or-tmux count 'down))
|
||||
|
||||
(provide 'lib-tmux)
|
||||
;;; lib-tmux.el ends here
|
|
@ -1,4 +1,10 @@
|
|||
;;; module-writing.el
|
||||
;;; lib-writing.el
|
||||
|
||||
;; This library offers the following:
|
||||
;; + Writing-mode: visual-fill-column, larger fonts, fewer disctractions
|
||||
;; + Bibtex integration
|
||||
;; + TODO Pandoc integration
|
||||
;; + TODO A separate emacs configuration dedicated to org-mode
|
||||
|
||||
;; From <https://github.com/joostkremers/visual-fill-column/pull/6>
|
||||
(after! visual-fill-column
|
||||
|
@ -92,5 +98,5 @@
|
|||
(lambda (fpath) (async-start-process "open-pdf" "/usr/bin/open" nil fpath))))
|
||||
|
||||
|
||||
(provide 'module-writing)
|
||||
;;; module-writing.el ends here
|
||||
(provide 'lib-writing)
|
||||
;;; lib-writing.el ends here
|
|
@ -1,8 +0,0 @@
|
|||
;;; module-collab.el
|
||||
|
||||
(use-package impatient-mode
|
||||
:defer t
|
||||
:commands httpd-start)
|
||||
|
||||
(provide 'module-collab)
|
||||
;;; module-collab.el ends here
|
Loading…
Add table
Add a link
Reference in a new issue