" ============================================================================= " URL: https://github.com/sainnhe/dotfiles " Filename: .config/nvim/autoload/custom/textobj.vim " Author: Sainnhe Park " Email: sainnhe@gmail.com " License: Anti-996 && MIT " ============================================================================= function custom#textobj#al() abort normal! 0 let head_pos = getpos('.') normal! $ let tail_pos = getpos('.') let tail_pos[2] = tail_pos[2] + 1 return ['v', head_pos, tail_pos] endfunction function custom#textobj#il() abort normal! ^ let head_pos = getpos('.') normal! g_ let tail_pos = getpos('.') let non_blank_char_exists_p = getline('.')[head_pos[2] - 1] !~# '\s' return \ non_blank_char_exists_p \ ? ['v', head_pos, tail_pos] \ : 0 endfunction " vim: set sw=2 ts=2 sts=2 et tw=80 ft=vim fdm=marker fmr={{{,}}}: