summaryrefslogtreecommitdiff
path: root/files/vim/patches
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2025-10-17 12:22:00 -0400
committerAndrew Opalach <andrew@akon.city> 2025-10-17 12:32:42 -0400
commit544da1ba50d9cbf51a18ca0abf1db66b3baa7460 (patch)
tree1caa87664ea4937c5f4e6e8dc83c49b3132ddd70 /files/vim/patches
parent85a47287e56ba9100420246531ebea5996cc0486 (diff)
downloaddotfiles-544da1ba50d9cbf51a18ca0abf1db66b3baa7460.tar.gz
dotfiles-544da1ba50d9cbf51a18ca0abf1db66b3baa7460.tar.bz2
dotfiles-544da1ba50d9cbf51a18ca0abf1db66b3baa7460.zip
Gentoo desktop
Diffstat (limited to 'files/vim/patches')
-rw-r--r--files/vim/patches/qname_edit.diff178
-rw-r--r--files/vim/patches/vim_fugitive_tab_expand.diff17
2 files changed, 195 insertions, 0 deletions
diff --git a/files/vim/patches/qname_edit.diff b/files/vim/patches/qname_edit.diff
new file mode 100644
index 0000000..4ca65ff
--- /dev/null
+++ b/files/vim/patches/qname_edit.diff
@@ -0,0 +1,178 @@
+Post- dos2unix, Tabify, and Trim.
+--- a/qname.1.2.vim 2025-08-03 20:12:24.629096223 -0400
++++ b/qname.1.2.vim 2025-08-13 22:10:15.352953531 -0400
+@@ -7,7 +7,25 @@
+ " License: Vim License
+ " =============================================================================
+
++" https://www.vim.org/scripts/script.php?script_id=2317
++"
+ " Change Log
++" EDIT:
++" 2025-06-24:
++" Remove redraw on update
++" Don't wrap around in the list
++" ls! -> ls
++" <Tab> -> <C-j/k>
++" Take out built-in hotkey
++" 2025-08-05:
++" Use path relative to current dir
++" Match against file path
++" 2025-08-13:
++" Sort buffers by most recently used
++" Add bind to "flatten" the list
++" Replace fmatch() with built-in matchfuzzy() (speedup)
++" Fix logic to not include buffers with modifiable off
++"
+ " 1.2 2013-01-03
+ " ADD: <Tab> and <S-Tab> moves selection like <Up> and <Down>
+ " ADD: Use <silent> mapping to keep cmdline clear
+@@ -30,12 +48,6 @@
+ finish
+ endif
+
+-if !exists("g:qname_hotkey") || g:qname_hotkey == ""
+- let g:qname_hotkey = "<F3>"
+-endif
+-exe "nmap" g:qname_hotkey ":cal QNameInit(1)<cr>:~"
+-let s:qname_hotkey = eval('"\'.g:qname_hotkey.'"')
+-
+ if exists("g:qname_loaded") && g:qname_loaded
+ finish
+ endif
+@@ -70,16 +82,19 @@
+ call s:swb(str2nr(matchstr(s:s[_sel], '<\zs\d\+\ze>')))
+ endif
+ call QNameInit(0)
+- elseif _key ==# "\<Up>" || _key ==# "\<S-Tab>"
++ elseif _key ==# "\<Up>" || _key ==# "\<C-k>"
+ call s:colPrinter.vert(-1)
+- elseif _key ==# "\<Down>" || _key ==# "\<Tab>"
++ elseif _key ==# "\<Down>" || _key ==# "\<C-j>"
+ call s:colPrinter.vert(1)
+ elseif _key ==# "\<Left>"
+ call s:colPrinter.horz(-1)
+ elseif _key ==# "\<Right>"
+ call s:colPrinter.horz(1)
+- elseif _key ==# s:qname_hotkey
+- call QNameInit(0)
++ elseif _key ==# "\<C-f>"
++ let s:flat = 1 - s:flat
++ let prev_sel = s:colPrinter.sel
++ call s:build()
++ let s:colPrinter.sel = prev_sel
+ else
+ call s:build()
+ endif
+@@ -88,7 +103,6 @@
+ cal QNameInit(0)
+ finally
+ " clean up screen after dismissing search window
+- redraw!
+ call inputrestore()
+ endtry
+ endfunc
+@@ -99,6 +113,7 @@
+ let s:cmdh = &cmdheight
+ if a:start != -1
+ let s:inp = ""
++ let s:flat = 0
+ endif
+ call s:baselist()
+ call s:build()
+@@ -112,16 +127,27 @@
+ function! s:build()
+ let s:s = []
+ let s:n = []
++ let s:sp = []
++ let s:np = []
+ let s:blen = 0
+ let _cmp = tolower(tr(s:inp, '\', '/'))
+ for _line in s:ls
+- let _name = matchstr(_line, '^.\{-}\ze \+<')
+- if s:fmatch(tolower(_name), _cmp)
++ " Match everthing before |<xx>| Match everthing after space.
++ let _match = matchlist(_line, '^.\{-}\ze \+<.*> \+\(.*\)')
++ let _name = _match[0]
++ let _path = _match[1]
++ if strlen(_cmp) == 0 || s:fmatch(tolower(_name), _cmp)
+ cal add(s:s, _line)
+ cal add(s:n, _name)
++ elseif s:fmatch(tolower(_path), _cmp)
++ cal add(s:sp, _line)
++ cal add(s:np, _name)
+ endif
+ endfor
+- if len(s:n) > s:colPrinter.trow
++ " Put filename matches before path matches.
++ let s:n = s:n + s:np
++ let s:s = s:s + s:sp
++ if !s:flat && len(s:n) > s:colPrinter.trow
+ cal s:colPrinter.put(s:n)
+ else
+ cal s:colPrinter.put(s:s)
+@@ -137,37 +163,28 @@
+ endfunc
+
+ function! s:fmatch(src,pat)
+- let _si = strlen(a:src)-1
+- let _pi = strlen(a:pat)-1
+- while _si>=0 && _pi>=0
+- if a:src[_si] == a:pat[_pi]
+- let _pi -= 1
+- endif
+- let _si -= 1
+- endwhile
+- return _pi < 0
++ return len(matchfuzzy([a:src], a:pat)) > 0
+ endfunc
+
+ function! s:baselist()
+ let s:ls = []
+- redir => l:bufs | silent ls! | redir END
++ redir => l:bufs | silent ls t | redir END
+ for _line in split(l:bufs, "\n")
+- if _line[3]!='u' || _line[6]!='-'
++ if _line[6] != '-'
+ let _bno = matchstr(_line, '^ *\zs\d*')+0
+ let _fname = substitute(expand("#"._bno.":p"), '\', '/', 'g')
+ if _fname == ""
+ let _fname = "|".matchstr(_line, '"\[\zs[^\]]*')."|"
+ endif
+ let _name = fnamemodify(_fname,":t")
+- cal add(s:ls, _name." <"._bno."> ".fnamemodify(_fname,":h"))
++ cal add(s:ls, _name." <"._bno."> ".fnamemodify(_fname,":."))
+ endif
+ endfor
+ let _align = max(map(copy(s:ls),'stridx(v:val,">")'))
+ call map(s:ls, 'substitute(v:val, " <", repeat(" ",_align-stridx(v:val,">"))." <", "")')
+- cal sort(s:ls, 1)
+ endfunc
+
+-let s:colPrinter = {"trow": 4}
++let s:colPrinter = {"trow": 5}
+ function! s:colPrinter.put(its) dict
+ let _cols = []
+ let _trow = self.trow
+@@ -224,11 +241,7 @@
+ function! s:colPrinter.vert(mv) dict
+ let _t = self.sel + a:mv
+ let _len = self.len
+- if _t < 0 && _len > 0
+- let self.sel = _len-1
+- elseif _t >= _len
+- let self.sel = 0
+- else
++ if _t >= 0 && _t < _len
+ let self.sel = _t
+ endif
+ endfunc
+@@ -244,7 +257,7 @@
+ let _t = _sel/_trow
+ let _cpos = self.cpos
+ let _lcol = self.lcol
+- let _tcol = &columns
++ let _tcol = s:flat ? 1 : &columns
+ if _cpos[_lcol]+_tcol < _cpos[_t+1]
+ let _rcol = _t
+ let _pos = _cpos[_t+1]-_tcol-2
diff --git a/files/vim/patches/vim_fugitive_tab_expand.diff b/files/vim/patches/vim_fugitive_tab_expand.diff
new file mode 100644
index 0000000..aa7b0ef
--- /dev/null
+++ b/files/vim/patches/vim_fugitive_tab_expand.diff
@@ -0,0 +1,17 @@
+diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim
+index 7f2f602..fa178c4 100644
+--- a/autoload/fugitive.vim
++++ b/autoload/fugitive.vim
+@@ -2696,10 +2696,10 @@ function! s:MapStatus() abort
+ call s:Map('n', 'C', ":echoerr 'fugitive: C has been removed in favor of cc'<CR>", '<silent><unique>')
+ call s:Map('n', 'a', ":echoerr 'fugitive: a has been removed in favor of s'<CR>", '<silent><unique>')
+ call s:Map('n', 'i', ":<C-U>execute <SID>NextExpandedHunk(v:count1)<CR>", '<silent>')
+- call s:Map('n', "=", ":<C-U>execute <SID>StageInline('toggle',line('.'),v:count)<CR>", '<silent>')
++ call s:Map('n', "<Tab>", ":<C-U>execute <SID>StageInline('toggle',line('.'),v:count)<CR>", '<silent>')
+ call s:Map('n', "<", ":<C-U>execute <SID>StageInline('hide', line('.'),v:count)<CR>", '<silent>')
+ call s:Map('n', ">", ":<C-U>execute <SID>StageInline('show', line('.'),v:count)<CR>", '<silent>')
+- call s:Map('x', "=", ":<C-U>execute <SID>StageInline('toggle',line(\"'<\"),line(\"'>\")-line(\"'<\")+1)<CR>", '<silent>')
++ call s:Map('x', "<Tab>", ":<C-U>execute <SID>StageInline('toggle',line(\"'<\"),line(\"'>\")-line(\"'<\")+1)<CR>", '<silent>')
+ call s:Map('x', "<", ":<C-U>execute <SID>StageInline('hide', line(\"'<\"),line(\"'>\")-line(\"'<\")+1)<CR>", '<silent>')
+ call s:Map('x', ">", ":<C-U>execute <SID>StageInline('show', line(\"'<\"),line(\"'>\")-line(\"'<\")+1)<CR>", '<silent>')
+ call s:Map('n', 'D', ":echoerr 'fugitive: D has been removed in favor of dd'<CR>", '<silent><unique>')