commit 5f456cf3c13c12119a80a28356f0d3d63fff58d3
parent 22add9d5c987770494e09ae186992e4ccaf6a220
Author: Alex Balgavy <alex@balgavy.eu>
Date: Fri, 10 Sep 2021 09:41:54 +0200
vim: text object for asterisks
Diffstat:
1 file changed, 25 insertions(+), 0 deletions(-)
diff --git a/vim/vimrc b/vim/vimrc
@@ -441,6 +441,31 @@ let g:gh_token = getenv("GITHUB_AUTH_TOKEN")
" ALE {{{3
let g:airline#extensions#ale#enabled = 0
let g:ale_enabled = 0
+" textobj-user {{{3
+call textobj#user#plugin('asterisks', {
+\ '-': {
+\ '*sfile*': expand('<sfile>:p'),
+\ 'select-a': 'a*', '*select-a-function*': 'SelectAAsterisks',
+\ 'select-i': 'i*', '*select-i-function*': 'SelectIAsterisks'
+\ }
+\ })
+
+function! SelectAAsterisks()
+ normal! F*
+ let end_pos = getpos('.')
+ normal! f*
+ let start_pos = getpos('.')
+ return ['v', start_pos, end_pos]
+endfunction
+
+function! SelectIAsterisks()
+ normal! T*
+ let end_pos = getpos('.')
+ normal! t*
+ let start_pos = getpos('.')
+ return ['v', start_pos, end_pos]
+endfunction
+
" }}}1
" General {{{1
" Put viminfo in ~/.cache