Get rid of old env script

Signed-off-by: Severin Kaderli <severin@kaderli.dev>
This commit is contained in:
Severin Kaderli 2023-02-08 19:40:06 +01:00
parent 319f774457
commit bba5b16c6f
Signed by: severinkaderli
GPG key ID: F419F8835B72F0C4
6 changed files with 46 additions and 62 deletions

View file

@ -1,42 +0,0 @@
#!/bin/bash
#
# SCRIPT NAME:
# .env
#
# AUTHOR:
# Severin Kaderli <severin@kaderli.dev>
#
# DESCRIPTION:
# This file contains declarations of environment variables.
#
# USAGE:
# This script is sourced by .bashrc
# XDG_Base_Directories
# XDG Overrides for unsupported programs
export VIMINIT=":source ${XDG_CONFIG_HOME}/vim/vimrc"
export PYTHONSTARTUP="${XDG_CONFIG_HOME}/python/startup.py"
# zsh
export HISTCONTROL=ignoreboth
export HISTSIZE=10000
export SAVEHIST="${HISTSIZE}"
export HISTFILESIZE="${HISTSIZE}"
# Ibus
export GTK_IM_MODULE=ibus
export XMODIFIERS=@im=ibus
export QT_IM_MODULE=ibus
# NVIDIA
export __GL_SHADER_DISK_CACHE="1"
export __GL_SHADER_DISK_CACHE_SKIP_CLEANUP="1"
mkdir -p "${__GL_SHADER_DISK_CACHE_PATH}"
mkdir -p "${XDG_DATA_HOME}/wine/prefixes"
mkdir -p "${XDG_CONFIG_HOME}/bazaar"
mkdir -p "${XDG_DATA_HOME}/zsh/zcompdump-${ZSH_VERSION}"
if [ -n "$(command -v compinit)" ]; then
compinit -d "${XDG_DATA_HOME}/zsh/zcompdump-${ZSH_VERSION}"
fi
eval "$(starship init zsh)"

View file

@ -21,6 +21,9 @@ GTK2_RC_FILES="${XDG_CONFIG_HOME}/gtk-2.0/gtkrc"
WGETRC="${XDG_CONFIG_HOME}/wget/wgetrc"
ZDOTDIR="${XDG_CONFIG_HOME}/zsh"
NPM_CONFIG_USERCONFIG="${XDG_CONFIG_HOME}/npm/config"
_JAVA_OPTIONS="-Djava.util.prefs.userRoot=${XDG_CONFIG_HOME}/java"
PYTHONSTARTUP="${XDG_CONFIG_HOME}/python/startup.py"
VIMINIT=":source ${XDG_CONFIG_HOME}/vim/vimrc"
# XDG Cache
CUDA_CACHE_PATH="${XDG_CACHE_HOME}/nv"

View file

@ -0,0 +1,5 @@
# Zsh
HISTCONTROL="ignoreboth"
HISTSIZE="10000"
SAVEHIST="${HISTSIZE}"
HISTFILESIZE="${HISTSIZE}"

View file

@ -0,0 +1,2 @@
__GL_SHADER_DISK_CACHE="1"
__GL_SHADER_DISK_CACHE_SKIP_CLEANUP="1"

View file

@ -1,20 +1,30 @@
import atexit
import os
import atexit
import readline
from pathlib import Path
XDG_DATA_HOME = os.environ["XDG_DATA_HOME"]
if not XDG_DATA_HOME:
histfile = os.path.join(os.path.expanduser(
"~"), ".local", "share", "python", "history")
if readline.get_current_history_length() == 0:
state_home = os.environ.get("XDG_STATE_HOME")
if state_home is None:
state_home = Path.home() / ".local" / "state"
else:
histfile = os.path.join(XDG_DATA_HOME, "python", "history")
state_home = Path(state_home)
history_path = state_home / "python_history"
if history_path.is_dir():
raise OSError(f"'{history_path}' cannot be a directory")
history = str(history_path)
try:
readline.set_auto_history(False)
readline.read_history_file(histfile)
readline.set_history_length(1000)
except FileNotFoundError:
readline.read_history_file(history)
except OSError: # Non existent
pass
atexit.register(readline.write_history_file, histfile)
def write_history():
try:
readline.write_history_file(history)
except OSError:
pass
atexit.register(write_history)

View file

@ -19,7 +19,6 @@ setopt INC_APPEND_HISTORY
setopt SHARE_HISTORY
unsetopt correct
# Zsh keybindings
# Ctrl + Left
@ -42,11 +41,6 @@ zstyle ':completion:*' menu select
# Persistent rehash
zstyle ':completion:*' rehash true
# Sourcing environment variables
if [ -f "${HOME}/.config/custom/env" ]; then
. "${HOME}/.config/custom/env"
fi
# Enable color support of ls
if [ -f "${XDG_CONFIG_HOME}/custom/dircolors" ]; then
dircolors -b "${XDG_CONFIG_HOME}/custom/dircolors" > /dev/null 2>&1
@ -57,6 +51,18 @@ if [ -f "${XDG_CONFIG_HOME}/custom/aliases" ]; then
. "${XDG_CONFIG_HOME}/custom/aliases"
fi
# Create necessary directories
mkdir -p "${__GL_SHADER_DISK_CACHE_PATH}"
mkdir -p "${XDG_DATA_HOME}/wine/prefixes"
mkdir -p "${XDG_CONFIG_HOME}/bazaar"
mkdir -p "${XDG_STATE_HOME}/zsh"
mkdir -p "${XDG_DATA_HOME}/zsh/zcompdump-${ZSH_VERSION}"
if [ -n "$(command -v compinit)" ]; then
compinit -d "${XDG_DATA_HOME}/zsh/zcompdump-${ZSH_VERSION}"
fi
# Initialize prompt
eval "$(starship init zsh)"
# Plugins
source "/usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"