22 lines
764 B
Lua
22 lines
764 B
Lua
|
-- 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('<afile>: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 <buffer><silent> q :close<CR>]])
|
||
|
vim.cmd([[autocmd FileType man nnoremap <buffer><silent> q :quit<CR>]])
|