# HG changeset patch # User Meredith Howard # Date 1678518298 21600 # Node ID 15007f695dfb76e24184682b7bd391763973af4a # Parent 3b88450bda157a029771132ba685eff0345cb4a3 clean up unused vim fns diff --git a/.config/nvim/autoload/vimrc.vim b/.config/nvim/autoload/vimrc.vim --- a/.config/nvim/autoload/vimrc.vim +++ b/.config/nvim/autoload/vimrc.vim @@ -10,26 +10,6 @@ func! vimrc#AutoFmtToggle() abort endif endfunc -" Make paths when writing, as necessary -func! vimrc#MkNonExDir(file, buf) abort - if empty(getbufvar(a:buf, '&buftype')) && a:file!~#'\v^\w+\:\/' - let dir=fnamemodify(a:file, ':h') - if !isdirectory(dir) - call mkdir(dir, 'p') - endif - endif -endfunc - -func! vimrc#AutoSessionCheck() abort - if strlen(v:servername) > 0 && match(v:servername, 'VIM') == -1 - let sessionfile = g:vimcache . "/session/" . tolower(v:servername) . ".vim" - - if filereadable(sessionfile) - execute "source " . sessionfile - endif - endif -endfunc - func! vimrc#Grep(...) abort let pattern = get(a:000, 0, expand('')) let cmd = join([&grepprg, shellescape(pattern)] + a:000[1:], ' ') @@ -89,12 +69,6 @@ END_PERL endfunc endif -func! vimrc#PrepDir(path) abort - if !filewritable(a:path) - call mkdir(a:path, 'p', 0700) - endif -endfunc - if has('ruby') func! s:PruneFiles(path, days) abort ruby <> neovim specific @@ -25,52 +30,59 @@ autocmd("FocusGained", "*", cb(cmd.check -- >> autowriteall improvment -- Stopinsert on leave, or autowriteall doesn't work. -autocmd({"WinLeave", "FocusLost"}, "*", { callback = function(_) - if not fn.pumvisible() then - fn.stopinsert() - end -end }) +autocmd({ "WinLeave", "FocusLost" }, "*", { + callback = function(_) + if not fn.pumvisible() then + fn.stopinsert() + end + end, +}) -- write all on leave autocmd("FocusLost", "*", cb(cmd.wa)) - -- >> auto mkpath on write -autocmd("BufWritePre", "*", { callback = function(ctx) - if vim.bo[ctx.buf].buftype == "" - and not string.match(ctx.file, "^[%w]+:") - then - fn.mkdir(fn.fnamemodify(ctx.file, ":p:h"), "p") - end -end }) +autocmd("BufWritePre", "*", { + callback = function(ctx) + if vim.bo[ctx.buf].buftype == "" and not string.match(ctx.file, "^[%w]+:") then + fn.mkdir(fn.fnamemodify(ctx.file, ":p:h"), "p") + end + end, +}) -- >> auto session ? -- >> jump to last position on open -autocmd("BufReadPost", "*", { callback = function(_) - local ft = vim.bo.filetype - if ft == "mail" or string.match(ft, "^git") or string.match(ft, "^hg") then - return '' - end +autocmd("BufReadPost", "*", { + callback = function(_) + local ft = vim.bo.filetype + if ft == "mail" or string.match(ft, "^git") or string.match(ft, "^hg") then + return "" + end - local lastpos = fn.line([['"]]) - if lastpos >= 1 and lastpos <= fn.line("$") then - vim.cmd([[normal! g`"]]) - end -end }) + local lastpos = fn.line([['"]]) + if lastpos >= 1 and lastpos <= fn.line("$") then + vim.cmd([[normal! g`"]]) + end + end, +}) -- >> simple highlight conflict markers -autocmd("BufReadPost", "*", { callback = function(_) - fn.matchadd("Error", [[^\([<>|]\)\{7} \@=\|^=\{7}$]]) -end }) +autocmd("BufReadPost", "*", { + callback = function(_) + fn.matchadd("Error", [[^\([<>|]\)\{7} \@=\|^=\{7}$]]) + end, +}) -- >> nicer quickfix -autocmd("BufReadPost", "quickfix", { callback = function(ctx) - -- simplify noisy :ltag output - if string.match(vim.w.quickfix_title, "^ltag") then - fn.matchadd("Conceal", [[|\zs\^\\V\|\\$|.*]]) - end +autocmd("BufReadPost", "quickfix", { + callback = function(ctx) + -- simplify noisy :ltag output + if string.match(vim.w.quickfix_title, "^ltag") then + fn.matchadd("Conceal", [[|\zs\^\\V\|\\$|.*]]) + end - -- easy close - vim.keymap.set("n", "q", "q", {buffer = true}) -end }) + -- easy close + vim.keymap.set("n", "q", "q", { buffer = true }) + end, +}) diff --git a/.config/nvim/lua/local/tig.lua b/.config/nvim/lua/local/tig.lua --- a/.config/nvim/lua/local/tig.lua +++ b/.config/nvim/lua/local/tig.lua @@ -24,14 +24,14 @@ local function setup(config) api.nvim_create_user_command("Tig", tig, { nargs = "*", complete = "file" }) api.nvim_create_user_command("TigBlame", function() - tig({fargs = {"blame", "+" .. fn.line("."), "--", fn.expand("%")}}) + tig({ fargs = { "blame", "+" .. fn.line("."), "--", fn.expand("%") } }) end, {}) api.nvim_create_user_command("TigLog", function() - tig({fargs = {"log", "-p", "--", fn.expand("%")}}) + tig({ fargs = { "log", "-p", "--", fn.expand("%") } }) end, {}) end return { - setup = setup + setup = setup, }