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

changeset 1156
0a7162df160d
parent 1155
fcec334dfe7a
child 1157
a237720efee9
equal deleted inserted replaced
1155:fcec334dfe7a 1156:0a7162df160d
1 local command = vim.api.nvim_create_user_command 1 local command = vim.api.nvim_create_user_command
2 local cmd, fn = vim.cmd, vim.fn 2 local cmd, fn = vim.cmd, vim.fn
3 local util = require("config.util")
3 4
4 require("config.util").calias({ 5 util.calias({
5 -- replace default: 6 -- replace default:
6 grep = "Grep", 7 grep = "Grep",
7 8
8 -- typos: 9 -- typos:
9 Q = "q", 10 Q = "q",
53 for _, bufnr in ipairs(bufs) do 54 for _, bufnr in ipairs(bufs) do
54 local name = vim.api.nvim_buf_get_name(bufnr) 55 local name = vim.api.nvim_buf_get_name(bufnr)
55 if name then 56 if name then
56 local type = vim.fn.getftype(name) 57 local type = vim.fn.getftype(name)
57 if type == "" or type == "dir" 58 if type == "" or type == "dir"
58 or (os.time() - vim.fn.getftime(name)) > 2592000 59 or util.last_modified_days(name) > 30
59 then 60 then
60 vim.print("pruned: " .. name) 61 vim.print("pruned: " .. name)
61 vim.cmd.bwipeout(bufnr) 62 vim.cmd.bwipeout(bufnr)
62 end 63 end
63 end 64 end

mercurial