aboutsummaryrefslogtreecommitdiffstats
path: root/autoload/grappele.vim
blob: 1b1a71a24eb718b35494b413eefbb4e9f12414af (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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, '')
	" let l:visualmode = get(a:, 2, '')
    "
	" normal! m'
    "
	" if l:mode ==# 'v'
	" 	execute 'normal! ' . l:visualmode
	" elseif l:mode ==# 'o'
	" 	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

	let l:line = ''

	if a:line !=# 0
		let s:line = a:line
	endif

	echom s:line . 'G'
	return 'G'
endfunction

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

		let l:line = s:line

		" if a:mode ==# 'o'
			" let l:line += 1
			" return ':normal! V' . l:line . "G\<cr>"
		if a:mode ==# 'v'
			let l:line = visualmode() . l:line
		endif

		" echom 'Recall: ' . l:line
		execute 'normal! ' . l:line . 'G'
	endif
endfunction

function! grappele#ORecall()
	if exists('s:line')
		return ':normal! V' . s:line . "G\<cr>"
	endif
endfunction