aboutsummaryrefslogtreecommitdiff
path: root/Common/nvim/lua
diff options
context:
space:
mode:
authorjakob.stendahl <jakob.stendahl@infomedia.dk>2024-03-20 11:44:03 +0100
committerjakob.stendahl <jakob.stendahl@infomedia.dk>2024-03-20 11:44:03 +0100
commit11f68198ec676ec3825fa6edd78c75515aa6034a (patch)
treed8406f9a9ab67b4c3f0878f4fbf23a4c4bce94a7 /Common/nvim/lua
parent10adbb60b8d5090e7b5783bb3c2c3ff7689c0b68 (diff)
downloaddotfiles-11f68198ec676ec3825fa6edd78c75515aa6034a.tar.gz
dotfiles-11f68198ec676ec3825fa6edd78c75515aa6034a.zip
Better git log, invert timestamp
Diffstat (limited to 'Common/nvim/lua')
-rwxr-xr-xCommon/nvim/lua/helper_functions.lua18
1 files changed, 16 insertions, 2 deletions
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 <leader><leader>s :GitHistoryForLine<CR>
vnoremap <leader><leader>s :'<,'>GitHistoryForLine<CR>
]]
-
+-- Invert timestamp
+function invertNumberUnderCursor()
+ local word = vim.fn.expand("<cword>") -- 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()
+]]