diff --git a/autoload/text_obj.vim b/autoload/text_obj.vim index 58ba710..4f6a1ff 100644 --- a/autoload/text_obj.vim +++ b/autoload/text_obj.vim @@ -76,3 +76,11 @@ function! text_obj#MdCodeBlock(type) abort call setpos("'>", [buf_num, end_row, 1, 0]) execute 'normal! `' endfunction + +function! text_obj#Buffer() abort + let buf_num = bufnr() + + call setpos("'<", [buf_num, 1, 1, 0]) + call setpos("'>", [buf_num, line('$'), 1, 0]) + execute 'normal! `' +endfunction diff --git a/core/mappings.vim b/core/mappings.vim index a7c76c9..eba7106 100644 --- a/core/mappings.vim +++ b/core/mappings.vim @@ -186,6 +186,6 @@ xnoremap iu :call text_obj#URL() onoremap iu :call text_obj#URL() " Text objects for entire buffer -xnoremap iB 0ggoG -onoremap iB :normal viB +xnoremap iB :call text_obj#Buffer() +onoremap iB :call text_obj#Buffer() "}