From e0e1e5d97190e4514d31edec07d665ee00c1e0e5 Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Fri, 30 May 2025 14:42:28 +0200 Subject: [PATCH] vim:keys: Fix vmaps When switching to for mappings in fc9874bf97ce ("vim:keys: Use for plain command mappings") I forgot that the previously inserted selection range marks (i.e. '<,'>) are missing now. This broke vmaps that used :substitute without having added them manually. Since has some performance benefits, I want to keep it and add the missing marks where needed. --- .config/vim/vimrc.d/40-keys.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.config/vim/vimrc.d/40-keys.vim b/.config/vim/vimrc.d/40-keys.vim index 9cd85b5..49aa9bd 100644 --- a/.config/vim/vimrc.d/40-keys.vim +++ b/.config/vim/vimrc.d/40-keys.vim @@ -275,7 +275,7 @@ augroup END " Convert Unix timestamp to human readable " Mnemonic: "Unix timestamp convert" with pun to UTC nnoremap utc ciw=strftime("%F %T", @") -vnoremap utc s/\v(^\|[^0-9])\zs[0-9]{10}\ze([^0-9]\|$)/\=strftime("%F %T",submatch(0))/g +vnoremap utc '<,'>s/\v(^\|[^0-9])\zs[0-9]{10}\ze([^0-9]\|$)/\=strftime("%F %T",submatch(0))/g " TODO: sec that uses the `duration` alias from zsh @@ -489,7 +489,7 @@ augroup macro_type augroup END " Escape underscores (useful when writing LaTeX) -vmap \_ s/\v(^[^\\])\zs\ze_/\\/g +vmap \_ '<,'>s/\v(^[^\\])\zs\ze_/\\/g " TODO: make `gf` open absolute paths relative to PWD if possible "