common/home-manager: make fish and emacs play nice
Signed-off-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
parent
89f1760f55
commit
28f17b91b4
|
@ -32,6 +32,7 @@ in {
|
|||
(setq inhibit-startup-screen t)
|
||||
|
||||
(menu-bar-mode -1)
|
||||
(tab-bar-mode 1)
|
||||
|
||||
(electric-pair-mode)
|
||||
|
||||
|
@ -140,7 +141,7 @@ in {
|
|||
(setq initial-buffer-choice (lambda () (get-buffer-create "*dashboard*")))
|
||||
(setq dashboard-banner-logo-title "Have you ever been far even as decided to use even go want to do look more like?")
|
||||
;(add-to-list 'dashboard-items '(agenda) t)
|
||||
(setq dashboard-week-agenda t)
|
||||
;(setq dashboard-week-agenda t)
|
||||
'';
|
||||
};
|
||||
|
||||
|
@ -542,6 +543,15 @@ in {
|
|||
pname = "xe-tools";
|
||||
src = ./xe-tools.el;
|
||||
});
|
||||
|
||||
bindStar = {
|
||||
"C-s c" = "xe/tabnew-shell";
|
||||
"C-a c" = "xe/tabnew-shell";
|
||||
"C-s h" = "split-window-vertically";
|
||||
"C-a h" = "split-window-vertically";
|
||||
"C-s v" = "split-window-horizontally";
|
||||
"C-a v" = "split-window-horizontally";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
;;; xe-tools --- Xe's tools
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;; Code:
|
||||
(defun xe/count-buffers (&optional display-anyway)
|
||||
"Display or return the number of buffers."
|
||||
(interactive)
|
||||
|
@ -6,14 +11,23 @@
|
|||
(message "%d buffers in this Emacs" buf-count)) buf-count))
|
||||
|
||||
(defun xe/look-of-disapproval ()
|
||||
"Just in case we need this"
|
||||
"Just in case we need this."
|
||||
(interactive)
|
||||
(insert "ಠ_ಠ"))
|
||||
|
||||
(defun xe/enable-minor-mode (my-pair)
|
||||
"Enable minor mode if filename match the regexp. MY-PAIR is a cons cell (regexp . minor-mode)."
|
||||
"Enable minor mode if filename match the regexp. MY-PAIR is a cons
|
||||
cell (regexp . minor-mode)."
|
||||
(if (buffer-file-name)
|
||||
(if (string-match (car my-pair) buffer-file-name)
|
||||
(funcall (cdr my-pair)))))
|
||||
|
||||
(defun xe/tabnew-shell ()
|
||||
"Opens a shell in a new tab (tmux Control-b c)."
|
||||
(tab-bar-new-tab 1)
|
||||
(vterm)
|
||||
(evil-set-initial-state 'vterm-mode 'emacs)
|
||||
(rename-uniquely))
|
||||
|
||||
(provide 'xe-tools)
|
||||
;;; xe-tools.el ends here
|
||||
|
|
|
@ -16,6 +16,20 @@ in {
|
|||
function fish_greeting;end
|
||||
'';
|
||||
|
||||
".config/fish/functions/vterm_printf.fish".text = ''
|
||||
function vterm_printf;
|
||||
if begin; [ -n "$TMUX" ] ; and string match -q -r "screen|tmux" "$TERM"; end
|
||||
# tell tmux to pass the escape sequences through
|
||||
printf "\ePtmux;\e\e]%s\007\e\\" "$argv"
|
||||
else if string match -q -- "screen*" "$TERM"
|
||||
# GNU screen (screen, screen-256color, screen-256color-bce)
|
||||
printf "\eP\e]%s\007\e\\" "$argv"
|
||||
else
|
||||
printf "\e]%s\e\\" "$argv"
|
||||
end
|
||||
end
|
||||
'';
|
||||
|
||||
".config/fish/functions/fish_prompt.fish".source = ./fish_prompt.fish;
|
||||
".config/fish/functions/fish_right_prompt.fish".source =
|
||||
./fish_right_prompt.fish;
|
||||
|
@ -59,6 +73,31 @@ in {
|
|||
# Set GPG TTY
|
||||
set -x GPG_TTY (tty)
|
||||
'';
|
||||
|
||||
".config/fish/conf.d/emacs.fish".text = ''
|
||||
if [ "$INSIDE_EMACS" = 'vterm' ]
|
||||
function clear
|
||||
vterm_printf "51;Evterm-clear-scrollback";
|
||||
tput clear;
|
||||
end
|
||||
|
||||
function e
|
||||
vterm_printf "51;Efind-file";
|
||||
end
|
||||
|
||||
function vterm_prompt_end;
|
||||
vterm_printf '51;A'(whoami)'@'(hostname)':'(pwd)
|
||||
end
|
||||
functions --copy fish_prompt vterm_old_fish_prompt
|
||||
function fish_prompt --description 'Write out the prompt; do not replace this. Instead, put this at end of your file.'
|
||||
# Remove the trailing newline from the original prompt. This is done
|
||||
# using the string builtin from fish, but to make sure any escape codes
|
||||
# are correctly interpreted, use %b for printf.
|
||||
printf "%b" (string join "\n" (vterm_old_fish_prompt))
|
||||
vterm_prompt_end
|
||||
end
|
||||
end
|
||||
'';
|
||||
};
|
||||
|
||||
home.packages = [ pkgs.fishPlugins.foreign-env ];
|
||||
|
|
Loading…
Reference in New Issue