2 Commits

Author SHA1 Message Date
  10sr 85c5c08533
Update 2 years ago
  10sr 3087bf2cdd
Update emacs.el 3 years ago
3 changed files with 49 additions and 5 deletions
Split View
  1. +46
    -5
      emacs.el
  2. +2
    -0
      shrc
  3. +1
    -0
      tmux.conf

+ 46
- 5
emacs.el View File

@@ -434,10 +434,10 @@ Otherwize hook it."
(global-set-key (kbd "C-h") (kbd "DEL"))
;; (normal-erase-is-backspace-mode 1)
;; M-SPC fixup-whitespace]
(when (fboundp 'global-hungry-delete-mode)
(set-variable 'hungry-delete-join-reluctantly t)
(add-hook 'after-first-visit-hook
'global-hungry-delete-mode))
;; (when (fboundp 'global-hungry-delete-mode)
;; (set-variable 'hungry-delete-join-reluctantly t)
;; (add-hook 'after-first-visit-hook
;; 'global-hungry-delete-mode))

;;(global-set-key (kbd "C-m") 'reindent-then-newline-and-indent)
(global-set-key (kbd "C-m") 'newline-and-indent)
@@ -856,11 +856,42 @@ THEM are function and its args."
(defvar helm-map)
(define-key helm-map (kbd "C-h") (kbd "DEL")))

(defun my-shrink-path-width (path width)
"Shrink PATH to be same or shorter than WIDTH."
(setq path (abbreviate-file-name path))
(if (file-remote-p path)
(let* ((remote (file-remote-p path))
(localname (file-remote-p path 'localname))

(remote-length (length remote))
(width-localname (- width remote-length))

(localname-shrinked (my-shrink-path-width localname width-localname)))
(concat remote localname-shrinked))
(let ((yet (split-string path "/"))
(done nil)
(result path))
(while (and yet
(< width (length result)))
(let ((current (pop yet)))
(unless (string= "" current)
(setq current (substring current 0 1)))
(setq done
(append done (list current))))
(setq result
(concat (mapconcat 'identity
(append done yet)
"/"))))
result)))
;; (my-shrink-path-width "/Applications/Vivaldi.app/Contents/MacOS/Vivaldi" 20)
;; (my-shrink-path-width "/scp:sakura:/Applications/Vivaldi.app/Contents/MacOS/Vivaldi" 30)
;; (my-shrink-path-width "/scp:sakura:/Applications/Vivaldi.app/Contents/MacOS/Vivaldi" 20)

(setq-default header-line-format
'(:eval (let ((f (or (buffer-file-name)
default-directory)))
(when f
(abbreviate-file-name f)))))
(my-shrink-path-width f (window-width))))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; letters, font-lock mode and fonts
@@ -3071,6 +3102,16 @@ ARGS are not used."
url))


(defun my-vterm-cmd (command)
"Start arbitrary command in vterm buffer."
(interactive "sCommand: ")
(let ((vterm-shell command)
(vterm-buffer-name "*vterm-cmd*")
(vterm-kill-buffer-on-exit nil))
(when (get-buffer vterm-buffer-name)
(kill-buffer (get-buffer vterm-buffer-name)))
(vterm)))


;; https://emacs-jp.github.io/tips/startup-optimization
;; Restore to original value


+ 2
- 0
shrc View File

@@ -348,6 +348,8 @@ __safe_alias igosh=gosh-rl
__safe_alias pipenv="env -u PIP_USER pipenv"
__safe_alias pipx="env -u PIP_USER pipx"

alias f='less `fzf`'


# Sometimes SHELL cannot be used. For example, when running bash inside zsh
# SHELL is set to be /bin/zsh


+ 1
- 0
tmux.conf View File

@@ -28,6 +28,7 @@ set -g history-limit 10000
setw -g mode-keys vi
#setw -g mode-mouse off
#set -g default-command /bin/bash
set -g default-command "while true; do /bin/bash -l; done"

# Use pasteboard on MacOS
run-shell 'test "`uname`" = Darwin && tmux bind-key -T copy-mode-vi "Enter" send-keys -X copy-pipe-and-cancel "pbcopy"'


Loading…
Cancel
Save