Compare commits

...

10 Commits

Author SHA1 Message Date
1ee41e1c5b vim:keys: Reference commits w/ --pretty=reference
Use git's preferred way of referencing commits (`--pretty=reference`)
instead of the kernel's (`--pretty='%h ("%s")'`). I can see that
specifying the date makes sense and that the quotes are at best
unnecessary in the parentheses and at worst confusing when the subject
contains quotes itself.

Link: https://git-scm.com/docs/SubmittingPatches#describe-changes
2025-07-20 03:37:47 +02:00
4802abee17 vim:setts: Revert "Include - in &iskeyword"
Commit 0369218114 ("vim:settings: Include `-` in `&iskeyword`") added
the dash to `&iskeyword` but I didn't give an explanation for the change
and don't remember what led me to it. Today I'm annoyed by it since it
breaks some stuff (e.g. previously the C pointer arrow and syntax
highlighting of negative numbers in Python). The C ftplugin is obsolete
now, so delete it.

This reverts commit 0369218114.
2025-07-20 03:05:10 +02:00
068a8fe9d2 zathura: Change database backend to sqlite
The default value of plain is deprecated. I did this change a while ago
but never staged it.
2025-07-18 14:15:09 +02:00
bf61d01b42 zathura: Fix index mappings
Apparently these were always wrong and I never used them until today.
2025-07-18 14:11:30 +02:00
5539a5e437 vim:ftplug:asl: Use 2 spaces for indentation 2025-07-09 14:01:15 +02:00
39486a6f45 vim:ftdetect:asl: Allow uppercase file ending 2025-07-09 14:01:11 +02:00
d9feb1d468 zsh:p10k: Add custom Session.vim prompt segment 2025-07-09 01:27:37 +02:00
bc0de45375 zsh:funcs: Add findup to search parent directories 2025-07-04 13:41:30 +02:00
0e7171bd5f zsh:diffcmds: Make diff_cmd overwritable by caller 2025-06-30 14:11:31 +02:00
db9aad5dcd zsh:diffcmds: Fix wrong variable assignment 2025-06-30 14:11:30 +02:00
8 changed files with 62 additions and 17 deletions

View File

@@ -1 +1 @@
autocmd BufNewFile,BufRead *.asl set filetype=c.asl
autocmd BufNewFile,BufRead *.asl,*.ASL set filetype=c.asl

View File

@@ -0,0 +1,3 @@
" most files I've encountered use two spaces for indentation
setlocal tabstop=2
setlocal expandtab

View File

@@ -1,2 +0,0 @@
" Exclude `-` in keyword characters
setlocal iskeyword-=-

View File

@@ -93,8 +93,6 @@ set shortmess+=A
" probably expected. See corresponding autocommand or:
" https://vi.stackexchange.com/questions/2702
set autoread
" Include `-` in keyword characters
set iskeyword+=-
" Do not automatically insert <EOL> at EOF if missing
set nofixendofline
" Let the cursor move beyond the EOL when in visual-block mode.

View File

@@ -140,12 +140,14 @@ nnoremap <expr> gp '`[' . strpart(getregtype(), 0, 1) . '`]'
" Git bindings
" Insert a commit's subject behind the SHA1 that the cursor is currently on.
" Mnemonic: "git reference commit"
" Reference the commit that the cursor is currently on with the 'reference'
" format (Mnemonic: "git reference commit").
" NOTE: I can't use --pretty=reference since it would insert the abbreviated
" hash additionally to the existing hash.
" NOTE: This uses `system` and not `:r!` to insert the text directly at the
" cursor. `subject[:-2]` cuts off the trailing newline.
" cursor. `subject[:-1]` cuts off the trailing newline.
" TODO: print error message but insert nothing on git error
nmap <leader>grc :let subject=system('git show -s --format="(\"%s\")" <C-R><C-W>')<CR>viw<Esc>a <C-R>=subject[:-2]<CR><Esc>
nmap <leader>grc :let subject=system('git show -s --date=short --pretty="format:(%s, %ad)" <C-R><C-W>')<CR>viw<Esc>a <C-R>=subject[:-1]<CR><Esc>
" Insert a Signed-off-by trailer
nmap <leader>gso :r!git config --get user.name<CR>:r!git config --get user.email<CR>I<<ESC>A><ESC>kJISigned-off-by: <ESC>

View File

@@ -1,3 +1,6 @@
# Use sqlite backend - plain is deprecated
set database sqlite
# Use system clipboard for selection.
set selection-clipboard "clipboard"
@@ -34,10 +37,10 @@ set recolor-keephue true
set recolor-reverse-video true
# vim-like fold mappings in index
map [index] zo navigate-index expand
map [index] zc navigate-index collapse
map [index] zR navigate-index expand-all
map [index] zM navigate-index collapse-all
map [index] zo navigate_index expand
map [index] zc navigate_index collapse
map [index] zR navigate_index expand-all
map [index] zM navigate_index collapse-all
# Recoloring should also work in presentation mode
map [presentation] i recolor

View File

@@ -584,6 +584,20 @@ finddup() {
| cut -d' ' -f3-
}
# Find in parent directories
findup() {
(( $# )) || return 1
# TODO: support passing different entry point
dir="$PWD:A"
while true; do
find "$dir" -maxdepth 1 \( "$@" \)
[[ $dir != / ]] || break
dir="$dir:h"
done
}
# Wrapper around tmsu that searches for .tmsu/db in all parent directories and
# fallbacks to XDG_DATA_HOME if not found.
tag() {
@@ -673,13 +687,16 @@ diffcmds() {
# TODO: Support own arguments for example to switch the placeholder or the
# diffcmd
# TODO: Find better way to dequote pipes. (e.g. `%|` to use a pipe?)
local diff_cmd i arg ps_sub
local i arg ps_sub
local -a template args final_cmd
if (( $+commands[vimdiff] && ! $+commands[diff] )); then
cmd=vimdiff
local diff_cmd="$diff_cmd"
if [[ -n $diff_cmd ]]; then
# already set by caller
elif (( $+commands[vimdiff] && ! $+commands[diff] )); then
diff_cmd=vimdiff
elif (( $+commands[diff] && ! $+commands[vimdiff] )); then
cmd=diff
diff_cmd=diff
elif (( $+commands[diff] && $+commands[vimdiff] )); then
if [[ $EDITOR =~ vi || $VISUAL =~ vi ]]; then
diff_cmd=vimdiff

View File

@@ -88,6 +88,7 @@
lf # lf shell (https://github.com/gokcehan/lf)
xplr # xplr shell (https://github.com/sayanarijit/xplr)
vim_shell # vim shell indicator (:sh)
my_vim_session # vim session file (Session.vim)
midnight_commander # midnight commander shell (https://midnight-commander.org/)
nix_shell # nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html)
chezmoi_shell # chezmoi shell (https://www.chezmoi.io/)
@@ -1670,6 +1671,29 @@
prompt_example
}
#########################[ my_vim_session: existence of Session.vim ]#########################
function prompt_my_vim_session() {
if [[ -e Session.vim ]]; then
p10k segment -s CURRENT -t "Session.vim"
return
fi
# TODO: do we actually want :A?
local dir="${${PWD:A}:h}"
while [[ $dir != / ]]; do
if [[ -e "$dir/Session.vim" ]]; then
p10k segment -s PARENT -t "Session.vim"
return
fi
dir="${dir:h}"
done
}
# Color when Session.vim exists in current directory
typeset -g POWERLEVEL9K_MY_VIM_SESSION_CURRENT_FOREGROUND=3
# Color when Session.vim exists in parent directory
typeset -g POWERLEVEL9K_MY_VIM_SESSION_PARENT_FOREGROUND=239
# User-defined prompt segments can be customized the same way as built-in segments.
# typeset -g POWERLEVEL9K_EXAMPLE_FOREGROUND=208
# typeset -g POWERLEVEL9K_EXAMPLE_VISUAL_IDENTIFIER_EXPANSION='⭐'