Files
nixos-config/modules/home/programs/nixvim/autocmd.nix

52 lines
1.3 KiB
Nix
Executable File

{ pkgs, self, ... }: {
programs.nixvim = {
autoCmd = [
{
command = "silent! mkview";
event = [ "BufWinLeave" ];
pattern = [ "*" ];
desc =
"Save session window settings to be loaded next time the file is opened";
}
{
command = "silent! loadview";
event = [ "BufWinEnter" ];
pattern = [ "*" ];
desc =
"Load previous session window settings for the opened file (folds, cursor pos, etc)";
}
{
command = "silent! FloatermNew --name=def_term --width=0.8 --height=0.8 --wintype=topright --silent";
event = [ "VimEnter" ];
pattern = [ "*" ];
desc = "Start the floaterm window";
}
{
pattern = [ "qf" ];
event = [ "FileType" ];
callback = {
__raw = /* lua */ ''
function()
vim.keymap.set("n", "<CR>", "<CR>", { buffer = true })
end'';
};
}
{
pattern = [ "nix" ];
event = [ "FileType" ];
callback = {
__raw = /* lua */ ''
function()
require("otter").activate(
{ "bash", "lua", "python" },
true, -- completions
true, -- diagnostics
nil
)
end'';
};
}
];
};
}