First draft of xonshrc
This commit is contained in:
@@ -24,6 +24,7 @@ targeted = {
|
||||
"alacritty": ".config/alacritty",
|
||||
"i3": ".config/i3",
|
||||
"compton.conf": ".config/compton.conf",
|
||||
"xonsh/rc.xsh": ".xonshrc",
|
||||
}
|
||||
|
||||
|
||||
|
||||
88
xonsh/rc.xsh
Normal file
88
xonsh/rc.xsh
Normal file
@@ -0,0 +1,88 @@
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
from typing import List
|
||||
from xonsh.platform import ON_DARWIN, ON_LINUX
|
||||
|
||||
_xontribs = [
|
||||
"vox",
|
||||
]
|
||||
|
||||
if _xontribs:
|
||||
xontrib load @(_xontribs)
|
||||
|
||||
$XONSH_HISTORY_BACKEND = "sqlite"
|
||||
$HISTCONTROL = "ignoredups"
|
||||
$MULTILINE_PROMPT = " "
|
||||
|
||||
aliases["-"] = "cd -"
|
||||
aliases[".."] = "cd .."
|
||||
aliases["..."] = "cd ../.."
|
||||
$AUTO_CD = True
|
||||
|
||||
$MANPAGER = "less -X"
|
||||
$LESS = "--ignore-case --quit-if-one-screen --QUIET --RAW-CONTROL-CHARS"
|
||||
|
||||
# ============
|
||||
# Basics, etc…
|
||||
# ============
|
||||
|
||||
$EDITOR = "emacsclient"
|
||||
$ALTERNATE_EDITOR = "vim"
|
||||
$TERMINAL = "kitty"
|
||||
|
||||
def ensure_path(*paths: List[str]):
|
||||
for p in paths:
|
||||
abs_p = str(Path(p).expanduser().absolute())
|
||||
if abs_p not in $PATH:
|
||||
$PATH.append(abs_p)
|
||||
|
||||
ensure_path("~/.dotfiles/bin", "~/.local/bin", "~/bin", "~/.eamcs.d/bin")
|
||||
|
||||
config_dir = Path.home() / ".dotfiles" / "xonsh"
|
||||
|
||||
if (config_dir / "local.xsh").exists():
|
||||
source @(config_dir / "local.xsh")
|
||||
|
||||
aliases["ec"] = "emacsclient -n --alternate-editor=emacs"
|
||||
aliases["src"] = "source ~/.xonshrc"
|
||||
aliases["pubip"] = "curl icanhazip.com"
|
||||
aliases['ll'] = lambda args: $[$LC_COLLATE='C' ls -lAh @(args)]
|
||||
|
||||
if ON_DARWIN:
|
||||
$JAVA_HOME = $(/usr/libexec/java_home).strip()
|
||||
|
||||
if ON_LINUX:
|
||||
aliases["pulsefix"] = "pulseaudio --kill; pulseaudio --start"
|
||||
|
||||
def find_venv():
|
||||
d = Path.cwd()
|
||||
|
||||
while True:
|
||||
if (d / "venv").exists():
|
||||
vox activate @(str(d / "venv"))
|
||||
return True
|
||||
|
||||
if d == d.parent or (d / ".git").exists():
|
||||
print("Could not find venv.")
|
||||
return False
|
||||
|
||||
d = d.parent
|
||||
|
||||
|
||||
aliases["vv"] = find_venv
|
||||
|
||||
# # Hybrid Vi Mode
|
||||
# set -g fish_key_bindings hybrid_bindings
|
||||
|
||||
# # Fix prompt for Emacs TRAMP
|
||||
# # https://github.com/oh-my-fish/theme-bobthefish/issues/148
|
||||
# if test "$TERM" = "dumb"
|
||||
# function fish_prompt
|
||||
# echo "\$ "
|
||||
# end
|
||||
# function fish_right_prompt; end
|
||||
# function fish_greeting; end
|
||||
# function fish_title; end
|
||||
# end
|
||||
|
||||
# autojump equivalent
|
||||
Reference in New Issue
Block a user