Skip to content

Instantly share code, notes, and snippets.

@fredcamps
Last active March 8, 2021 22:36
Show Gist options
  • Save fredcamps/d1721de33ce8371e5e1e586a0dee5a8a to your computer and use it in GitHub Desktop.
Save fredcamps/d1721de33ce8371e5e1e586a0dee5a8a to your computer and use it in GitHub Desktop.
~/.config/fish/conf.d/
# aliases
alias omfrc="$EDITOR $HOME/.local/share/omf/init.fish"
alias terminalrc="$EDITOR $HOME/.config/xfce4/terminal/terminalrc"
alias esudo="sudo -e $EDITOR"
eval (direnv hook fish)
set --export SHELL /usr/bin/fish
set --export TERM xterm-24bits
set --export LC_ALL en_US.UTF-8
set --export LANG "en_US.UTF-8"
set --export LANGUAGE "en_US.UTF-8"
set --export EDITOR "/usr/bin/emacs"
set --export SUDO_EDITOR "/usr/bin/emacs"
set --export VISUAL "/usr/bin/emacs"
set --export PAGER "less"
set --export LOCAL_EXEC_PATH "$HOME/.local/bin"
set --export PATH $PATH "$LOCAL_EXEC_PATH"
set --export POETRY_VIRTUALENVS_PATH "$HOME/.local/share/virtualenvs"
set --export WORKON_HOME "$HOME/.local/share/virtualenvs"
fish_ssh_agent
set --export VIRTUALFISH_HOME "$WORKON_HOME"
if [ "$INSIDE_EMACS" = 'vterm' ]
function clear
vterm_printf "51;Evterm-clear-scrollback";
tput clear;
end
function vterm_printf;
if [ -n "$TMUX" ]
# tell tmux to pass the escape sequences through
# (Source: http://permalink.gmane.org/gmane.comp.terminal-emulators.tmux.user/1324)
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
function vterm_cmd --description 'Run an emacs command among the ones been defined in vterm-eval-cmds.';
set -l vterm_elisp ()
for arg in $argv
set -a vterm_elisp (printf '"%s" ' (string replace -a -r '([\\\\"])' '\\\\\\\\$1' $arg))
end
vterm_printf '51;E'(string join '' $vterm_elisp)
end
function say --description 'Display message';
vterm_cmd message "%s" "$argv"
end
function vterm_open --description 'Open file inside editor';
set -q argv[1]; or set argv[1] "."
vterm_cmd find-file (realpath "$argv")
end
function fish_title;
hostname
echo ":"
pwd
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
set --export EDITOR vterm_open
alias emacs=vterm_open
alias emacsclient=vterm_open
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment