Skip to content

Commit 60a5f86

Browse files
committed
Update
1 parent 6d6fa30 commit 60a5f86

File tree

3 files changed

+49
-7
lines changed

3 files changed

+49
-7
lines changed

configuration.nix

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ isMaximal: {
1313
luaConfigRC.custom = builtins.readFile ./init.lua;
1414
extraPackages = [];
1515
extraPlugins = {};
16-
autosaving.enable = true;
16+
# autosaving.enable = true;
1717
preventJunkFiles = true;
1818
debugMode = {
1919
enable = false;
@@ -153,7 +153,7 @@ isMaximal: {
153153
transparent = true;
154154
};
155155

156-
autopairs.nvim-autopairs.enable = true;
156+
# autopairs.nvim-autopairs.enable = true;
157157

158158
autocomplete.nvim-cmp.enable = true;
159159
snippets.luasnip.enable = true;
@@ -170,9 +170,9 @@ isMaximal: {
170170
width = 25;
171171
};
172172
actions = {
173-
# openFile = {
174-
# quitOnOpen = true;
175-
# };
173+
open_file = {
174+
quit_on_open = true;
175+
};
176176
};
177177

178178
git = {
@@ -239,7 +239,7 @@ isMaximal: {
239239
};
240240

241241
notify = {
242-
nvim-notify.enable = true;
242+
nvim-notify.enable = !true;
243243
};
244244

245245
projects = {

init.lua

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,45 @@ end
102102

103103
local root_augroup = vim.api.nvim_create_augroup('MyAutoRoot', {})
104104
vim.api.nvim_create_autocmd('BufEnter', { group = root_augroup, callback = set_root })
105+
106+
107+
-- Create an autocommand group to avoid duplicate autocommands
108+
vim.api.nvim_create_augroup("AutoSaveAndNotify", { clear = true })
109+
110+
-- Save on leaving Insert mode if the buffer is modified, then notify
111+
vim.api.nvim_create_autocmd("InsertLeave", {
112+
group = "AutoSaveAndNotify",
113+
pattern = "*",
114+
callback = function()
115+
if vim.bo.modified then
116+
vim.cmd("write")
117+
vim.notify("File saved (InsertLeave)", vim.log.levels.INFO)
118+
end
119+
end,
120+
})
121+
122+
-- Also save on losing focus if the buffer is modified, then notify
123+
vim.api.nvim_create_autocmd("FocusLost", {
124+
group = "AutoSaveAndNotify",
125+
pattern = "*",
126+
callback = function()
127+
if vim.bo.modified then
128+
vim.cmd("write")
129+
vim.notify("File saved (FocusLost)", vim.log.levels.INFO)
130+
end
131+
end,
132+
})
133+
134+
135+
vim.api.nvim_create_autocmd({ "TextChanged"}, {
136+
group = "AutoSaveAndNotify",
137+
pattern = "*",
138+
callback = function()
139+
if vim.fn.mode() ~= "i" and vim.bo.modified then
140+
vim.cmd("write")
141+
vim.notify("Auto-saved", vim.log.levels.INFO)
142+
end
143+
end,
144+
})
145+
146+
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled(), { bufnr })

modules/modules.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"ui"
4444
"utility"
4545
"visuals"
46-
"autosaving"
46+
# "autosaving"
4747
];
4848

4949
# The neovim wrapper, used to build a wrapped neovim package

0 commit comments

Comments
 (0)