aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjdhao <jdhao@hotmail.com>2021-01-12 23:01:49 +0800
committerjdhao <jdhao@hotmail.com>2021-01-12 23:01:49 +0800
commite4ef4fa6eac77dac5d212bc3ed82d1340e6b95f5 (patch)
tree4de2b0c7a0b5e98f35684e9c6041aaf78d08c1de
parent61d42ed550e5d0710822c15eb85fac71bbfb8b78 (diff)
Fix bug for text object for the entire buffer
-rw-r--r--autoload/text_obj.vim8
-rw-r--r--core/mappings.vim4
2 files changed, 10 insertions, 2 deletions
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! `<V`>'
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! `<V`>'
+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 <silent> iu :<C-U>call text_obj#URL()<CR>
onoremap <silent> iu :<C-U>call text_obj#URL()<CR>
" Text objects for entire buffer
-xnoremap <silent> iB 0ggoG
-onoremap <silent> iB :normal viB<CR>
+xnoremap <silent> iB :<C-U>call text_obj#Buffer()<CR>
+onoremap <silent> iB :<C-U>call text_obj#Buffer()<CR>
"}