Update 2026-01-25 09:38 OpenBSD/amd64-t14

This commit is contained in:
c0dev0id
2026-01-25 09:38:17 +01:00
parent 0769d7a789
commit 186dfa8096
1240 changed files with 189747 additions and 315946 deletions

View File

@@ -0,0 +1 @@
doc/tags

View File

@@ -1,6 +1,6 @@
BSD 3-Clause License
Copyright (c) 2024, the VIM undotree plug-in authors
Copyright (c) 2025, the VIM undotree plug-in authors
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

View File

@@ -58,6 +58,7 @@ let s:helpmore = ['" ===== Marks ===== ',
\'" >num< : The current state',
\'" {num} : The next redo state',
\'" [num] : The latest state',
\'" =num= : The diff mark',
\'" s : Saved states',
\'" S : The last saved state',
\'" ===== Hotkeys =====']
@@ -85,6 +86,8 @@ let s:keymap += [['FocusTarget','<tab>','Set Focus back to the editor']]
let s:keymap += [['ClearHistory','C','Clear undo history (with confirmation)']]
let s:keymap += [['TimestampToggle','T','Toggle relative timestamp']]
let s:keymap += [['DiffToggle','D','Toggle the diff panel']]
let s:keymap += [['DiffMark','=','Set the diff marker']]
let s:keymap += [['ClearDiffMark','M','Clear the diff marker']]
let s:keymap += [['NextState','K','Move to the next undo state']]
let s:keymap += [['PreviousState','J','Move to the previous undo state']]
let s:keymap += [['NextSavedState','>','Move to the next saved state']]
@@ -96,16 +99,16 @@ let s:keymap += [['Enter','<cr>','Move to the current state']]
" 'Diff' sign definitions. There are two 'delete' signs; a 'normal' one and one
" that is used if the very end of the buffer has been deleted (in which case the
" deleted text is actually bejond the end of the current buffer version and therefore
" deleted text is actually beyond the end of the current buffer version and therefore
" it is not possible to place a sign on the exact line - because it doesn't exist.
" Instead, a 'special' delete sign is placed on the (existing) last line of the
" buffer)
exe 'sign define UndotreeAdd text=++ texthl='.undotree_HighlightSyntaxAdd
exe 'sign define UndotreeChg text=~~ texthl='.undotree_HighlightSyntaxChange
exe 'sign define UndotreeDel text=-- texthl='.undotree_HighlightSyntaxDel
exe 'sign define UndotreeDelEnd text=-v texthl='.undotree_HighlightSyntaxDel
exe 'sign define UndotreeAdd text='.undotree_SignAdded.' texthl='.undotree_HighlightSyntaxAdd
exe 'sign define UndotreeChg text='.undotree_SignChanged.' texthl='.undotree_HighlightSyntaxChange
exe 'sign define UndotreeDel text='.undotree_SignDeleted.' texthl='.undotree_HighlightSyntaxDel
exe 'sign define UndotreeDelEnd text='.undotree_SignDeletedEnd.' texthl='.undotree_HighlightSyntaxDel
" Id to use for all signs. This is an arbirary number that is hoped to be unique
" Id to use for all signs. This is an arbitrary number that is hoped to be unique
" within the instance of vim. There is no way of guaranteeing it IS unique, which
" is a shame because it needs to be!
"
@@ -301,6 +304,7 @@ function! s:undotree.Init() abort
" Increase to make it unique.
let self.width = g:undotree_SplitWidth
let self.opendiff = g:undotree_DiffAutoOpen
let self.diffmark = -1 " Marker for the diff view
let self.targetid = -1
let self.targetBufnr = -1
let self.rawtree = {} "data passed from undotree()
@@ -389,7 +393,7 @@ endfunction
function! s:undotree.ActionHelp() abort
let self.showHelp = !self.showHelp
call self.Draw()
call self.MarkSeqs()
call self.MarkSeqs(1)
endfunction
function! s:undotree.ActionFocusTarget() abort
@@ -436,6 +440,32 @@ function! s:undotree.ActionNextSavedState() abort
call self.ActionInTarget('later 1f')
endfunction
function! s:undotree.ActionDiffMark() abort
let index = self.Screen2Index(line('.'))
if index < 0
return
endif
let seq = self.asciimeta[index].seq
if seq == -1
return
endif
if seq == self.diffmark
let self.diffmark = -1
else
let self.diffmark = seq
endif
call self.UpdateDiff()
call self.Draw()
call self.MarkSeqs(0)
endfunction
function! s:undotree.ActionClearDiffMark() abort
let self.diffmark = -1
call self.UpdateDiff()
call self.Draw()
call self.MarkSeqs(1)
endfunction
function! s:undotree.ActionDiffToggle() abort
let self.opendiff = !self.opendiff
call t:diffpanel.Toggle()
@@ -480,7 +510,7 @@ function! s:undotree.UpdateDiff() abort
if !t:diffpanel.IsVisible()
return
endif
call t:diffpanel.Update(self.seq_cur,self.targetBufnr,self.targetid)
call t:diffpanel.Update(self.seq_cur,self.targetBufnr,self.targetid,self.diffmark)
endfunction
" May fail due to target window closed.
@@ -488,7 +518,7 @@ function! s:undotree.SetTargetFocus() abort
for winnr in range(1, winnr('$')) "winnr starts from 1
if getwinvar(winnr,'undotree_id') == self.targetid
if winnr() != winnr
call s:exec("norm! ".winnr."\<c-w>\<c-w>")
call s:exec_silent("norm! ".winnr."\<c-w>\<c-w>")
return 1
endif
endif
@@ -577,9 +607,13 @@ function! s:undotree.Show() abort
setlocal nocursorline
endif
setlocal nomodifiable
setlocal statusline=%!t:undotree.GetStatusLine()
if g:undotree_StatusLine
setlocal statusline=%!t:undotree.GetStatusLine()
endif
setfiletype undotree
" Make :q call ActionClose
cabbrev <silent><buffer> q :call t:undotree.ActionClose()<CR>
call self.BindKey()
call self.BindAu()
@@ -607,12 +641,17 @@ function! s:undotree.Update() abort
if exists('b:isUndotreeBuffer')
return
endif
" let the user disable undotree for chosen buftypes
if index(g:undotree_DisabledBuftypes, &buftype) != -1
call s:log("undotree.Update() disabled buftype")
return
endif
" let the user disable undotree for chosen filetypes
if index(g:undotree_DisabledFiletypes, &filetype) != -1
call s:log("undotree.Update() disabled filetype")
return
endif
if (&bt != '' && &bt != 'acwrite') || (&modifiable == 0) || (mode() != 'n')
if &bt == 'quickfix' || &bt == 'nofile'
"Do nothing for quickfix and q:
call s:log("undotree.Update() ignore quickfix")
return
endif
if self.targetBufnr == bufnr('%') && self.targetid == w:undotree_id
call s:log("undotree.Update() invalid buffer NOupdate")
return
@@ -641,7 +680,7 @@ function! s:undotree.Update() abort
return
endif
call self.SetFocus()
call self.MarkSeqs()
call self.MarkSeqs(1)
call self.UpdateDiff()
return
endif
@@ -664,7 +703,7 @@ function! s:undotree.Update() abort
call self.Render()
call self.SetFocus()
call self.Draw()
call self.MarkSeqs()
call self.MarkSeqs(1)
call self.UpdateDiff()
endfunction
@@ -739,7 +778,7 @@ function! s:undotree.Draw() abort
setlocal nomodifiable
endfunction
function! s:undotree.MarkSeqs() abort
function! s:undotree.MarkSeqs(move_cursor) abort
call s:log("bak(cur,curhead,newhead): ".
\self.seq_cur_bak.' '.
\self.seq_curhead_bak.' '.
@@ -780,8 +819,10 @@ function! s:undotree.MarkSeqs() abort
let lineNr = self.Index2Screen(index)
call setline(lineNr,substitute(getline(lineNr),
\'\zs \(\d\+\) \ze [sS ] ','>\1<',''))
" move cursor to that line.
call s:exec("normal! " . lineNr . "G")
if a:move_cursor
" move cursor to that line.
call s:exec("normal! " . lineNr . "G")
endif
endif
if self.seq_curhead != -1
let index = self.seq2index[self.seq_curhead]
@@ -795,6 +836,13 @@ function! s:undotree.MarkSeqs() abort
call setline(lineNr,substitute(getline(lineNr),
\'\zs \(\d\+\) \ze [sS ] ','[\1]',''))
endif
" mark diff marker
if self.diffmark != -1
let index = self.seq2index[self.diffmark]
let lineNr = self.Index2Screen(index)
call setline(lineNr, substitute(getline(lineNr),
\ '\zs \(\d\+\) \ze [sS ]', '=\1=', ''))
endif
setlocal nomodifiable
endfunction
@@ -935,7 +983,7 @@ function! s:undotree.Render() abort
endif
endfor
" Then, find the element with minimun seq.
" Then, find the element with minimum seq.
let minseq = 99999999
let minnode = {}
if foundx == 0
@@ -1056,8 +1104,8 @@ endfunction
"diff panel
let s:diffpanel = s:new(s:panel)
function! s:diffpanel.Update(seq,targetBufnr,targetid) abort
call s:log('diffpanel.Update(),seq:'.a:seq.' bufname:'.bufname(a:targetBufnr))
function! s:diffpanel.Update(seq,targetBufnr,targetid,diffmark) abort
call s:log('diffpanel.Update(),seq:'.a:seq.' bufname:'.bufname(a:targetBufnr).' diffmark:'.a:diffmark)
if !self.diffexecutable
return
endif
@@ -1068,9 +1116,9 @@ function! s:diffpanel.Update(seq,targetBufnr,targetid) abort
if a:seq == 0
let diffresult = []
else
if has_key(self.cache,a:targetBufnr.'_'.a:seq)
if has_key(self.cache,a:targetBufnr.'_'.a:seq.'_'.a:diffmark)
call s:log("diff cache hit.")
let diffresult = self.cache[a:targetBufnr.'_'.a:seq]
let diffresult = self.cache[a:targetBufnr.'_'.a:seq.'_'.a:diffmark]
else
" Double check the target winnr and bufnr
let targetWinnr = -1
@@ -1092,10 +1140,29 @@ function! s:diffpanel.Update(seq,targetBufnr,targetid) abort
" remember and restore cursor and window position.
let savedview = winsaveview()
let new = getbufline(a:targetBufnr,'^','$')
silent undo
let old = getbufline(a:targetBufnr,'^','$')
silent redo
let new = []
let old = []
let diff_dist = 1
if a:diffmark != -1
let diff_dist = a:seq - a:diffmark
if diff_dist > 0
let new = getbufline(a:targetBufnr,'^','$')
execute 'silent earlier ' . diff_dist
let old = getbufline(a:targetBufnr,'^','$')
execute 'silent later ' . diff_dist
else
let old = getbufline(a:targetBufnr,'^','$')
execute 'silent later ' . (-diff_dist)
let new = getbufline(a:targetBufnr,'^','$')
execute 'silent earlier ' . (-diff_dist)
endif
else
let new = getbufline(a:targetBufnr,'^','$')
silent undo
let old = getbufline(a:targetBufnr,'^','$')
silent redo
endif
call winrestview(savedview)
@@ -1118,7 +1185,7 @@ function! s:diffpanel.Update(seq,targetBufnr,targetid) abort
endif
let &eventignore = ei_bak
"Update cache
let self.cache[a:targetBufnr.'_'.a:seq] = diffresult
let self.cache[a:targetBufnr.'_'.a:seq.'_'.a:diffmark] = diffresult
endif
endif
@@ -1130,7 +1197,15 @@ function! s:diffpanel.Update(seq,targetBufnr,targetid) abort
call s:exec('1,$ d _')
call append(0,diffresult)
call append(0,'- seq: '.a:seq.' -')
if a:diffmark == -1 || a:seq == a:diffmark
call append(0,'+ seq: '.a:seq.' +')
elseif a:seq > a:diffmark
call append(0,'+ seq: '.a:seq.' +')
call append(0,'- seq: '.a:diffmark.' -')
else
call append(0,'+ seq: '.a:diffmark.' +')
call append(0,'- seq: '.a:seq.' -')
endif
"remove the last empty line
if getline("$") == ""
@@ -1293,7 +1368,9 @@ function! s:diffpanel.Show() abort
setlocal norelativenumber
setlocal nocursorline
setlocal nomodifiable
setlocal statusline=%!t:diffpanel.GetStatusLine()
if g:undotree_StatusLine
setlocal statusline=%!t:diffpanel.GetStatusLine()
endif
let &eventignore = ei_bak

View File

@@ -27,10 +27,17 @@ CONTENTS *undotree-contents*
3.11 undotree_HighlightChangedText .. |undotree_HighlightChangedText|
3.12 undotree_HighlightSyntaxAdd .... |undotree_HighlightSyntaxAdd|
undotree_HighlightSyntaxChange . |undotree_HighlightSyntaxChange|
3.13 Undotree_CustomMap ............. |Undotree_CustomMap|
3.14 undotree_HelpLine .............. |undotree_HelpLine|
3.15 undotree_CursorLine ............ |undotree_CursorLine|
3.16 undotree_UndoDir................ |undotree_UndoDir|
3.13 undotree_SignAdded ............. |undotree_SignAdded|
undotree_SignModified .......... |undotree_SignModified|
undotree_SignDeleted ........... |undotree_SignDeleted|
undotree_SignDeletedEnd ........ |undotree_SignDeletedEnd|
3.14 Undotree_CustomMap ............. |Undotree_CustomMap|
3.15 undotree_HelpLine .............. |undotree_HelpLine|
3.16 undotree_CursorLine ............ |undotree_CursorLine|
3.17 undotree_StatusLine ............ |undotree_StatusLine|
3.18 undotree_DisabledFiletypes...... |undotree_DisabledFiletypes|
3.19 undotree_DisabledBuftypes....... |undotree_DisabledBuftypes|
3.20 undotree_UndoDir................ |undotree_UndoDir|
4. Bugs ................................. |undotree-bugs|
5. Changelog ............................ |undotree-changelog|
6. License .............................. |undotree-license|
@@ -111,6 +118,9 @@ Markers
* Saved changes are marked as s and the big S indicates the most recent
saved change.
* The = number = marks user chosen change. When this mark is set the
diff panel displays diff between current seq and marked seq.
* Press ? in undotree window for quick help.
Persistent undo
@@ -394,7 +404,24 @@ You may chose your favorite through ":hi" command.
Default: "DiffAdd", "DiffDelete" and "DiffChange"
------------------------------------------------------------------------------
3.13 g:Undotree_CustomMap *Undotree_CustomMap*
3.13 g:undotree_SignAdded *undotree_SignAdded*
g:undotree_SignModified *undotree_SignModified*
g:undotree_SignDeleted *undotree_SignDeleted*
g:undotree_SignDeletedEnd *undotree_SignDeletedEnd*
Set the signs to display in the gutter where the file has been changed.
SignDeletedEnd is used when the last line of the buffer has been deleted;
it is not possible to display SignDeleted since the deleted text is actually
beyond the end of the current buffer version and therefore it is not possible
to place a sign on the exact line - because it doesn't exist.
Instead, a special delete sign is placed on the (existing) last line of the
buffer
Default: "++", "~~", "--" and "-v"
------------------------------------------------------------------------------
3.14 g:Undotree_CustomMap *Undotree_CustomMap*
There are two ways of changing the default key mappings:
The first way is to define global mappings as the following example:
@@ -426,24 +453,49 @@ List of the commands available for redefinition.
<plug>UndotreeRedo
<plug>UndotreeUndo
<plug>UndotreeEnter
<plug>UndotreeDiffMark
<plug>UndotreeClearDiffMark
<
------------------------------------------------------------------------------
3.14 g:undotree_HelpLine *undotree_HelpLine*
3.15 g:undotree_HelpLine *undotree_HelpLine*
Set to 0 to hide "Press ? for help".
Default: 1
------------------------------------------------------------------------------
3.15 g:undotree_CursorLine
3.16 g:undotree_CursorLine *undotree_CursorLine*
Set to 0 to disable cursorline.
Default: 1
------------------------------------------------------------------------------
3.16 g:undotree_UndoDir *undotree_UndoDir*
3.17 g:undotree_StatusLine
By default, Undotree will override your statusline option while in the
Undotree buffer.
Set to 0 to disable this.
Default: 1
------------------------------------------------------------------------------
3.18 g:undotree_DisabledFiletypes *undotree_DisabledFiletypes*
List of filetypes that Undotree will ignore.
Default: empty
------------------------------------------------------------------------------
3.19 g:undotree_DisabledBuftypes *undotree_DisabledBuftypes*
List of filetypes that Undotree will ignore.
Default: ['terminal', 'prompt', 'quickfix']
------------------------------------------------------------------------------
3.20 g:undotree_UndoDir *undotree_UndoDir*
Set the path for the persistence undo directory. Due to the differing formats
of the persistence undo files between nvim and vim, the default undodir for

View File

@@ -160,6 +160,20 @@ if !exists('g:undotree_HighlightSyntaxDel')
let g:undotree_HighlightSyntaxDel = "DiffDelete"
endif
" Signs to display in the gutter where the file has been modified
if !exists('g:undotree_SignAdded')
let g:undotree_SignAdded = "++"
endif
if !exists('g:undotree_SignChanged')
let g:undotree_SignChanged = "~~"
endif
if !exists('g:undotree_SignDeleted')
let g:undotree_SignDeleted = "--"
endif
if !exists('g:undotree_SignDeletedEnd')
let g:undotree_SignDeletedEnd = "-v"
endif
" Deprecates the old style configuration.
if exists('g:undotree_SplitLocation')
echo "g:undotree_SplitLocation is deprecated,
@@ -176,6 +190,21 @@ if !exists('g:undotree_CursorLine')
let g:undotree_CursorLine = 1
endif
" Set statusline
if !exists('g:undotree_StatusLine')
let g:undotree_StatusLine = 1
endif
" Ignored filetypes
if !exists('g:undotree_DisabledFiletypes')
let g:undotree_DisabledFiletypes = []
endif
" Ignored buftypes
if !exists('g:undotree_DisabledBuftypes')
let g:undotree_DisabledBuftypes = ['terminal', 'prompt', 'quickfix', 'nofile']
endif
" Define the default persistence undo directory if not defined in vim/nvim
" startup script.
if !exists('g:undotree_UndoDir')