aboutsummaryrefslogtreecommitdiffstats
path: root/autoload/grappele.vim
blob: f9c7bd3d4224f1ad1cd8a4ce2506ab3254546362 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
function! grappele#Grappele(line, ...)
	let l:current_buffer = 0
	let l:column_position = 0
	let l:column_offset = 0

	let l:mode = get(a:, 1, '')

	normal! m'

	if l:mode ==# 'v'
		normal! V
	endif

	if a:line ==# 0
		" Go to the end of the buffer
		$
	else
		let s:line = a:line

		call setpos('.', [
			\ l:current_buffer,
			\ a:line,
			\ l:column_position,
			\ l:column_offset
		\ ])
	endif
endfunction

function! grappele#Recall(mode)
	if exists('s:line')
		call grappele#Grappele(s:line, a:mode)
	endif
endfunction