diff options
author | Matěj Cepl <mcepl@cepl.eu> | 2023-03-16 21:28:54 +0100 |
---|---|---|
committer | Matěj Cepl <mcepl@cepl.eu> | 2023-03-16 23:36:12 +0100 |
commit | 56db06a6005da8903ca246d3c283153f0c721b00 (patch) | |
tree | 958ce9b810a1dc766e3f776dff2252d68cd21c07 | |
parent | 702a537e4d701a7fb9af8a2deb1fcd44d79f706f (diff) | |
download | vim-diff_navigator-56db06a6005da8903ca246d3c283153f0c721b00.tar.gz |
Not yet
-rw-r--r-- | ftplugin/diff_navigator.lua.new (renamed from ftplugin/diff_navigator.lua) | 10 | ||||
-rw-r--r-- | ftplugin/diff_navigator.vim (renamed from ftplugin/diff_navigator.vim.orig) | 7 |
2 files changed, 6 insertions, 11 deletions
diff --git a/ftplugin/diff_navigator.lua b/ftplugin/diff_navigator.lua.new index 910121c..96f09da 100644 --- a/ftplugin/diff_navigator.lua +++ b/ftplugin/diff_navigator.lua.new @@ -24,6 +24,8 @@ -- TODO: option for *Next|Prev* funtions to wrap around end of file -- ============================================================================ +-- FIXME https://www.reddit.com/r/neovim/comments/unwvkw/github_hkuptyrunesnvim_lua_test_framework_for/ +-- FIXME https://github.com/hkupty/runes.nvim -- Only do this when not done yet for this buffer -- Usually, not needed, just for the keeping normal API @@ -124,7 +126,7 @@ function countLines(start, endline) local old_lines = 0 local new_lines = 0 - for line in vim.fn.getline(start, endline) do + for line in pairs(vim.fn.getline(start, endline)) do local first_char = vim.fn.strpart(line, 0, 1) if first_char == ' ' then local context_lines = context_lines + 1 @@ -213,8 +215,8 @@ function DiffSplitHunk() -- Start line below header and stop one line above the current line local diff_lines = countLines(old_cur_header['line'] + 1, cur_line_no - 1) - local diff_old = diff_lines[0] - local diff_new = diff_lines[1] + local diff_old = diff_lines[1] + local diff_new = diff_lines[2] -- IN THE NEW START HUNK HEADER -- 1. length is number of lines above the current position which @@ -275,7 +277,7 @@ function DiffDeleteHunk() else local count_lines = countLines(start_hunk_line + 1, next_hunk_line - 1) - local added_lines = count_lines[1] - count_lines[0] + local added_lines = count_lines[2] - count_lines[1] vim.fn.setpos(".", {0, next_hunk_line, 1, 0}) vim.cmd("normal " .. start_hunk_line .. "," .. (next_hunk_line - 1) .. "d") diff --git a/ftplugin/diff_navigator.vim.orig b/ftplugin/diff_navigator.vim index b09c8cf..7e28b36 100644 --- a/ftplugin/diff_navigator.vim.orig +++ b/ftplugin/diff_navigator.vim @@ -38,13 +38,6 @@ if exists("g:loaded_diff_navigator") endif let g:loaded_diff_navigator = 1 -lua << EOF - local tbl = {1, 2, 3} - for k, v in ipairs(tbl) do - print(v) - end -EOF - function s:checkFilterDiff() if !executable('filterdiff') echohl WarningMsg |