From a6d912e02f5c6a8fcd1fb8a52854fcb9782ed07e Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sat, 28 Oct 2017 17:16:14 -0400 Subject: simplify --- vimrc | 33 ++++++--------------------------- 1 file changed, 6 insertions(+), 27 deletions(-) (limited to 'vimrc') diff --git a/vimrc b/vimrc index f0e672c..96bb14b 100644 --- a/vimrc +++ b/vimrc @@ -459,37 +459,16 @@ xnoremap K :call Help(1, [], 'man') " }}} " auto-append closing characters {{{ function s:move_cursor_left() - let l:pos = getcurpos() - let l:newpos = [ - \ l:pos[0], - \ l:pos[1], - \ l:pos[2] - 1, - \ l:pos[3], - \ l:pos[2] - 1, - \] - call setpos('.', l:newpos) + let [l:bufnr, l:lnum, l:col, l:off, l:curswant] = getcurpos() + call setpos('.', [l:bufnr, l:lnum, l:col - 1, 0, l:col - 1]) endfunction function s:move_cursor_right() - let l:pos = getcurpos() - let l:newpos = [ - \ l:pos[0], - \ l:pos[1], - \ l:pos[2] + 1, - \ l:pos[3], - \ l:pos[2] + 1, - \] - call setpos('.', l:newpos) + let [l:bufnr, l:lnum, l:col, l:off, l:curswant] = getcurpos() + call setpos('.', [l:bufnr, l:lnum, l:col + 1, 0, l:col + 1]) endfunction function s:move_cursor_to_pos(lnum, col) - let l:pos = getcurpos() - let l:newpos = [ - \ l:pos[0], - \ a:lnum, - \ a:col, - \ 0, - \ a:col, - \] - call setpos('.', l:newpos) + let [l:bufnr, l:lnum, l:col, l:off, l:curswant] = getcurpos() + call setpos('.', [l:bufnr, a:lnum, a:col, 0, a:col]) endfunction let s:pair_bs_maps = { \ '"': "maybe_remove_adjacent_char('\"')", -- cgit v1.2.3-54-g00ecf