lots of nonsense, neorg and autosave now in a usable state
This commit is contained in:
12
init.lua
12
init.lua
@@ -52,13 +52,21 @@ vim.opt.scrolloff = math.floor(vim.o.lines / 2) - 3
|
|||||||
|
|
||||||
-- Indent
|
-- Indent
|
||||||
vim.o.autoindent = true
|
vim.o.autoindent = true
|
||||||
-- Rebind 'i' to indent properly on empty lines
|
|
||||||
vim.keymap.set("n", "i", function()
|
vim.keymap.set("n", "i", function()
|
||||||
if vim.fn.getline("."):match("^%s*$") then
|
if vim.fn.getline("."):match("^%s*$") then
|
||||||
return [["_cc]]
|
return [["_cc]]
|
||||||
else
|
else
|
||||||
return "i"
|
return "i"
|
||||||
end
|
end
|
||||||
|
end, { expr = true, desc = "Inent properly on empty lines" })
|
||||||
|
|
||||||
|
vim.keymap.set("n", "a", function()
|
||||||
|
if vim.fn.getline("."):match("^%s*$") then
|
||||||
|
return [["_cc]]
|
||||||
|
else
|
||||||
|
return "a"
|
||||||
|
end
|
||||||
end, { expr = true, desc = "Indent properly on empty lines" })
|
end, { expr = true, desc = "Indent properly on empty lines" })
|
||||||
|
|
||||||
-- Force proper keybindings
|
-- Force proper keybindings
|
||||||
@@ -70,8 +78,6 @@ vim.keymap.set("n", "<down>", '<cmd>echo "Use j to move!!"<CR>')
|
|||||||
-- C-BS for deleting whole word in insert mode
|
-- C-BS for deleting whole word in insert mode
|
||||||
vim.keymap.set("i", "<C-BS>", "<C-W>", { noremap = true })
|
vim.keymap.set("i", "<C-BS>", "<C-W>", { noremap = true })
|
||||||
|
|
||||||
-- Setup notifications
|
|
||||||
|
|
||||||
-- Keybinds for MiniSessions
|
-- Keybinds for MiniSessions
|
||||||
vim.keymap.set("n", "<leader>qj", function() -- quit and save session local
|
vim.keymap.set("n", "<leader>qj", function() -- quit and save session local
|
||||||
MiniSessions.write(".session")
|
MiniSessions.write(".session")
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ return {
|
|||||||
nix = { "nixfmt" },
|
nix = { "nixfmt" },
|
||||||
},
|
},
|
||||||
format_on_save = true,
|
format_on_save = true,
|
||||||
|
undojoin = true,
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|||||||
47
lua/plugins/functional/autosave.lua
Normal file
47
lua/plugins/functional/autosave.lua
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
return {
|
||||||
|
"okuuva/auto-save.nvim",
|
||||||
|
version = "^1.0.0", -- see https://devhints.io/semver, alternatively use '*' to use the latest tagged release
|
||||||
|
cmd = "ASToggle", -- optional for lazy loading on command
|
||||||
|
event = { "InsertLeave", "TextChanged" },
|
||||||
|
opts = {},
|
||||||
|
config = function(opts)
|
||||||
|
require("auto-save").setup({
|
||||||
|
enabled = true,
|
||||||
|
trigger_events = { -- See :h events
|
||||||
|
immediate_save = { "BufLeave", "FocusLost", "QuitPre", "VimSuspend" }, -- vim events that trigger an immediate save
|
||||||
|
defer_save = { "InsertLeave" }, -- vim events that trigger a deferred save (saves after `debounce_delay`)
|
||||||
|
cancel_deferred_save = { "InsertEnter" }, -- vim events that cancel a pending deferred save
|
||||||
|
},
|
||||||
|
debounce_delay = 1000,
|
||||||
|
noautocmd = true,
|
||||||
|
})
|
||||||
|
local group = vim.api.nvim_create_augroup("autosave", {})
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
pattern = "AutoSaveWritePre",
|
||||||
|
group = group,
|
||||||
|
callback = function(opts)
|
||||||
|
if opts.data.saved_buffer ~= nil then
|
||||||
|
local filename = vim.fn.expand("%:t")
|
||||||
|
print("Saved '" .. filename .. "' at " .. vim.fn.strftime("%H:%M:%S"))
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
pattern = "AutoSaveEnable",
|
||||||
|
group = group,
|
||||||
|
callback = function(opts)
|
||||||
|
print("AutoSave enabled")
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
pattern = "AutoSaveDisable",
|
||||||
|
group = group,
|
||||||
|
callback = function(opts)
|
||||||
|
print("AutoSave disabled")
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -2,12 +2,17 @@ return {
|
|||||||
"nvim-neorg/neorg",
|
"nvim-neorg/neorg",
|
||||||
lazy = false,
|
lazy = false,
|
||||||
version = "*",
|
version = "*",
|
||||||
dependencies = { { "nvim-lua/plenary.nvim" }, { "nvim-neorg/neorg-telescope" } },
|
dependencies = { { "nvim-lua/plenary.nvim" }, { "nvim-neorg/neorg-telescope" }, { "benlubas/neorg-interim-ls" } },
|
||||||
config = function()
|
config = function()
|
||||||
require("neorg").setup({
|
require("neorg").setup({
|
||||||
load = {
|
load = {
|
||||||
["core.defaults"] = {},
|
["core.defaults"] = {},
|
||||||
["core.concealer"] = {},
|
["core.concealer"] = {},
|
||||||
|
["core.integrations.treesitter"] = {},
|
||||||
|
["core.looking-glass"] = {},
|
||||||
|
["core.completion"] = {
|
||||||
|
config = { engine = { module_name = "external.lsp-completion" } },
|
||||||
|
},
|
||||||
["core.dirman"] = {
|
["core.dirman"] = {
|
||||||
config = {
|
config = {
|
||||||
workspaces = {
|
workspaces = {
|
||||||
@@ -25,6 +30,24 @@ return {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
["external.interim-ls"] = {
|
||||||
|
config = {
|
||||||
|
-- default config shown
|
||||||
|
completion_provider = {
|
||||||
|
-- Enable or disable the completion provider
|
||||||
|
enable = true,
|
||||||
|
|
||||||
|
-- Show file contents as documentation when you complete a file name
|
||||||
|
documentation = true,
|
||||||
|
|
||||||
|
-- Try to complete categories provided by Neorg Query. Requires `benlubas/neorg-query`
|
||||||
|
categories = false,
|
||||||
|
|
||||||
|
-- suggest heading completions from the given file for `{@x|}` where `|` is your cursor
|
||||||
|
-- and `x` is an alphanumeric character. `{@name}` expands to `[name]{:$/people:# name}`
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
vim.wo.foldlevel = 99
|
vim.wo.foldlevel = 99
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ return {
|
|||||||
require("noice").setup({
|
require("noice").setup({
|
||||||
messages = {
|
messages = {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
view = "notify",
|
view = "mini",
|
||||||
view_error = "notify", -- view for errors
|
view_error = "notify", -- view for errors
|
||||||
view_warn = "notify", -- view for warnings
|
view_warn = "notify", -- view for warnings
|
||||||
view_history = "messages", -- view for :messages
|
view_history = "messages", -- view for :messages
|
||||||
|
|||||||
Reference in New Issue
Block a user