diff --git a/.config/nvim/lua/config/autocmds.lua b/.config/nvim/lua/config/autocmds.lua index 036c9d5..eff365f 100644 --- a/.config/nvim/lua/config/autocmds.lua +++ b/.config/nvim/lua/config/autocmds.lua @@ -151,3 +151,44 @@ vim.api.nvim_create_autocmd("QuitPre", { end end, }) + +-- In toggleterm terminal buffers, show a red "cursorline" bar when the +-- terminal is in normal mode. Useful visual reminder so you don't start typing +-- and then wonder why text is not showing up. + +-- Custom highlight group we'll use in a moment +vim.api.nvim_set_hl(0, "TermCursorLine", { bg = "#5f0000" }) + +-- winhighlight lets us render CursorLin higlights with TermCursorLine's +-- attributes, but just local to that window (here, the terminal) +local function apply_term_winhl() + if vim.bo.buftype == "terminal" then + vim.wo.winhighlight = "CursorLine:TermCursorLine" + end +end + +local group = vim.api.nvim_create_augroup("ToggleTermCursorLine", { clear = true }) + +-- Catch new terminals and existing ones +vim.api.nvim_create_autocmd({ "TermOpen", "WinEnter", "BufWinEnter" }, { + group = group, + callback = apply_term_winhl, +}) + +-- Toggle cursorline only inside terminal windows +vim.api.nvim_create_autocmd("ModeChanged", { + group = group, + + -- match "old_mode:new_mode" strings. E.g., t:nt means we just left + -- terminal-insert to go into terminal-normal. + pattern = { "t:nt", "nt:t" }, + callback = function() + -- do nothing if we're not in a terminal buffer + if vim.bo.buftype ~= "terminal" then + return + end + -- set the window-specific (.wo) cursorline to true if we're in + -- terminal-normal mode + vim.wo.cursorline = vim.api.nvim_get_mode().mode == "nt" + end, +}) diff --git a/apt-installs-minimal.txt b/apt-installs-minimal.txt index 2662151..189ebb3 100644 --- a/apt-installs-minimal.txt +++ b/apt-installs-minimal.txt @@ -4,7 +4,7 @@ automake # for compiling tools requiring automake build-essential # gcc and make are in here cmake # for compiling tools requiring cmake liblzma-dev # dev lib for compiling tools needing lzma -libpcre3-dev # for Perl-compatible regexes +libpcre2-dev # for Perl-compatible regexes pkg-config # for using the right compiler options zlib1g-dev # dep lib for compiling tools needing zlib ncurses-dev # for TUI programs diff --git a/apt-installs.txt b/apt-installs.txt index 1d6343a..830fc0f 100644 --- a/apt-installs.txt +++ b/apt-installs.txt @@ -3,7 +3,7 @@ automake # for compiling tools requiring automake build-essential # gcc and make are in here cmake # for compiling tools requiring cmake liblzma-dev # dev lib for compiling tools needing lzma -libpcre3-dev # for Perl-compatible regexes +libpcre2-dev # for Perl-compatible regexes pkg-config # for using the right compiler options zlib1g-dev # dep lib for compiling tools needing zlib diff --git a/docs/changelog.rst b/docs/changelog.rst index dc6ef7f..91d0ffc 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -1,5 +1,19 @@ Changelog ========= +2026-05-07 +---------- + +**vim** + +Color the cursorline in toggleterm terminal when it's not in insert mode. Gives +a visual reminder of when typing won't do what you expect. + +**setup** + +- bumped versions of installed tools +- pip explicitly added to built conda envs +- download() properly exits 1 upon failure +- diff on nvim lockfile only runs if it exists 2026-01-28 ---------- diff --git a/setup.sh b/setup.sh index 568a523..e823701 100755 --- a/setup.sh +++ b/setup.sh @@ -20,19 +20,19 @@ fi set -eo pipefail # Change tool versions here -VISIDATA_VERSION=2.11 +VISIDATA_VERSION=3.3 HUB_VERSION=2.14.2 NVIM_VERSION=0.11.5 -RG_VERSION=13.0.0 -BAT_VERSION=0.19.0 -JQ_VERSION=1.6 +RG_VERSION=15.1.0 +BAT_VERSION=0.26.1 +JQ_VERSION=1.8.1 ICDIFF_VERSION=2.0.4 BFG_VERSION=1.14.0 -FD_VERSION=8.5.3 +FD_VERSION=10.4.2 BLACK_VERSION=22.6.0 PYP_VERSION=1.1.0 -FZF_VERSION=0.48.1 -TMUX_VERSION=3.5 +FZF_VERSION=0.72.0 +TMUX_VERSION=3.6a function showHelp() { @@ -304,7 +304,8 @@ download() { echo "Downloading $1 to $2" [[ -e $(dirname $2) ]] || mkdir -p $(dirname $2) if ! (try_curl $1 $2 || try_wget $1 $2); then - echo "Could not download $1" + printf "${RED}Could not download %s${UNSET}\n" "$1" >&2 + return 1 fi } @@ -573,22 +574,16 @@ elif [ $task == "--install-fzf" ]; then ok "Installs fzf (https://github.com/junegunn/fzf)" mkdir -p /tmp/fzf if [[ $OSTYPE == darwin* ]]; then - URL=https://github.com/junegunn/fzf/releases/download/${FZF_VERSION}/fzf-${FZF_VERSION}-darwin_arm64.zip - download $URL /tmp/fzf/fzf.zip - ( - cd /tmp/fzf - unzip fzf.zip - cp fzf ~/opt/bin - ) + URL=https://github.com/junegunn/fzf/releases/download/v${FZF_VERSION}/fzf-${FZF_VERSION}-darwin_arm64.tar.gz else - URL=https://github.com/junegunn/fzf/releases/download/${FZF_VERSION}/fzf-${FZF_VERSION}-linux_amd64.tar.gz - download $URL /tmp/fzf/fzf.tar.gz - ( - cd /tmp/fzf - tar -xf fzf.tar.gz - cp fzf ~/opt/bin - ) + URL=https://github.com/junegunn/fzf/releases/download/v${FZF_VERSION}/fzf-${FZF_VERSION}-linux_amd64.tar.gz fi + download $URL /tmp/fzf/fzf.tar.gz + ( + cd /tmp/fzf + tar -xf fzf.tar.gz + cp fzf ~/opt/bin + ) rm -r /tmp/fzf if [ ! $(grep -q "(fzf --bash)" ~/.bashrc) ]; then @@ -634,6 +629,7 @@ elif [ $task == "--install-tmux" ]; then elif [ $task == "--install-vd" ]; then ok "Install visidata (https://visidata.org/) into a new conda env and symlink to ~/opt/bin/vd" install_env_and_symlink visidata visidata="${VISIDATA_VERSION}" vd + conda install -y setuptools -n visidata printf "${YELLOW}Installed to ~/opt/bin/vd${UNSET}\n" check_opt_bin_in_path @@ -674,7 +670,7 @@ elif [ $task == "--install-radian" ]; then set +u # Note: radian needs R installed to compile the rchitect dependency. It # is unclear whether radian is dependent on a particular R version. - conda create -y -n radian python r + conda create -y -n radian python r pip conda activate radian pip install radian ln -sf $CONDA_LOCATION/envs/radian/bin/radian $HOME/opt/bin/radian @@ -779,7 +775,7 @@ elif [ $task == "--install-pyp" ]; then ok "Install pyp (https://github.com/hauntsaninja/pyp) into ~/opt/bin" set +u can_make_conda_env "pyp" - conda create -y -n pyp python + conda create -y -n pyp python pip conda activate pyp pip install pypyp==${PYP_VERSION} ln -sf $(which pyp) $HOME/opt/bin/pyp @@ -966,11 +962,19 @@ elif [ $task == "--restore-nvim-plugins" ]; then ok "Restore nvim plugins using the lazy-lock.json file in this repo? This will not change any other config." timestamp=$(date +"%Y%m%d%H%M") NVIM_LOCKFILE_BACKUP="$HOME/.config/nvim/lazy-lock_${timestamp}.json" - [ -e $HOME/.config/nvim/lazy-lock.json ] && cp $HOME/.config/nvim/lazy-lock.json "$NVIM_LOCKFILE_BACKUP" - cp .config/nvim/lazy-lock.json $HOME/.config/nvim/lazy-lock.json + if [ -e "$HOME/.config/nvim/lazy-lock.json" ]; then + cp "$HOME/.config/nvim/lazy-lock.json" "$NVIM_LOCKFILE_BACKUP" + else + NVIM_LOCKFILE_BACKUP= + fi + cp .config/nvim/lazy-lock.json "$HOME/.config/nvim/lazy-lock.json" nvim --headless "+Lazy! restore" +qa - printf "${YELLOW}Here is the diff of what changed (new compared to old):\n${UNSET}" - diff -u $NVIM_LOCKFILE_BACKUP ~/.config/nvim/lazy-lock.json + if [ -n "$NVIM_LOCKFILE_BACKUP" ]; then + printf "${YELLOW}Here is the diff of what changed (new compared to old):\n${UNSET}" + diff -u "$NVIM_LOCKFILE_BACKUP" "$HOME/.config/nvim/lazy-lock.json" || true + else + printf "${YELLOW}No existing ~/.config/nvim/lazy-lock.json was found, so no diff is available.\n${UNSET}" + fi printf "${YELLOW}Restored plugins using ~/.config/nvim/lazy-lock.json.\n" printf "Any original file was renamed to $NVIM_LOCKFILE_BACKUP if you " printf "need the previous version, otherwise you can delete it.\n${UNSET}" diff --git a/tests/test_commands b/tests/test_commands index 4fc3795..4a0cf42 100644 --- a/tests/test_commands +++ b/tests/test_commands @@ -1,7 +1,7 @@ pyp 1+8 9 which mamba /root/dockeruser/miniforge/condabin/mamba black --version | head -n1 black, 22.6.0 (compiled: no) -vd --version saul.pw/VisiData v2.11 -rg --version | grep ripgrep ripgrep 13.0.0 (rev af6b6c543b) -fd --version fd 8.5.3 -fzf --version 0.48.1 (d579e33) +vd --version saul.pw/VisiData v3.3 +rg --version | grep ripgrep ripgrep 15.1.0 (rev af60c2de9d) +fd --version fd 10.4.2 +fzf --version 0.72.0 (6fefe025)