From 11f68198ec676ec3825fa6edd78c75515aa6034a Mon Sep 17 00:00:00 2001 From: "jakob.stendahl" Date: Wed, 20 Mar 2024 11:44:03 +0100 Subject: Better git log, invert timestamp --- Common/nvim/lua/helper_functions.lua | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'Common/nvim/lua') diff --git a/Common/nvim/lua/helper_functions.lua b/Common/nvim/lua/helper_functions.lua index bf5eec3..6c12495 100755 --- a/Common/nvim/lua/helper_functions.lua +++ b/Common/nvim/lua/helper_functions.lua @@ -148,7 +148,7 @@ function! GitHistoryForLine(start_line, end_line) endif let l:filepath = expand('%:p') - let l:git_cmd = 'git log -s --pretty=format:"%h %s (%an)" -L '.l:start_line.','.l:end_line.':"'.l:filepath.'"' + let l:git_cmd = 'git log -w -C -C -C -s --pretty=format:"%h %s (%an)" -L '.l:start_line.','.l:end_line.':"'.l:filepath.'"' let l:options = '--delimiter " " --preview "git show {1}"' call fzf#vim#grep(l:git_cmd, 1, {'options': l:options, 'sink': function('ShowCommitDiff')}, 0) endfunction @@ -158,4 +158,18 @@ nnoremap s :GitHistoryForLine vnoremap s :'<,'>GitHistoryForLine ]] - +-- Invert timestamp +function invertNumberUnderCursor() + local word = vim.fn.expand("") -- Get the word under the cursor + local number = tonumber(word) + if number then + local invertedNumber = 2147483648 - 1 - number + -- Replace the word under the cursor with the inverted number + vim.api.nvim_command('normal ciw'..invertedNumber) + else + print("The word under the cursor is not a valid number.") + end +end +vim.cmd [[ +command! InvertNumberUnderCursor lua invertNumberUnderCursor() +]] -- cgit v1.2.3