1
0
mirror of https://github.com/jdhao/nvim-config.git synced 2025-06-08 14:14:33 +02:00

Fix bug for text object for the entire buffer

This commit is contained in:
jdhao 2021-01-12 23:01:49 +08:00
parent 61d42ed550
commit e4ef4fa6ea
2 changed files with 10 additions and 2 deletions

View File

@ -76,3 +76,11 @@ function! text_obj#MdCodeBlock(type) abort
call setpos("'>", [buf_num, end_row, 1, 0]) call setpos("'>", [buf_num, end_row, 1, 0])
execute 'normal! `<V`>' execute 'normal! `<V`>'
endfunction 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

View File

@ -186,6 +186,6 @@ xnoremap <silent> iu :<C-U>call text_obj#URL()<CR>
onoremap <silent> iu :<C-U>call text_obj#URL()<CR> onoremap <silent> iu :<C-U>call text_obj#URL()<CR>
" Text objects for entire buffer " Text objects for entire buffer
xnoremap <silent> iB 0ggoG xnoremap <silent> iB :<C-U>call text_obj#Buffer()<CR>
onoremap <silent> iB :normal viB<CR> onoremap <silent> iB :<C-U>call text_obj#Buffer()<CR>
"} "}