-- Check if we need to reload the file when it changed vim.cmd("au FocusGained * :checktime") -- show cursor line only in active window vim.cmd([[ autocmd InsertLeave,WinEnter * set cursorline autocmd InsertEnter,WinLeave * set nocursorline ]]) -- create directories when needed, when saving a file vim.api.nvim_create_autocmd("BufWritePre", { group = vim.api.nvim_create_augroup("auto_create_dir", { clear = true }), command = [[call mkdir(expand(':p:h'), 'p')]], }) -- Highlight on yank vim.cmd("au TextYankPost * lua vim.highlight.on_yank {}") -- windows to close with "q" vim.cmd([[autocmd FileType help,startuptime,qf,lspinfo nnoremap q :close]]) vim.cmd([[autocmd FileType man nnoremap q :quit]])