Compare commits
2 commits
31487eed5a
...
a6013523fa
Author | SHA1 | Date | |
---|---|---|---|
a6013523fa | |||
ad82eb1cbf |
2 changed files with 25 additions and 0 deletions
|
@ -118,6 +118,29 @@ vim.keymap.set({ "i", "s" }, "<Tab>", function()
|
||||||
end, { expr = true })
|
end, { expr = true })
|
||||||
|
|
||||||
|
|
||||||
|
-- Autoformat
|
||||||
|
|
||||||
|
vim.g.autoformat_enabled = true -- set to true by default
|
||||||
|
|
||||||
|
vim.api.nvim_create_user_command('ToggleAutoFormat', function()
|
||||||
|
vim.g.autoformat_enabled = not vim.g.autoformat_enabled
|
||||||
|
print('Autoformatting ' .. (vim.g.autoformat_enabled and 'enabled' or 'disabled'))
|
||||||
|
end, {})
|
||||||
|
|
||||||
|
vim.api.nvim_create_augroup("AutoFormat", {})
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||||
|
group = "AutoFormat",
|
||||||
|
callback = function()
|
||||||
|
if vim.g.autoformat_enabled then
|
||||||
|
vim.lsp.buf.format({
|
||||||
|
async = false,
|
||||||
|
timeout_ms = 2000 -- Adjust timeout as needed
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
-- Keymap
|
-- Keymap
|
||||||
local opts = function(label)
|
local opts = function(label)
|
||||||
return { noremap = true, silent = true, desc = label }
|
return { noremap = true, silent = true, desc = label }
|
||||||
|
@ -179,6 +202,7 @@ vim.keymap.set("n", "<Leader>uc", function()
|
||||||
vim.cmd [[colorscheme dieter-nocolor]]
|
vim.cmd [[colorscheme dieter-nocolor]]
|
||||||
end
|
end
|
||||||
end, opts("Toggle Dieter colors"))
|
end, opts("Toggle Dieter colors"))
|
||||||
|
vim.keymap.set("n", "<Leader>uf", "<cmd>ToggleAutoFormat<cr>", opts("Toggle autoformat on save"))
|
||||||
vim.keymap.set("n", "<Leader>uh", "<cmd>InlayHintsToggle<cr>", opts("Toggle inlay hints"))
|
vim.keymap.set("n", "<Leader>uh", "<cmd>InlayHintsToggle<cr>", opts("Toggle inlay hints"))
|
||||||
vim.keymap.set("n", "<Leader>un", "<cmd>set invnumber<cr>", opts("Toggle line numbers"))
|
vim.keymap.set("n", "<Leader>un", "<cmd>set invnumber<cr>", opts("Toggle line numbers"))
|
||||||
vim.keymap.set("n", "<Leader>uw", "<cmd>set invwrap<cr>", opts("Toggle line wrapping"))
|
vim.keymap.set("n", "<Leader>uw", "<cmd>set invwrap<cr>", opts("Toggle line wrapping"))
|
||||||
|
|
|
@ -68,6 +68,7 @@ require('mini.pick').setup({
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
local MiniPick = require('mini.pick')
|
||||||
MiniPick.registry.projects = function(local_opts)
|
MiniPick.registry.projects = function(local_opts)
|
||||||
local root = vim.fn.expand("~/src")
|
local root = vim.fn.expand("~/src")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue