Last active
May 7, 2023 20:48
-
-
Save andlrc/c4d40e80f7596ae6cbea062e4c3f730a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vim9script | |
# t-f - make it possible to provide a count after 't' and 'f' | |
# Maintainer: Andreas Louv <andreas@louv.dk> | |
# Date: 07 May 2023 | |
xnoremap <expr> t v:count > 0 ? 't' : <Sid>TF('t') | |
xnoremap <expr> f v:count > 0 ? 'f' : <Sid>TF('f') | |
onoremap <expr> t v:count > 0 ? 't' : <Sid>TF('t') | |
onoremap <expr> f v:count > 0 ? 'f' : <Sid>TF('f') | |
nnoremap <expr> t v:count > 0 ? 't' : <Sid>TF('t') | |
nnoremap <expr> f v:count > 0 ? 'f' : <Sid>TF('f') | |
def TF(tf: string): string | |
var char = getcharstr() | |
var cnt = 1 | |
if char =~ '^[1-9]$' | |
cnt = str2nr(char) | |
char = getcharstr() | |
endif | |
return $'{cnt}{tf}{char}' | |
enddef |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment