update some things

This commit is contained in:
Josh Thomas 2023-12-01 19:32:00 -06:00
parent 28a1bead19
commit b12bfcb218
9 changed files with 62 additions and 16 deletions

View file

@ -0,0 +1,5 @@
[global]
load_dotenv = true
[whitelist]
prefix = ["/home/josh/projects/"]

View file

@ -1,28 +1,28 @@
#!/bin/sh
if [ -f ".env" ]; then
dotenv
dotenv
fi
# use a certain pyenv version
use_python() {
if [ -n "$(which pyenv)" ]; then
local pyversion=$1
pyenv local ${pyversion}
fi
if [ -n "$(which pyenv)" ]; then
local pyversion=$1
pyenv local ${pyversion}
fi
}
layout_virtualenv() {
local pyversion=$1
local pvenv=$2
if [ -n "$(which pyenv virtualenv)" ]; then
pyenv virtualenv --force --quiet ${pyversion} ${pvenv}-${pyversion}
fi
pyenv local --unset
local pyversion=$1
local pvenv=$2
if [ -n "$(which pyenv virtualenv)" ]; then
pyenv virtualenv --force --quiet ${pyversion} ${pvenv}-${pyversion}
fi
pyenv local --unset
}
layout_activate() {
if [ -n "$(which pyenv)" ]; then
source $(pyenv root)/versions/$1/bin/activate
fi
if [ -n "$(which pyenv)" ]; then
source $(pyenv root)/versions/$1/bin/activate
fi
}

View file

@ -0,0 +1 @@
/home/josh/.asdf/completions/asdf.fish

View file

@ -1,7 +1,15 @@
if status is-interactive
# Commands to run in interactive sessions can go here
# automatically start tmux if not already started
and not set -q TMUX
exec tmux
end
# disable intro fish greeting
set -g fish_greeting
# add ~/.local/bin to path
fish_add_path -m {$HOME}/.local/bin
# starship
starship init fish | source
@ -14,3 +22,6 @@ zoxide init fish | source
# pyenv
pyenv init - | source
status --is-interactive; and pyenv virtualenv-init - | source
# asdf
# source {$HOME}/.asdf/asdf.fish

View file

@ -35,4 +35,4 @@ SETUVAR fish_pager_color_description:B3A06D\x1eyellow\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 fish_user_paths:/home/josh/\x2epyenv/bin\x1e/home/josh/\x2efzf/bin
SETUVAR fish_user_paths:/home/josh/\x2elocal/bin\x1e/home/josh/\x2epyenv/bin\x1e/home/josh/\x2efzf/bin

View file

@ -0,0 +1,24 @@
# taken from https://jinyuz.dev/2020/07/switching-from-pyenv-rbenv-goenv-and-nvm-to-asdf/
function venv --argument-names 'python_version' --description 'Create virtualenv named the same as current directory'
set -l python_bin
if not test -n "$python_version"
# Use default python version set by asdf
set python_bin ($HOME/.asdf/bin/asdf which python)
else
set python_bin $ASDF_DIR/installs/python/$python_version/bin/python
end
set -l venv_name (basename $PWD | tr . -)
echo
if not test -e $python_bin
echo "Python version `$python_version` is not installed."
return 1
end
echo Creating virtualenv `$venv_name`
$python_bin -m venv $HOME/.virtualenvs/$venv_name
source $HOME/.virtualenvs/$venv_name/bin/activate.fish
end

View file

@ -1,2 +1,3 @@
.dotfiles/
.python-version
pyrightconfig.json

View file

@ -35,6 +35,8 @@ return {
{ "<leader>sf", function() require("telescope.builtin").find_files({ hidden = true }) end, desc = "[f]iles" },
{ "<leader>sg", function() require("telescope.builtin").git_files() end, desc = "[g]it files" },
{ "<leader>sb", function() require("telescope.builtin").buffers() end, desc = "[b]uffers" },
{ "<leader>sr", function() require("telescope.builtin").oldfiles({ only_cwd = true }) end, desc = "[r]ecent files (cwd)" },
{ "<leader>sR", function() require("telescope.builtin").oldfiles() end, desc = "[R]ecent files (all)" },
{ "<leader>sh", "<cmd>Telescope help_tags<cr>", desc = "[h]elp" },
{ "<leader>sk", "<cmd>Telescope keymaps<cr>", desc = "[k]eymaps" },
{ "<leader>sda", function() require("telescope.builtin").live_grep({ glob_pattern = { "admin.py", "!test_*.py"} }) end, desc = "[a]dmin" },

View file

@ -87,3 +87,5 @@ set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @resurrect-strategy-nvim 'session'
set -g @resurrect-capture-pane-contents 'on'
set-option -g default-shell /usr/bin/fish