.config/nvim/lua/config/commands.lua

changeset 1157
a237720efee9
parent 1156
0a7162df160d
equal deleted inserted replaced
1156:0a7162df160d 1157:a237720efee9
52 command("PruneSession", function() 52 command("PruneSession", function()
53 local bufs = vim.api.nvim_list_bufs() 53 local bufs = vim.api.nvim_list_bufs()
54 for _, bufnr in ipairs(bufs) do 54 for _, bufnr in ipairs(bufs) do
55 local name = vim.api.nvim_buf_get_name(bufnr) 55 local name = vim.api.nvim_buf_get_name(bufnr)
56 if name then 56 if name then
57 local type = vim.fn.getftype(name) 57 local type = fn.getftype(name)
58 if type == "" or type == "dir" 58 if type == "" or type == "dir"
59 or util.last_modified_days(name) > 30 59 or util.last_modified_days(name) > 30
60 then 60 then
61 vim.print("pruned: " .. name) 61 vim.print("pruned: " .. name)
62 vim.cmd.bwipeout(bufnr) 62 cmd.bwipeout(bufnr)
63 end 63 end
64 end 64 end
65 end 65 end
66 if not vim.api.nvim_buf_get_name(0) then 66 if not vim.api.nvim_buf_get_name(0) then
67 vim.cmd.bprev() 67 cmd.bprev()
68 end 68 end
69 end, {}) 69 end, {})

mercurial