Added base folke setup
This commit is contained in:
21
lua/config/commands.lua
Normal file
21
lua/config/commands.lua
Normal file
@@ -0,0 +1,21 @@
|
||||
-- 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>]])
|
Reference in New Issue
Block a user