@@ -17,7 +17,8 @@ function he.setup()
17
17
end
18
18
19
19
function he .encode ()
20
- local buf = vim .api .nvim_buf_get_lines (0 , 0 , - 1 , false )
20
+ local bufIndex = vim .api .nvim_get_current_buf ()
21
+ local buf = vim .api .nvim_buf_get_lines (bufIndex , 0 , - 1 , false )
21
22
22
23
local encodedBuf = {}
23
24
local eob = 0
@@ -32,11 +33,12 @@ function he.encode()
32
33
eob = n
33
34
end
34
35
-- update the buffer
35
- vim .api .nvim_buf_set_lines (0 , 0 , eob , false , encodedBuf )
36
+ vim .api .nvim_buf_set_lines (bufIndex , 0 , eob , false , encodedBuf )
36
37
end
37
38
38
39
function he .decode ()
39
- local buf = vim .api .nvim_buf_get_lines (0 , 0 , - 1 , false )
40
+ local bufIndex = vim .api .nvim_get_current_buf ()
41
+ local buf = vim .api .nvim_buf_get_lines (bufIndex , 0 , - 1 , false )
40
42
41
43
local decodedBuf = {}
42
44
local eob = 0
@@ -51,7 +53,7 @@ function he.decode()
51
53
eob = n
52
54
end
53
55
-- update the buffer
54
- vim .api .nvim_buf_set_lines (0 , 0 , eob , false , decodedBuf )
56
+ vim .api .nvim_buf_set_lines (bufIndex , 0 , eob , false , decodedBuf )
55
57
end
56
58
57
59
he .options = nil
0 commit comments