Add configuration for vim

- Add ~/.config/vim/vimrc
  + Configure basic stuff
  + Activate spell checks
  + Activate syntax highlighting and ruler
  + Show whitespace characters
  + Add various snippets for mouse handling,
    toggling line numbers, and search
  + Set `vim`-related directories inside
   ~/.config/vim and ~/.local/state/vim
- Integrate extra settings for Python files
  in ~/.config/vim/after/ftplugin/python.vim
  and ~/.config/vim/after/syntax/python.vim
- Add `vim` artifacts in ~/.config/git/ignore
This commit is contained in:
Alexander Hess 2026-08-03 02:02:37 +02:00
commit 9b4c9fc98b
Signed by: alexander
GPG key ID: B46EDB4DFC26805D
12 changed files with 610 additions and 1 deletions

View file

@ -4,6 +4,12 @@
# Make non-interactive `bash` expand aliases as well (e.g., ":!cmd" in `vim`)
if [ -n "${BASH_VERSION:-}" ]; then
shopt -s expand_aliases
fi
forget() { # the current history and restore $HISTFILE from disk
if [ -n "$BASH_VERSION" ]; then
@ -123,3 +129,12 @@ if _command_exists pyenv; then
alias pywhich='pyenv which'
fi
if _command_exists vim; then
alias v='vim'
_command_exists sudoedit && alias sv='sudoedit'
fi

View file

@ -37,7 +37,13 @@ fi
[ -t 0 ] && export GPG_TTY=$(tty)
export EDITOR=nano
if _command_exists vim; then
export EDITOR=vim
elif _command_exists vi; then
export EDITOR=vi
else
export EDITOR=nano
fi
export PAGER=less
@ -68,3 +74,4 @@ export PYENV_ROOT="$XDG_DATA_HOME/pyenv"
export PYTHONPYCACHEPREFIX="$XDG_CACHE_HOME/python"
export PYTHONSTARTUP="$XDG_CONFIG_HOME/python/startup.py"
export PYTHON_HISTORY="$XDG_STATE_HOME/python/history"
export VIMINIT='let $MYVIMRC="'"$XDG_CONFIG_HOME"'/vim/vimrc" | source $MYVIMRC'

View file

@ -5,6 +5,7 @@
# ... except:
[ -t 1 ] || return # If stdout is not a terminal
[ "${SHLVL:-1}" -gt 1 ] && return # In nested shells (e.g., ":terminal" in `vi`)
[ "${TERM:-}" = "dumb" ] && return # For tools opening shells (e.g., `emacs`)