nixvim/config/auto_cmds.nix
Wael Nasreddine 0f42b0eebb
treewide: format all files (#57)
Run `nix fmt` at the root of the repository to format all files. I've
done this on my fork and this will help me merge your changes later
without having to deal with un-formatted files.
2024-11-26 09:47:49 +01:00

75 lines
1.5 KiB
Nix

{
autoGroups = {
highlight_yank = { };
vim_enter = { };
indentscope = { };
restore_cursor = { };
};
autoCmd = [
{
group = "highlight_yank";
event = [ "TextYankPost" ];
pattern = "*";
callback = {
__raw = ''
function()
vim.highlight.on_yank()
end
'';
};
}
{
group = "vim_enter";
event = [ "VimEnter" ];
pattern = "*";
callback = {
__raw = ''
function()
vim.cmd('Startup')
end
'';
};
}
{
group = "indentscope";
event = [ "FileType" ];
pattern = [
"help"
"Startup"
"startup"
"neo-tree"
"Trouble"
"trouble"
"notify"
];
callback = {
__raw = ''
function()
vim.b.miniindentscope_disable = true
end
'';
};
}
## from NVChad https://nvchad.com/docs/recipes (this autocmd will restore the cursor position when opening a file)
{
group = "restore_cursor";
event = [ "BufReadPost" ];
pattern = "*";
callback = {
__raw = ''
function()
if
vim.fn.line "'\"" > 1
and vim.fn.line "'\"" <= vim.fn.line "$"
and vim.bo.filetype ~= "commit"
and vim.fn.index({ "xxd", "gitrebase" }, vim.bo.filetype) == -1
then
vim.cmd "normal! g`\""
end
end
'';
};
}
];
}