mirror of
https://github.com/DerTyp7/.dotfiles.git
synced 2025-10-28 12:32:08 +01:00
Add fish configs
This commit is contained in:
1
fish/conf.d/rustup.fish
Normal file
1
fish/conf.d/rustup.fish
Normal file
@@ -0,0 +1 @@
|
||||
source "$HOME/.cargo/env.fish"
|
||||
9
fish/config.fish
Normal file
9
fish/config.fish
Normal file
@@ -0,0 +1,9 @@
|
||||
source /usr/share/cachyos-fish-config/cachyos-config.fish
|
||||
|
||||
# overwrite greeting
|
||||
# potentially disabling fastfetch
|
||||
|
||||
function fish_greeting
|
||||
end
|
||||
|
||||
set -gx NVM_DIR ~/.nvm
|
||||
1
fish/fish_plugins
Normal file
1
fish/fish_plugins
Normal file
@@ -0,0 +1 @@
|
||||
edc/bass
|
||||
102
fish/fish_variables
Normal file
102
fish/fish_variables
Normal file
@@ -0,0 +1,102 @@
|
||||
# This file contains fish universal variable definitions.
|
||||
# VERSION: 3.0
|
||||
SETUVAR __done_min_cmd_duration:10000
|
||||
SETUVAR __done_notification_urgency_level:low
|
||||
SETUVAR __fish_initialized:3800
|
||||
SETUVAR _fisher_edc_2F_bass_files:\x7e/\x2econfig/fish/functions/__bass\x2epy\x1e\x7e/\x2econfig/fish/functions/bass\x2efish
|
||||
SETUVAR _fisher_plugins:edc/bass
|
||||
SETUVAR _fisher_upgraded_to_4_4:\x1d
|
||||
SETUVAR fish_color_autosuggestion:brblack
|
||||
SETUVAR fish_color_cancel:\x2dr
|
||||
SETUVAR fish_color_command:normal
|
||||
SETUVAR fish_color_comment:red
|
||||
SETUVAR fish_color_cwd:green
|
||||
SETUVAR fish_color_cwd_root:red
|
||||
SETUVAR fish_color_end:green
|
||||
SETUVAR fish_color_error:brred
|
||||
SETUVAR fish_color_escape:brcyan
|
||||
SETUVAR fish_color_history_current:\x2d\x2dbold
|
||||
SETUVAR fish_color_host:normal
|
||||
SETUVAR fish_color_host_remote:yellow
|
||||
SETUVAR fish_color_normal:normal
|
||||
SETUVAR fish_color_operator:brcyan
|
||||
SETUVAR fish_color_param:cyan
|
||||
SETUVAR fish_color_quote:yellow
|
||||
SETUVAR fish_color_redirection:cyan\x1e\x2d\x2dbold
|
||||
SETUVAR fish_color_search_match:white\x1e\x2d\x2dbackground\x3dbrblack
|
||||
SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack
|
||||
SETUVAR fish_color_status:red
|
||||
SETUVAR fish_color_user:brgreen
|
||||
SETUVAR fish_color_valid_path:\x2d\x2dunderline
|
||||
SETUVAR fish_key_bindings:fish_default_key_bindings
|
||||
SETUVAR fish_pager_color_completion:normal
|
||||
SETUVAR fish_pager_color_description:yellow\x1e\x2di
|
||||
SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
|
||||
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
|
||||
SETUVAR fish_pager_color_selected_background:\x2dr
|
||||
SETUVAR pure_begin_prompt_with_current_directory:true
|
||||
SETUVAR pure_check_for_new_release:false
|
||||
SETUVAR pure_color_at_sign:pure_color_mute
|
||||
SETUVAR pure_color_aws_profile:pure_color_warning
|
||||
SETUVAR pure_color_command_duration:pure_color_warning
|
||||
SETUVAR pure_color_current_directory:pure_color_primary
|
||||
SETUVAR pure_color_danger:red
|
||||
SETUVAR pure_color_dark:black
|
||||
SETUVAR pure_color_git_branch:pure_color_mute
|
||||
SETUVAR pure_color_git_dirty:pure_color_mute
|
||||
SETUVAR pure_color_git_stash:pure_color_info
|
||||
SETUVAR pure_color_git_unpulled_commits:pure_color_info
|
||||
SETUVAR pure_color_git_unpushed_commits:pure_color_info
|
||||
SETUVAR pure_color_hostname:pure_color_mute
|
||||
SETUVAR pure_color_info:cyan
|
||||
SETUVAR pure_color_jobs:pure_color_normal
|
||||
SETUVAR pure_color_k8s_context:pure_color_success
|
||||
SETUVAR pure_color_k8s_namespace:pure_color_primary
|
||||
SETUVAR pure_color_k8s_prefix:pure_color_info
|
||||
SETUVAR pure_color_light:white
|
||||
SETUVAR pure_color_mute:brblack
|
||||
SETUVAR pure_color_nixdevshell_prefix:pure_color_info
|
||||
SETUVAR pure_color_nixdevshell_symbol:pure_color_mute
|
||||
SETUVAR pure_color_normal:normal
|
||||
SETUVAR pure_color_prefix_root_prompt:pure_color_danger
|
||||
SETUVAR pure_color_primary:blue
|
||||
SETUVAR pure_color_prompt_on_error:pure_color_danger
|
||||
SETUVAR pure_color_prompt_on_success:pure_color_success
|
||||
SETUVAR pure_color_success:magenta
|
||||
SETUVAR pure_color_system_time:pure_color_mute
|
||||
SETUVAR pure_color_username_normal:pure_color_mute
|
||||
SETUVAR pure_color_username_root:pure_color_light
|
||||
SETUVAR pure_color_virtualenv:pure_color_mute
|
||||
SETUVAR pure_color_warning:yellow
|
||||
SETUVAR pure_enable_aws_profile:true
|
||||
SETUVAR pure_enable_container_detection:true
|
||||
SETUVAR pure_enable_git:true
|
||||
SETUVAR pure_enable_k8s:false
|
||||
SETUVAR pure_enable_nixdevshell:false
|
||||
SETUVAR pure_enable_single_line_prompt:false
|
||||
SETUVAR pure_enable_virtualenv:true
|
||||
SETUVAR pure_reverse_prompt_symbol_in_vimode:true
|
||||
SETUVAR pure_separate_prompt_on_error:false
|
||||
SETUVAR pure_shorten_prompt_current_directory_length:0
|
||||
SETUVAR pure_shorten_window_title_current_directory_length:0
|
||||
SETUVAR pure_show_jobs:false
|
||||
SETUVAR pure_show_prefix_root_prompt:false
|
||||
SETUVAR pure_show_subsecond_command_duration:false
|
||||
SETUVAR pure_show_system_time:false
|
||||
SETUVAR pure_symbol_aws_profile_prefix:
|
||||
SETUVAR pure_symbol_container_prefix:
|
||||
SETUVAR pure_symbol_git_dirty:\x2a
|
||||
SETUVAR pure_symbol_git_stash:\u2261
|
||||
SETUVAR pure_symbol_git_unpulled_commits:\u21e3
|
||||
SETUVAR pure_symbol_git_unpushed_commits:\u21e1
|
||||
SETUVAR pure_symbol_k8s_prefix:\u2638
|
||||
SETUVAR pure_symbol_nixdevshell_prefix:\u2744\ufe0f
|
||||
SETUVAR pure_symbol_prefix_root_prompt:\x23
|
||||
SETUVAR pure_symbol_prompt:\u276f
|
||||
SETUVAR pure_symbol_reverse_prompt:\u276e
|
||||
SETUVAR pure_symbol_ssh_prefix:
|
||||
SETUVAR pure_symbol_title_bar_separator:\x2d
|
||||
SETUVAR pure_symbol_virtualenv_prefix:
|
||||
SETUVAR pure_threshold_command_duration:5
|
||||
SETUVAR pure_truncate_prompt_current_directory_keeps:\x2d1
|
||||
SETUVAR pure_truncate_window_title_current_directory_keeps:\x2d1
|
||||
140
fish/functions/__bass.py
Normal file
140
fish/functions/__bass.py
Normal file
@@ -0,0 +1,140 @@
|
||||
"""
|
||||
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 os
|
||||
import signal
|
||||
import subprocess
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
|
||||
BASH = 'bash'
|
||||
|
||||
FISH_READONLY = [
|
||||
'PWD', 'SHLVL', 'history', 'pipestatus', 'status', 'version',
|
||||
'FISH_VERSION', 'fish_pid', 'hostname', '_', 'fish_private_mode'
|
||||
]
|
||||
|
||||
IGNORED = [
|
||||
'PS1', 'XPC_SERVICE_NAME'
|
||||
]
|
||||
|
||||
def ignored(name):
|
||||
if name == 'PWD': # this is read only, but has special handling
|
||||
return False
|
||||
# ignore other read only variables
|
||||
if name in FISH_READONLY:
|
||||
return True
|
||||
if name in IGNORED or name.startswith("BASH_FUNC"):
|
||||
return True
|
||||
if name.startswith('%'):
|
||||
return True
|
||||
return False
|
||||
|
||||
def escape(string):
|
||||
# use json.dumps to reliably escape quotes and backslashes
|
||||
return json.dumps(string).replace(r'$', r'\$')
|
||||
|
||||
def escape_identifier(word):
|
||||
return escape(word.replace('?', '\\?'))
|
||||
|
||||
def comment(string):
|
||||
return '\n'.join(['# ' + line for line in string.split('\n')])
|
||||
|
||||
def gen_script():
|
||||
# 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 = "%s -c 'import os,json; print(json.dumps({k:v for k,v in os.environ.items()}))'" % (sys.executable)
|
||||
args = [BASH, '-c', env_reader]
|
||||
output = subprocess.check_output(args, universal_newlines=True)
|
||||
old_env = output.strip()
|
||||
|
||||
pipe_r, pipe_w = os.pipe()
|
||||
if sys.version_info >= (3, 4):
|
||||
os.set_inheritable(pipe_w, True)
|
||||
command = 'eval $1 && ({}; alias) >&{}'.format(
|
||||
env_reader,
|
||||
pipe_w
|
||||
)
|
||||
args = [BASH, '-c', command, 'bass', ' '.join(sys.argv[1:])]
|
||||
p = subprocess.Popen(args, universal_newlines=True, close_fds=False)
|
||||
os.close(pipe_w)
|
||||
with os.fdopen(pipe_r) as f:
|
||||
new_env = f.readline()
|
||||
alias_str = f.read()
|
||||
if p.wait() != 0:
|
||||
raise subprocess.CalledProcessError(
|
||||
returncode=p.returncode,
|
||||
cmd=' '.join(sys.argv[1:]),
|
||||
output=new_env + alias_str
|
||||
)
|
||||
new_env = new_env.strip()
|
||||
|
||||
old_env = json.loads(old_env)
|
||||
new_env = json.loads(new_env)
|
||||
|
||||
script_lines = []
|
||||
|
||||
for k, v in new_env.items():
|
||||
if ignored(k):
|
||||
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' % escape(v))
|
||||
continue
|
||||
else:
|
||||
continue
|
||||
if k == 'PATH':
|
||||
value = ' '.join([escape(directory)
|
||||
for directory in v.split(':')])
|
||||
else:
|
||||
value = escape(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)
|
||||
|
||||
alias_lines = []
|
||||
for line in alias_str.splitlines():
|
||||
_, rest = line.split(None, 1)
|
||||
k, v = rest.split("=", 1)
|
||||
alias_lines.append("alias " + escape_identifier(k) + "=" + v)
|
||||
alias = '\n'.join(alias_lines)
|
||||
|
||||
return script + '\n' + alias
|
||||
|
||||
script_file = os.fdopen(3, 'w')
|
||||
|
||||
if not sys.argv[1:]:
|
||||
print('__bass_usage', file=script_file, end='')
|
||||
sys.exit(0)
|
||||
|
||||
try:
|
||||
script = gen_script()
|
||||
except subprocess.CalledProcessError as e:
|
||||
sys.exit(e.returncode)
|
||||
except Exception:
|
||||
print('Bass internal error!', file=sys.stderr)
|
||||
raise # traceback will output to stderr
|
||||
except KeyboardInterrupt:
|
||||
signal.signal(signal.SIGINT, signal.SIG_DFL)
|
||||
os.kill(os.getpid(), signal.SIGINT)
|
||||
else:
|
||||
script_file.write(script)
|
||||
29
fish/functions/bass.fish
Normal file
29
fish/functions/bass.fish
Normal file
@@ -0,0 +1,29 @@
|
||||
function bass
|
||||
set -l bash_args $argv
|
||||
set -l bass_debug
|
||||
if test "$bash_args[1]_" = '-d_'
|
||||
set bass_debug true
|
||||
set -e bash_args[1]
|
||||
end
|
||||
|
||||
set -l script_file (mktemp)
|
||||
if command -v python3 >/dev/null 2>&1
|
||||
command python3 -sS (dirname (status -f))/__bass.py $bash_args 3>$script_file
|
||||
else
|
||||
command python -sS (dirname (status -f))/__bass.py $bash_args 3>$script_file
|
||||
end
|
||||
set -l bass_status $status
|
||||
if test $bass_status -ne 0
|
||||
return $bass_status
|
||||
end
|
||||
|
||||
if test -n "$bass_debug"
|
||||
cat $script_file
|
||||
end
|
||||
source $script_file
|
||||
command rm $script_file
|
||||
end
|
||||
|
||||
function __bass_usage
|
||||
echo "Usage: bass [-d] <bash-command>"
|
||||
end
|
||||
3
fish/functions/nvm.fish
Normal file
3
fish/functions/nvm.fish
Normal file
@@ -0,0 +1,3 @@
|
||||
function nvm
|
||||
bass source ~/.nvm/nvm.sh --no-use ';' nvm $argv
|
||||
end
|
||||
Reference in New Issue
Block a user