Compare commits
22 Commits
f54f8bd5a8
...
main
Author | SHA1 | Date | |
---|---|---|---|
1101759176
|
|||
04ce9dcae0
|
|||
043d35f0d8
|
|||
88ea9997d5
|
|||
44016ea366
|
|||
db877d5f41
|
|||
d1053c6541
|
|||
ef43de9101
|
|||
068dd457d8
|
|||
b6c3430e20
|
|||
39c2f883e7
|
|||
950d1a928e
|
|||
2e449c15bd
|
|||
a337d579ec
|
|||
f230e41216
|
|||
946c21e03f
|
|||
f27cf30bd9
|
|||
8cb46e9a92
|
|||
b1b24ba1ed
|
|||
d4e51b6cd2
|
|||
dc30944a89
|
|||
a500a63a53
|
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
||||
/janus/*
|
||||
byobu/.ssh-agent
|
||||
*.sqlite
|
||||
|
1
.python-version
Normal file
1
.python-version
Normal file
@@ -0,0 +1 @@
|
||||
3.12.0
|
@@ -1,5 +1,3 @@
|
||||
import = ["~/.config/alacritty/themes/themes/tender.toml"]
|
||||
live_config_reload = true
|
||||
|
||||
[bell]
|
||||
animation = "EaseOutExpo"
|
||||
@@ -579,7 +577,7 @@ multiplier = 3
|
||||
save_to_clipboard = false
|
||||
semantic_escape_chars = ",│`|:\"' ()[]{}<>"
|
||||
|
||||
[shell]
|
||||
[terminal.shell]
|
||||
args = ["-l"]
|
||||
program = "/bin/zsh"
|
||||
|
||||
@@ -593,3 +591,9 @@ startup_mode = "Windowed"
|
||||
[window.padding]
|
||||
x = 2
|
||||
y = 2
|
||||
|
||||
[general]
|
||||
live_config_reload = true
|
||||
import = ["~/.config/alacritty/themes/themes/tender.toml"]
|
||||
|
||||
[terminal]
|
||||
|
48
config/ghostty/config
Normal file
48
config/ghostty/config
Normal file
@@ -0,0 +1,48 @@
|
||||
# This is the configuration file for Ghostty.
|
||||
#
|
||||
# This template file has been automatically created at the following
|
||||
# path since Ghostty couldn't find any existing config files on your system:
|
||||
#
|
||||
# /home/me/.config/ghostty/config
|
||||
#
|
||||
# The template does not set any default options, since Ghostty ships
|
||||
# with sensible defaults for all options. Users should only need to set
|
||||
# options that they want to change from the default.
|
||||
#
|
||||
# Run `ghostty +show-config --default --docs` to view a list of
|
||||
# all available config options and their default values.
|
||||
#
|
||||
# Additionally, each config option is also explained in detail
|
||||
# on Ghostty's website, at https://ghostty.org/docs/config.
|
||||
|
||||
# Config syntax crash course
|
||||
# ==========================
|
||||
# # The config file consists of simple key-value pairs,
|
||||
# # separated by equals signs.
|
||||
# font-family = Iosevka
|
||||
# window-padding-x = 2
|
||||
#
|
||||
# # Spacing around the equals sign does not matter.
|
||||
# # All of these are identical:
|
||||
# key=value
|
||||
# key= value
|
||||
# key =value
|
||||
# key = value
|
||||
#
|
||||
# # Any line beginning with a # is a comment. It's not possible to put
|
||||
# # a comment after a config option, since it would be interpreted as a
|
||||
# # part of the value. For example, this will have a value of "#123abc":
|
||||
# background = #123abc
|
||||
#
|
||||
# # Empty values are used to reset config keys to default.
|
||||
# key =
|
||||
#
|
||||
# # Some config options have unique syntaxes for their value,
|
||||
# # which is explained in the docs for that config option.
|
||||
# # Just for example:
|
||||
# resize-overlay-duration = 4s 200ms
|
||||
|
||||
font-family = Comic Code
|
||||
font-family-bold = Comic Code Bold
|
||||
font-family-italic = Comic Code Italic
|
||||
font-family-bold-italic = Comic Code Bold Italic
|
@@ -135,7 +135,7 @@ font pango:Comic Code Bold 12
|
||||
|
||||
xwayland enable
|
||||
|
||||
set $term alacritty
|
||||
set $term ghostty
|
||||
|
||||
exec swayidle -w \
|
||||
timeout 300 'swaylock -f -c 000000' \
|
||||
|
@@ -69,7 +69,7 @@
|
||||
forceSignAnnotated = true
|
||||
|
||||
[gpg]
|
||||
program = gpg2
|
||||
program = gpg-sq
|
||||
|
||||
[init]
|
||||
templatedir = ~/.config/git_template
|
||||
|
1337
ipython/profile_default/ipython_config.py
Normal file
1337
ipython/profile_default/ipython_config.py
Normal file
File diff suppressed because it is too large
Load Diff
11
ipython/profile_default/startup/README
Normal file
11
ipython/profile_default/startup/README
Normal file
@@ -0,0 +1,11 @@
|
||||
This is the IPython startup directory
|
||||
|
||||
.py and .ipy files in this directory will be run *prior* to any code or files specified
|
||||
via the exec_lines or exec_files configurables whenever you load this profile.
|
||||
|
||||
Files will be run in lexicographical order, so you can control the execution order of files
|
||||
with a prefix, e.g.::
|
||||
|
||||
00-first.py
|
||||
50-middle.py
|
||||
99-last.ipy
|
27
local/bin/cb-uri-tailscale
Executable file
27
local/bin/cb-uri-tailscale
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env python3
|
||||
import subprocess
|
||||
import sys
|
||||
import urllib.parse
|
||||
|
||||
|
||||
def main(sysargs=sys.argv[:]):
|
||||
cb_uri = subprocess.check_output(["cb", "uri", *sysargs[1:]], text=True)
|
||||
|
||||
parsed_cb_uri = urllib.parse.urlsplit(cb_uri)
|
||||
tailscale_cb_uri = parsed_cb_uri._replace(
|
||||
netloc=str(parsed_cb_uri.username)
|
||||
+ ":"
|
||||
+ str(parsed_cb_uri.password)
|
||||
+ "@"
|
||||
+ str(parsed_cb_uri.hostname).split(".")[1]
|
||||
+ ":"
|
||||
+ str(parsed_cb_uri.port)
|
||||
)
|
||||
|
||||
print(tailscale_cb_uri.geturl())
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
@@ -1,97 +1,105 @@
|
||||
#!/usr/bin/env python
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import typing
|
||||
|
||||
_BITS = []
|
||||
__all__ = ["_mem", "_backlight", "_hwtemp"]
|
||||
|
||||
_BITS: list[tuple[int, str, typing.Callable]] = []
|
||||
|
||||
|
||||
def _bit(idx):
|
||||
def wrapper(func):
|
||||
_BITS.append([idx, func.__name__.replace('_', ''), func])
|
||||
_BITS.append((idx, func.__name__.replace("_", ""), func))
|
||||
return func
|
||||
|
||||
return wrapper
|
||||
|
||||
|
||||
@_bit(6)
|
||||
def _mem():
|
||||
with open('/proc/meminfo') as meminfo_fp:
|
||||
with open("/proc/meminfo") as meminfo_fp:
|
||||
attrs = {}
|
||||
for line in meminfo_fp.readlines():
|
||||
parts = line.split(':', 2)
|
||||
parts = line.split(":", 2)
|
||||
attrs[parts[0].strip()] = parts[1].strip()
|
||||
avail = int(attrs['MemAvailable'].split()[0])
|
||||
total = int(attrs['MemTotal'].split()[0])
|
||||
avail = int(attrs["MemAvailable"].split()[0])
|
||||
total = int(attrs["MemTotal"].split()[0])
|
||||
used = int(((total - avail) / total) * 100)
|
||||
color = None
|
||||
if used > 75:
|
||||
color = '#ff0000'
|
||||
color = "#ff0000"
|
||||
if used < 25:
|
||||
color = '#00ff00'
|
||||
return 'M:{}%'.format(used), color
|
||||
color = "#00ff00"
|
||||
return "M:{}%".format(used), color
|
||||
|
||||
|
||||
@_bit(0)
|
||||
def _backlight(dev_dir='/sys/class/backlight/intel_backlight'):
|
||||
with open('{}/brightness'.format(dev_dir)) as br_fp:
|
||||
with open('{}/max_brightness'.format(dev_dir)) as mb_fp:
|
||||
def _backlight(dev_dir="/sys/class/backlight/intel_backlight"):
|
||||
with open("{}/brightness".format(dev_dir)) as br_fp:
|
||||
with open("{}/max_brightness".format(dev_dir)) as mb_fp:
|
||||
value = int(br_fp.read().strip())
|
||||
max_value = int(mb_fp.read().strip())
|
||||
pct = int(float(float(value) / float(max_value)) * 100)
|
||||
color = None
|
||||
if pct >= 75:
|
||||
color = '#ffaa00'
|
||||
color = "#ffaa00"
|
||||
if pct <= 25:
|
||||
color = '#5599ff'
|
||||
return '☼:{}%'.format(pct), color
|
||||
color = "#5599ff"
|
||||
return "☼:{}%".format(pct), color
|
||||
|
||||
|
||||
THINKFAN_CONF = '/etc/thinkfan.conf'
|
||||
ACPI_IBM_FAN = '/proc/acpi/ibm/fan'
|
||||
ACPI_IBM_FAN = "/proc/acpi/ibm/fan"
|
||||
|
||||
|
||||
@_bit(7)
|
||||
def _hwtemp(conf=THINKFAN_CONF, fan=ACPI_IBM_FAN):
|
||||
if not os.path.exists(conf):
|
||||
def _hwtemp(fan=ACPI_IBM_FAN):
|
||||
acpi_exe = shutil.which("acpi")
|
||||
if acpi_exe is None:
|
||||
return None, None
|
||||
|
||||
temps = []
|
||||
raw_temp = subprocess.run(
|
||||
[acpi_exe, "-t"],
|
||||
text=True,
|
||||
capture_output=True,
|
||||
check=False,
|
||||
)
|
||||
if raw_temp.returncode != 0 or raw_temp.stdout is None:
|
||||
return None, None
|
||||
|
||||
with open('/etc/thinkfan.conf') as tfc_fp:
|
||||
for line in tfc_fp.readlines():
|
||||
if not line.startswith('hwmon '):
|
||||
continue
|
||||
try:
|
||||
with open(line.split(' ')[1].strip()) as temp_fp:
|
||||
temps.append(float(temp_fp.read()))
|
||||
except (OSError, IOError) as exc:
|
||||
sys.stderr.write(str(exc) + '\n')
|
||||
temps_by_zone = {}
|
||||
for line in raw_temp.stdout.splitlines():
|
||||
zone_id, value = line.split(":")
|
||||
human_temp = value.split(",")[-1]
|
||||
temps_by_zone[zone_id.lower().lstrip("thermal ")] = float(
|
||||
human_temp.lower().strip().rstrip("degrees c")
|
||||
)
|
||||
|
||||
avg_temp = float(sum(temps)) / len(temps) / 1000.0
|
||||
color = None
|
||||
temps = list(temps_by_zone.values())
|
||||
avg_temp = float(sum(temps)) / len(temps)
|
||||
color = "#5599ff"
|
||||
if avg_temp > 75:
|
||||
color = "#ff0000"
|
||||
if avg_temp >= 50:
|
||||
color = "#ffaa00"
|
||||
|
||||
fan_level = 'unset'
|
||||
fan_level = "unset"
|
||||
try:
|
||||
with open(fan) as fan_fp:
|
||||
for line in fan_fp.readlines():
|
||||
if not line.startswith('level:\t\t'):
|
||||
if not line.startswith("level:\t\t"):
|
||||
continue
|
||||
fan_level = int(line.replace('level:\t\t', ''))
|
||||
fan_level = int(line.replace("level:\t\t", ""))
|
||||
except (OSError, IOError) as exc:
|
||||
sys.stderr.write(str(exc) + '\n')
|
||||
sys.stderr.write(str(exc) + "\n")
|
||||
|
||||
if avg_temp > 75:
|
||||
color = '#ff0000'
|
||||
if avg_temp >= 50:
|
||||
color = '#ffaa00'
|
||||
if avg_temp <= 25:
|
||||
color = '#5599ff'
|
||||
return 'T:{:.1f}°C L:{}'.format(avg_temp, fan_level), color
|
||||
return "T:{:.1f}°C L:{}".format(avg_temp, fan_level), color
|
||||
|
||||
|
||||
def _print_line(message):
|
||||
sys.stdout.write(message + '\n')
|
||||
sys.stdout.write(message + "\n")
|
||||
sys.stdout.flush()
|
||||
|
||||
|
||||
@@ -110,9 +118,9 @@ def main(bits=_BITS):
|
||||
_print_line(_read_line())
|
||||
|
||||
while True:
|
||||
line, prefix = _read_line(), ''
|
||||
if line.startswith(','):
|
||||
line, prefix = line[1:], ','
|
||||
line, prefix = _read_line(), ""
|
||||
if line.startswith(","):
|
||||
line, prefix = line[1:], ","
|
||||
|
||||
loaded = json.loads(line)
|
||||
for idx, name, func in bits:
|
||||
@@ -127,11 +135,11 @@ def main(bits=_BITS):
|
||||
|
||||
loaded.insert(idx, record)
|
||||
except Exception as exc:
|
||||
sys.stderr.write(str(exc) + '\n')
|
||||
sys.stderr.write(str(exc) + "\n")
|
||||
sys.stderr.flush()
|
||||
|
||||
_print_line(prefix+json.dumps(loaded))
|
||||
_print_line(prefix + json.dumps(loaded))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
@@ -1,52 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
|
||||
main() {
|
||||
if [[ -f "${1}" ]]; then
|
||||
exec 1>"${1}"
|
||||
shift
|
||||
fi
|
||||
|
||||
if [[ -f /etc/default/thinkfan-confgen ]]; then
|
||||
source /etc/default/thinkfan-confgen
|
||||
fi
|
||||
|
||||
: "${THINKFAN_LOWER_BOUND:=30}"
|
||||
: "${THINKFAN_STEP:=4}"
|
||||
|
||||
printf '# thinkfan-confgen created %s\n' "$(date -u)"
|
||||
printf '# THINKFAN_LOWER_BOUND=%s\n' "${THINKFAN_LOWER_BOUND}"
|
||||
printf '# THINKFAN_STEP=%s\n\n' "${THINKFAN_STEP}"
|
||||
|
||||
find /sys -type f -name 'temp*_input' | while read -r line; do
|
||||
if [[ "${line}" =~ thinkpad_hwmon ]]; then
|
||||
continue
|
||||
fi
|
||||
printf 'hwmon %s\n' "${line}"
|
||||
done
|
||||
|
||||
printf '\ntp_fan /proc/acpi/ibm/fan\n\n'
|
||||
|
||||
local halfstep="$((THINKFAN_STEP / 2))"
|
||||
local cur="${THINKFAN_LOWER_BOUND}"
|
||||
|
||||
for level in 0 1 2 3 4 5 6 7; do
|
||||
if [[ "${level}" == 0 ]]; then
|
||||
printf '(0, 0, %s)\n' "${cur}"
|
||||
continue
|
||||
fi
|
||||
|
||||
if [[ "${level}" == 7 ]]; then
|
||||
printf '(7, %s, 32767)\n' "$((cur - halfstep))"
|
||||
continue
|
||||
fi
|
||||
|
||||
printf '(%s, %s, %s)\n' \
|
||||
"${level}" "$((cur - halfstep))" "$((cur + THINKFAN_STEP))"
|
||||
|
||||
cur="$((cur + THINKFAN_STEP))"
|
||||
done
|
||||
}
|
||||
|
||||
main "${@}"
|
126
local/bin/thinkfan_confgen.py
Executable file
126
local/bin/thinkfan_confgen.py
Executable file
@@ -0,0 +1,126 @@
|
||||
#!/usr/bin/env python
|
||||
import argparse
|
||||
import datetime
|
||||
import json
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
import typing
|
||||
|
||||
|
||||
class ThinkfanConfig(typing.TypedDict):
|
||||
sensors: list[dict[str, str]]
|
||||
fans: list[dict[str, str]]
|
||||
levels: list[dict[str, int | list[int]]]
|
||||
|
||||
|
||||
def main(sysargs=sys.argv[:]) -> int:
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
"-l",
|
||||
"--lower-bound",
|
||||
default=int(os.environ.get("THINKFAN_LOWER_BOUND", "30")),
|
||||
type=int,
|
||||
help="lower bound of sensor value for min fan speed (THINKFAN_LOWER_BOUND)",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-u",
|
||||
"--upper-bound",
|
||||
default=int(os.environ.get("THINKFAN_UPPER_BOUND", "32767")),
|
||||
type=int,
|
||||
help="upper bound of sensor value for max fan speed (THINKFAN_UPPER_BOUND)",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-s",
|
||||
"--step",
|
||||
default=int(os.environ.get("THINKFAN_STEP", "4")),
|
||||
type=int,
|
||||
help="step size between fan speed levels (THINKFAN_STEP)",
|
||||
)
|
||||
args = parser.parse_args(sysargs[1:])
|
||||
|
||||
cfg: ThinkfanConfig = {
|
||||
"sensors": [],
|
||||
"fans": [],
|
||||
"levels": [],
|
||||
}
|
||||
|
||||
acpi_fan = pathlib.Path("/proc/acpi/ibm/fan")
|
||||
if acpi_fan.exists():
|
||||
cfg["fans"].append({"tpacpi": str(acpi_fan)})
|
||||
|
||||
acpi_thermal = pathlib.Path("/proc/acpi/ibm/thermal")
|
||||
|
||||
n_sensors: int = 0
|
||||
|
||||
if acpi_thermal.exists():
|
||||
cfg["sensors"].append({"tpacpi": str(acpi_thermal)})
|
||||
n_sensors = len(
|
||||
[
|
||||
l
|
||||
for l in acpi_thermal.read_text().splitlines()
|
||||
if l.startswith("temperatures:")
|
||||
][0]
|
||||
.split(":")[1]
|
||||
.strip()
|
||||
.split()
|
||||
)
|
||||
|
||||
else:
|
||||
for dirpath, dirnames, filenames in pathlib.Path("/sys/devices").walk(
|
||||
on_error=print, follow_symlinks=False
|
||||
):
|
||||
if "thinkpad_hwmon" in dirnames:
|
||||
dirnames.remove("thinkpad_hwmon")
|
||||
|
||||
for filename in filenames:
|
||||
if filename.startswith("temp") and filename.endswith("_input"):
|
||||
cfg["sensors"].append({"hwmon": str(dirpath.joinpath(filename))})
|
||||
|
||||
n_sensors += 1
|
||||
|
||||
cur: int = args.lower_bound
|
||||
step: int = args.step
|
||||
halfstep = step // 2
|
||||
|
||||
for level in range(8):
|
||||
if level == 0:
|
||||
cfg["levels"].append(
|
||||
{
|
||||
"speed": 0,
|
||||
"lower_limit": [0] * n_sensors,
|
||||
"upper_limit": [cur] * n_sensors,
|
||||
}
|
||||
)
|
||||
|
||||
continue
|
||||
|
||||
if level == 7:
|
||||
cfg["levels"].append(
|
||||
{
|
||||
"speed": 7,
|
||||
"upper_limit": [args.upper_bound] * n_sensors,
|
||||
"lower_limit": [cur - halfstep] * n_sensors,
|
||||
}
|
||||
)
|
||||
|
||||
continue
|
||||
|
||||
cfg["levels"].append(
|
||||
{
|
||||
"speed": level,
|
||||
"lower_limit": [cur - halfstep] * n_sensors,
|
||||
"upper_limit": [cur + step] * n_sensors,
|
||||
},
|
||||
)
|
||||
|
||||
cur += step
|
||||
|
||||
print(f"# thinkfan_confgen.py created {datetime.datetime.now(datetime.UTC)}")
|
||||
print(json.dumps(cfg))
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
5
p10k.zsh
5
p10k.zsh
@@ -946,11 +946,10 @@
|
||||
# Python virtual environment color.
|
||||
typeset -g POWERLEVEL9K_VIRTUALENV_FOREGROUND=0
|
||||
typeset -g POWERLEVEL9K_VIRTUALENV_BACKGROUND=4
|
||||
# Don't show Python version next to the virtual environment name.
|
||||
typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION=false
|
||||
typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION=true
|
||||
# If set to "false", won't show virtualenv if pyenv is already shown.
|
||||
# If set to "if-different", won't show virtualenv if it's the same as pyenv.
|
||||
typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_WITH_PYENV=false
|
||||
typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_WITH_PYENV=true
|
||||
# Separate environment name from Python version only with a space.
|
||||
typeset -g POWERLEVEL9K_VIRTUALENV_{LEFT,RIGHT}_DELIMITER=
|
||||
# Custom icon.
|
||||
|
@@ -1,7 +1,8 @@
|
||||
bind-key C-b last-window
|
||||
set-option -g default-command /bin/zsh
|
||||
set-option -g default-shell /bin/zsh
|
||||
set-option -g default-terminal 'screen-256color'
|
||||
set-option -s default-terminal 'tmux-256color'
|
||||
set -ga terminal-overrides ',alacritty:RGB,*256col*:RGB'
|
||||
set-option -g history-limit 100000
|
||||
set-option -g prefix C-b
|
||||
set-option -g renumber-windows on
|
||||
|
@@ -1,33 +1,49 @@
|
||||
{
|
||||
"languageserver": {
|
||||
"terraform": {
|
||||
"command": "terraform-lsp",
|
||||
"filetypes": [
|
||||
"terraform"
|
||||
]
|
||||
},
|
||||
"R": {
|
||||
"command": "R",
|
||||
"args": [
|
||||
"--slave",
|
||||
"-e",
|
||||
"languageserver::run()"
|
||||
],
|
||||
"filetypes": [
|
||||
"r"
|
||||
]
|
||||
},
|
||||
"bash": {
|
||||
"command": "bash-language-server",
|
||||
"args": [
|
||||
"start"
|
||||
],
|
||||
"filetypes": [
|
||||
"sh"
|
||||
],
|
||||
"ignoredRootPaths": [
|
||||
"~"
|
||||
]
|
||||
}
|
||||
}
|
||||
"languageserver": {
|
||||
"terraform": {
|
||||
"command": "terraform-lsp",
|
||||
"filetypes": [
|
||||
"terraform"
|
||||
]
|
||||
},
|
||||
"R": {
|
||||
"command": "R",
|
||||
"args": [
|
||||
"--slave",
|
||||
"-e",
|
||||
"languageserver::run()"
|
||||
],
|
||||
"filetypes": [
|
||||
"r"
|
||||
]
|
||||
},
|
||||
"bash": {
|
||||
"command": "bash-language-server",
|
||||
"args": [
|
||||
"start"
|
||||
],
|
||||
"filetypes": [
|
||||
"sh"
|
||||
],
|
||||
"ignoredRootPaths": [
|
||||
"~"
|
||||
]
|
||||
},
|
||||
"ruff-lsp": {
|
||||
"command": [
|
||||
"ruff-lsp"
|
||||
],
|
||||
"filetypes": [
|
||||
"python"
|
||||
]
|
||||
}
|
||||
},
|
||||
"pyright.enable": true,
|
||||
"pyright.inlayHints.functionReturnTypes": true,
|
||||
"pyright.inlayHints.variableTypes": true,
|
||||
"pyright.organizeimports.provider": "ruff",
|
||||
"pyright.testing.provider": "pytest",
|
||||
"python.formatting.provider": "ruff",
|
||||
"python.linting.ruffEnabled": true,
|
||||
"clangd.path": "~/.config/coc/extensions/coc-clangd-data/install/17.0.3/clangd_17.0.3/bin/clangd"
|
||||
}
|
||||
|
48
vimrc
48
vimrc
@@ -1,5 +1,4 @@
|
||||
packloadall
|
||||
call pathogen#infect()
|
||||
|
||||
syntax on
|
||||
|
||||
@@ -15,7 +14,7 @@ set backupdir^=~/.vim/_backup//
|
||||
set cursorline
|
||||
set cursorcolumn
|
||||
set directory^=~/.vim/_temp//
|
||||
set encoding=utf8
|
||||
set encoding=utf-8
|
||||
set hlsearch
|
||||
set ignorecase
|
||||
set incsearch
|
||||
@@ -24,11 +23,12 @@ set linebreak
|
||||
set modeline
|
||||
set nowrap
|
||||
set number
|
||||
set signcolumn=yes
|
||||
set smartcase
|
||||
set statusline+=%#warningmsg#
|
||||
set statusline+=%*
|
||||
set tabstop=4
|
||||
set updatetime=100
|
||||
set updatetime=300
|
||||
set textwidth=1000
|
||||
|
||||
if has("persistent_undo")
|
||||
@@ -46,9 +46,12 @@ au BufRead,BufNewFile .envrc setfiletype sh
|
||||
au BufRead,BufNewFile Dockerfile* setfiletype dockerfile
|
||||
au BufRead,BufNewFile Pipfile setfiletype toml
|
||||
au BufRead,BufNewFile kubectl-edit-status-* setfiletype yaml
|
||||
au BufRead,BufNewFile *kubeconfig* setfiletype yaml
|
||||
au BufRead,BufNewFile */.kube/config setfiletype yaml
|
||||
au BufRead,BufNewFile .lintr setfiletype yaml
|
||||
au BufRead,BufNewFile devcontainer.json setfiletype jsonc
|
||||
au BufRead,BufNewFile devcontainer-feature.json setfiletype jsonc
|
||||
au BufRead,BufNewFile *.bicepparam setfiletype bicep
|
||||
au BufNewFile,BufRead *.go setlocal noexpandtab tabstop=4 shiftwidth=4
|
||||
au FileType go nmap <leader>r <Plug>(go-run)
|
||||
au FileType go nmap <Leader>c <Plug>(go-coverage-toggle)
|
||||
@@ -77,18 +80,21 @@ map <leader>l :Minimap<CR>
|
||||
map <leader>L :MinimapClose<CR>
|
||||
nmap <F8> :TagbarToggle<CR>
|
||||
|
||||
augroup black_on_save
|
||||
autocmd!
|
||||
autocmd BufWritePre *.py Black
|
||||
augroup end
|
||||
"augroup black_on_save
|
||||
" autocmd!
|
||||
" autocmd BufWritePre *.py Black
|
||||
"augroup end
|
||||
|
||||
autocmd BufNewFile,BufRead *.c set formatprg=astyle\ -t4\ -A14
|
||||
|
||||
let g:EditorConfig_exclude_patterns = ['fugitive://.*', 'scp://.*']
|
||||
let g:airline_powerline_fonts = 1
|
||||
let g:black_use_virtualenv = 1
|
||||
let g:coc_global_extensions = ['coc-tsserver']
|
||||
let g:coc_node_path = "/home/dan/.nvm/versions/node/v16.9.1/bin/node"
|
||||
let g:go_auto_sameids = 1
|
||||
let g:go_auto_type_info = 1
|
||||
let g:go_def_mode='gopls'
|
||||
let g:go_def_mode = 'gopls'
|
||||
let g:go_fmt_command = "goimports"
|
||||
let g:go_highlight_build_constraints = 1
|
||||
let g:go_highlight_extra_types = 1
|
||||
@@ -96,7 +102,7 @@ let g:go_highlight_fields = 1
|
||||
let g:go_highlight_function_calls = 1
|
||||
let g:go_highlight_functions = 1
|
||||
let g:go_highlight_operators = 1
|
||||
let g:go_info_mode='gopls'
|
||||
let g:go_info_mode = 'gopls'
|
||||
let g:html_indent_script1 = "inc"
|
||||
let g:html_indent_style1 = "inc"
|
||||
let g:minimap_auto_start = 1
|
||||
@@ -106,6 +112,7 @@ let g:minimap_highlight_search = 1
|
||||
let g:minimap_enable_highlight_colorgroup = 1
|
||||
let g:minimap_width = 10
|
||||
let g:python_highlight_all = 1
|
||||
let g:rehash256 = 1
|
||||
let g:rustfmt_autosave = 1
|
||||
let g:shfmt_extra_args = '-i 2'
|
||||
let g:shfmt_fmt_on_save = 1
|
||||
@@ -115,7 +122,16 @@ let g:vim_markdown_folding_disabled = 1
|
||||
let g:vim_markdown_frontmatter = 1
|
||||
let g:yapf_style = "pep8"
|
||||
|
||||
if exists('+termguicolors')
|
||||
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
|
||||
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
|
||||
set termguicolors
|
||||
endif
|
||||
|
||||
"colorscheme dichromatic
|
||||
colorscheme dracula
|
||||
"colorscheme molokai
|
||||
"colorscheme elflord
|
||||
|
||||
hi Comment cterm=NONE ctermfg=DarkRed gui=NONE guifg=red2
|
||||
hi minimapCursor ctermbg=59 ctermfg=228 guibg=#5F5F5F guifg=#FFFF87
|
||||
@@ -129,16 +145,4 @@ function! <SID>SynStack()
|
||||
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
|
||||
endfunc
|
||||
|
||||
" use <tab> to trigger completion and navigate to the next complete item
|
||||
function! CheckBackspace() abort
|
||||
let col = col('.') - 1
|
||||
return !col || getline('.')[col - 1] =~# '\s'
|
||||
endfunction
|
||||
|
||||
inoremap <silent><expr> <Tab>
|
||||
\ coc#pum#visible() ? coc#pum#next(1) :
|
||||
\ CheckBackspace() ? "\<Tab>" :
|
||||
\ coc#refresh()
|
||||
|
||||
inoremap <expr> <Tab> coc#pum#visible() ? coc#pum#next(1) : "\<Tab>"
|
||||
inoremap <expr> <S-Tab> coc#pum#visible() ? coc#pum#prev(1) : "\<S-Tab>"
|
||||
"source ~/.vimrc.coc
|
||||
|
49
zshrc
49
zshrc
@@ -42,14 +42,12 @@ fi
|
||||
|
||||
path=(
|
||||
$HOME/.rbenv/shims
|
||||
$HOME/.pyenv/shims
|
||||
$HOME/bin
|
||||
$HOME/go/bin
|
||||
$HOME/.local/bin
|
||||
$HOME/.cargo/bin
|
||||
$HOME/.rbenv/bin
|
||||
$HOME/.phpenv/bin
|
||||
$HOME/.pyenv/bin
|
||||
$HOME/.yarn/bin
|
||||
$HOME/.pulumi/bin
|
||||
${KREW_ROOT:-$HOME/.krew}/bin
|
||||
@@ -58,6 +56,7 @@ path=(
|
||||
$HOME/perl5/bin
|
||||
$HOME/Library/Python/3.8/bin
|
||||
/usr/local/opt/python@3.8/bin
|
||||
/usr/bin/core_perl
|
||||
/usr/local/sbin
|
||||
/usr/local/bin
|
||||
/usr/bin/vendor_perl
|
||||
@@ -73,6 +72,7 @@ path=(
|
||||
|
||||
plugins=(
|
||||
archlinux
|
||||
asdf
|
||||
aws
|
||||
azure
|
||||
brew
|
||||
@@ -94,8 +94,8 @@ plugins=(
|
||||
node
|
||||
nvm
|
||||
pip
|
||||
podman
|
||||
postgres
|
||||
pyenv
|
||||
python
|
||||
rails
|
||||
rake-fast
|
||||
@@ -104,9 +104,9 @@ plugins=(
|
||||
rsync
|
||||
ruby
|
||||
rust
|
||||
symfony-complete
|
||||
tmux
|
||||
vagrant
|
||||
vault
|
||||
vi-mode
|
||||
yarn
|
||||
)
|
||||
@@ -130,6 +130,8 @@ export EDITOR=vim
|
||||
export PYENV_ROOT="${HOME}/.pyenv"
|
||||
export SDKMAN_DIR="${HOME}/.sdkman"
|
||||
export VISUAL=vim
|
||||
export PTD_CACHE="${HOME}/.local/ptd"
|
||||
export PTD_ROOT="${HOME}/code/rstudio/ptd/infra"
|
||||
|
||||
# The completion for aws is not compatible with $fpath :scream_cat:
|
||||
if [[ -f /usr/local/share/zsh/site-functions/_aws ]] ; then
|
||||
@@ -170,7 +172,13 @@ unsetopt correct_all
|
||||
bindkey '^R' history-incremental-search-backward
|
||||
|
||||
if which pyenv >/dev/null; then
|
||||
eval "$(pyenv init - 2>/dev/null)"
|
||||
if [[ "${HATCH_ENV_ACTIVE}" ]]; then
|
||||
: skipping pyenv when inside a hatch env
|
||||
else
|
||||
path=($HOME/.pyenv/shims $HOME/.pyenv/bin "${path[@]}")
|
||||
plugins=("${plugins[@]}" pyenv)
|
||||
eval "$(pyenv init - 2>/dev/null)"
|
||||
fi
|
||||
fi
|
||||
|
||||
if which phpenv >/dev/null; then
|
||||
@@ -223,6 +231,23 @@ function docker-cleanup() {
|
||||
done
|
||||
}
|
||||
|
||||
function ptd-completion() {
|
||||
if command -v ptd &>/dev/null; then
|
||||
eval "$(_PTD_COMPLETE=zsh_source ptd)"
|
||||
fi
|
||||
}
|
||||
|
||||
function mksecret() {
|
||||
local nbytes="${1:-42}"
|
||||
|
||||
python3 <<EOPYTHON | tr -d '/' | tr -d '+' | cut -b1-$((nbytes - 1))
|
||||
import secrets
|
||||
import base64
|
||||
|
||||
print(base64.b64encode(secrets.token_bytes(${nbytes} * 2)).decode(), end="")
|
||||
EOPYTHON
|
||||
}
|
||||
|
||||
export NVM_DIR="${HOME}/.nvm"
|
||||
|
||||
__maybesource ~/.zshenv
|
||||
@@ -252,12 +277,22 @@ if nvm &>/dev/null; then
|
||||
nvm use --delete-prefix 20 --silent
|
||||
fi
|
||||
|
||||
autoload -Uz compinit
|
||||
compinit
|
||||
|
||||
if kitty --version &>/dev/null; then
|
||||
autoload -Uz compinit
|
||||
compinit
|
||||
kitty + complete setup zsh | source /dev/stdin
|
||||
fi
|
||||
|
||||
compdef _symfony_complete composer
|
||||
compdef _symfony_complete dep
|
||||
|
||||
alias fz=fuzzbucket-client
|
||||
|
||||
if ptd --version &>/dev/null; then
|
||||
ptd-completion
|
||||
fi
|
||||
|
||||
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
|
||||
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
|
||||
|
||||
|
Reference in New Issue
Block a user