Add bass and change theme to l #fishshell
This commit is contained in:
@ -6,6 +6,7 @@ SET FZF_PREVIEW_DIR_CMD:ls
|
||||
SET FZF_PREVIEW_FILE_CMD:head\x20\x2dn\x2010
|
||||
SET FZF_TMUX_HEIGHT:40\x25
|
||||
SET_EXPORT TERM:screen\x2d256color
|
||||
SET THEME_EDEN_PROMPT_CHAR:\u00bb
|
||||
SET ZO_CMD:zo
|
||||
SET Z_CMD:z
|
||||
SET Z_DATA:/Users/colinpowell/\x2elocal/share/z/data
|
||||
@ -15,6 +16,14 @@ SET __fish_init_2_39_8:\x1d
|
||||
SET __fish_init_2_3_0:\x1d
|
||||
SET __tf_func:function\x20__tf_alias\x20\x2dd\x20\x22Correct\x20your\x20previous\x20console\x20command\x22\x3b\x20\x20set\x20\x2dl\x20fucked_up_command\x20\x24history\x5b1\x5d\x3b\x20\x20env\x20TF_SHELL\x3dfish\x20TF_ALIAS\x3d__tf_alias\x20PYTHONIOENCODING\x3dutf\x2d8\x20thefuck\x20\x24fucked_up_command\x20\x7c\x20read\x20\x2dl\x20unfucked_command\x3b\x20\x20if\x20\x5b\x20\x22\x24unfucked_command\x22\x20\x21\x3d\x20\x22\x22\x20\x5d\x3b\x20\x20\x20\x20eval\x20\x24unfucked_command\x3b\x20\x20\x20\x20builtin\x20history\x20delete\x20\x2d\x2dexact\x20\x2d\x2dcase\x2dsensitive\x20\x2d\x2d\x20\x24fucked_up_command\x3b\x20\x20\x20\x20builtin\x20history\x20merge\x20\x5e\x20/dev/null\x3b\x20\x20end\x3bend\x3b
|
||||
SET __tf_vers:The\x20Fuck\x203\x2e28\x20using\x20Python\x203\x2e7\x2e1\x20and\x20Fish\x20Shell\x202\x2e7\x2e1
|
||||
SET budspencer_colors:000000\x1e083743\x1e445659\x1efdf6e3\x1eb58900\x1ecb4b16\x1edc121f\x1eaf005f\x1e6c71c4\x1e268bd2\x1e2aa198\x1e859900
|
||||
SET budspencer_cursors:\x5c033\x5d12\x3b\x23268bd2\x5c007\x1e\x5c033\x5d12\x3b\x23b58900\x5c007\x1e\x5c033\x5d12\x3b\x23af005f\x5c007\x1e\x5c033\x5d12\x3b\x236c71c4\x5c007
|
||||
SET budspencer_day:000000\x1e333333\x1e666666\x1effffff\x1effff00\x1eff6600\x1eff0000\x1eff0033\x1e3300ff\x1e00aaff\x1e00ffff\x1e00ff00
|
||||
SET budspencer_night:000000\x1e083743\x1e445659\x1efdf6e3\x1eb58900\x1ecb4b16\x1edc121f\x1eaf005f\x1e6c71c4\x1e268bd2\x1e2aa198\x1e859900
|
||||
SET budspencer_nocmdhist:c\x1ed\x1ell\x1els\x1em\x1es
|
||||
SET budspencer_pwdstyle:short\x1elong\x1enone
|
||||
SET budspencer_sessions_active:\x1d
|
||||
SET budspencer_sessions_active_pid:\x1d
|
||||
SET chain_links:chain\x2elinks\x2eroot\x1echain\x2elinks\x2ejobs\x1echain\x2elinks\x2epwd\x1echain\x2elinks\x2evcs_branch\x1echain\x2elinks\x2evcs_dirty\x1echain\x2elinks\x2evcs_stashed
|
||||
SET dangerous_nocmdhist:c\x1ed\x1ell\x1els\x1em\x1es
|
||||
SET dangerous_pwdstyle:short\x1elong\x1enone
|
||||
@ -41,9 +50,10 @@ SET fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack
|
||||
SET fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack
|
||||
SET fish_color_user:brgreen
|
||||
SET fish_color_valid_path:\x2d\x2dunderline
|
||||
SET fish_greeting:Welcome\x20to\x20fish\x2c\x20the\x20friendly\x20interactive\x20shell
|
||||
SET fish_greeting:\x1d
|
||||
SET fish_key_bindings:fish_vi_key_bindings
|
||||
SET fish_pager_color_completion:\x1d
|
||||
SET fish_pager_color_description:B3A06D\x1eyellow
|
||||
SET fish_pager_color_prefix:white\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
|
||||
SET fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
|
||||
SET yimmy_solarized:true
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
jethrokuan/z
|
||||
jethrokuan/fzf
|
||||
simnalamburt/shellder
|
||||
fishgretel/fasd
|
||||
2m/fish-gpg-tty
|
||||
asdf-vm/asdf
|
||||
oh-my-fish/theme-cmorrell.com
|
||||
edc/bass
|
||||
oh-my-fish/theme-l
|
||||
|
||||
98
config/fish/functions/__bass.py
Normal file
98
config/fish/functions/__bass.py
Normal file
@ -0,0 +1,98 @@
|
||||
"""
|
||||
To be used with a companion fish function like this:
|
||||
|
||||
function refish
|
||||
set -l _x (python /tmp/bass.py source ~/.nvm/nvim.sh ';' nvm use iojs); source $_x; and rm -f $_x
|
||||
end
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import json
|
||||
import subprocess
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
|
||||
BASH = 'bash'
|
||||
|
||||
def comment(string):
|
||||
return '\n'.join(['# ' + line for line in string.split('\n')])
|
||||
|
||||
def gen_script():
|
||||
divider = '-__-__-__bass___-env-output-__bass_-__-__-__-__'
|
||||
|
||||
# Use the following instead of /usr/bin/env to read environment so we can
|
||||
# deal with multi-line environment variables (and other odd cases).
|
||||
env_reader = "python -c 'import os,json; print(json.dumps({k:v for k,v in os.environ.items()}))'"
|
||||
args = [BASH, '-c', env_reader]
|
||||
output = subprocess.check_output(args, universal_newlines=True)
|
||||
old_env = output.strip()
|
||||
|
||||
command = '{} && (echo "{}"; {}; echo "{}"; alias)'.format(
|
||||
' '.join(sys.argv[1:]).rstrip().rstrip(';'),
|
||||
divider,
|
||||
env_reader,
|
||||
divider,
|
||||
)
|
||||
args = [BASH, '-c', command]
|
||||
output = subprocess.check_output(args, universal_newlines=True)
|
||||
stdout, new_env, alias = output.split(divider, 2)
|
||||
new_env = new_env.strip()
|
||||
|
||||
old_env = json.loads(old_env)
|
||||
new_env = json.loads(new_env)
|
||||
|
||||
script_lines = []
|
||||
|
||||
for line in stdout.splitlines():
|
||||
# some outputs might use documentation about the shell usage with dollar signs
|
||||
line = line.replace(r'$', r'\$')
|
||||
script_lines.append("printf %s;printf '\\n'" % json.dumps(line))
|
||||
for k, v in new_env.items():
|
||||
if k in ['PS1', 'SHLVL', 'XPC_SERVICE_NAME'] or k.startswith("BASH_FUNC"):
|
||||
continue
|
||||
v1 = old_env.get(k)
|
||||
if not v1:
|
||||
script_lines.append(comment('adding %s=%s' % (k, v)))
|
||||
elif v1 != v:
|
||||
script_lines.append(comment('updating %s=%s -> %s' % (k, v1, v)))
|
||||
# process special variables
|
||||
if k == 'PWD':
|
||||
script_lines.append('cd %s' % json.dumps(v))
|
||||
continue
|
||||
else:
|
||||
continue
|
||||
if k == 'PATH':
|
||||
# use json.dumps to reliably escape quotes and backslashes
|
||||
value = ' '.join([json.dumps(directory)
|
||||
for directory in v.split(':')])
|
||||
else:
|
||||
# use json.dumps to reliably escape quotes and backslashes
|
||||
value = json.dumps(v)
|
||||
script_lines.append('set -g -x %s %s' % (k, value))
|
||||
|
||||
for var in set(old_env.keys()) - set(new_env.keys()):
|
||||
script_lines.append(comment('removing %s' % var))
|
||||
script_lines.append('set -e %s' % var)
|
||||
|
||||
script = '\n'.join(script_lines)
|
||||
|
||||
return script + '\n' + alias
|
||||
|
||||
if not sys.argv[1:]:
|
||||
print('__usage', end='')
|
||||
sys.exit(0)
|
||||
|
||||
try:
|
||||
script = gen_script()
|
||||
except subprocess.CalledProcessError as e:
|
||||
print('exit code:', e.returncode, file=sys.stderr)
|
||||
print('__error', e.returncode, end='')
|
||||
except Exception as e:
|
||||
print('unknown error:', str(e), file=sys.stderr)
|
||||
traceback.print_exc(10, file=sys.stderr)
|
||||
print('__error', end='')
|
||||
else:
|
||||
print(script, end='')
|
||||
27
config/fish/functions/bass.fish
Normal file
27
config/fish/functions/bass.fish
Normal file
@ -0,0 +1,27 @@
|
||||
function bass
|
||||
set __bash_args $argv
|
||||
if test "$__bash_args[1]_" = '-d_'
|
||||
set __bass_debug
|
||||
set -e __bash_args[1]
|
||||
end
|
||||
|
||||
python (dirname (status -f))/__bass.py $__bash_args | read -z __script
|
||||
set __errorflag (string sub -s 1 -l 7 "$__script")
|
||||
if test "$__script" = '__usage'
|
||||
echo "Usage: bass [-d] <bash-command>"
|
||||
else if test "x$__errorflag" = 'x__error'
|
||||
echo "Bass encountered an error!"
|
||||
set __exitcode (string sub -s 9 "$__script")
|
||||
set __exitcode (string trim $__exitcode)
|
||||
if test -z $__exitcode
|
||||
return 1
|
||||
else
|
||||
return $__exitcode
|
||||
end
|
||||
else
|
||||
echo -e "$__script" | source -
|
||||
if set -q __bass_debug
|
||||
echo "$__script"
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -1,15 +0,0 @@
|
||||
function fish_mode_prompt
|
||||
if test "$fish_key_bindings" = "fish_vi_key_bindings"
|
||||
or test "$fish_key_bindings" = "fish_hybrid_key_bindings"
|
||||
switch $fish_bind_mode
|
||||
case default
|
||||
prompt_segment blue black "N"
|
||||
case insert
|
||||
prompt_segment green black "I"
|
||||
case replace_one
|
||||
prompt_segment red black "R"
|
||||
case visual
|
||||
prompt_segment magenta black "V"
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -1,29 +1,37 @@
|
||||
# To show the right prompt please set
|
||||
# set theme_display_rbenv 'yes' (config.fish)
|
||||
# set theme_display_rbenv_gemset 'yes' (config.fish)
|
||||
# set theme_display_rbenv_with_gemfile_only 'yes' (config.fish)
|
||||
|
||||
function get_git_status -d "Gets the current git status"
|
||||
if command git rev-parse --is-inside-work-tree >/dev/null 2>&1
|
||||
set -l dirty (command git status -s --ignore-submodules=dirty | wc -l | sed -e 's/^ *//' -e 's/ *$//' 2> /dev/null)
|
||||
set -l ref (command git describe --tags --exact-match ^/dev/null ; or command git symbolic-ref --short HEAD 2> /dev/null ; or command git rev-parse --short HEAD 2> /dev/null)
|
||||
|
||||
if [ "$dirty" != "0" ]
|
||||
set_color -b normal
|
||||
set_color red
|
||||
echo "$dirty changed file"
|
||||
if [ "$dirty" != "1" ]
|
||||
echo "s"
|
||||
end
|
||||
echo " "
|
||||
set_color -b red
|
||||
set_color white
|
||||
else
|
||||
set_color -b cyan
|
||||
set_color white
|
||||
end
|
||||
|
||||
echo " $ref "
|
||||
set_color normal
|
||||
end
|
||||
function _ruby_version
|
||||
echo (command rbenv version-name | sed 's/\n//')
|
||||
end
|
||||
|
||||
function fish_right_prompt -d "Prints right prompt"
|
||||
get_git_status
|
||||
end
|
||||
function _ruby_gemset
|
||||
echo (command rbenv gemset active ^/dev/null | sed -e 's| global||')
|
||||
end
|
||||
|
||||
function fish_right_prompt
|
||||
if [ "$theme_display_rbenv" = 'yes' ]
|
||||
set -l red (set_color red)
|
||||
set -l normal (set_color normal)
|
||||
set ruby_info $red(_ruby_version)
|
||||
|
||||
if [ "$theme_display_rbenv_gemset" = 'yes' ]
|
||||
if [ (_ruby_gemset) ]
|
||||
set -l ruby_gemset $red(_ruby_gemset)
|
||||
set ruby_info "$ruby_info@$ruby_gemset"
|
||||
end
|
||||
end
|
||||
|
||||
if [ "$theme_display_rbenv_with_gemfile_only" = 'yes' ]
|
||||
if test -f Gemfile
|
||||
echo -n -s $ruby_info $normal
|
||||
else
|
||||
echo -n -s $normal
|
||||
end
|
||||
else
|
||||
echo -n -s $ruby_info $normal
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user