1
Fork 0

Fp abbreviations, kicad and nvim keymap docs

This commit is contained in:
Matei Adriel 2023-03-14 20:57:07 +01:00
commit eaebbca5b3
No known key found for this signature in database
17 changed files with 351 additions and 237 deletions
dotfiles/neovim/lua/my

View file

@ -48,18 +48,7 @@ function M.setup()
-- {{{ Easier access to <C-^>
M.move("<C-^>", "<Leader>a", { desc = "[A]lternate file" })
-- }}}
-- {{{ Quit current buffer / all buffers
vim.keymap.set({ "n", "v" }, "<leader>q", function()
local buf = vim.api.nvim_win_get_buf(0)
-- Only save if file is writable
if vim.bo[buf].modifiable and not vim.bo[buf].readonly then
vim.cmd([[write]])
end
vim.cmd("q")
end, { desc = "[Q]uit current buffer" })
-- {{{ Quit all buffers
M.nmap("Q", ":wqa<cr>", "Save all files and [q]uit")
-- }}}
-- {{{ Replace word in file
@ -73,6 +62,7 @@ function M.setup()
-- {{{Diagnostic keymaps
M.nmap("[d", vim.diagnostic.goto_prev, "Goto previous [d]iagnostic")
M.nmap("]d", vim.diagnostic.goto_next, "Goto next [d]iagnostic")
M.move("J", "qj")
M.nmap("J", vim.diagnostic.open_float, "Open current diagnostic")
M.nmap("<leader>D", vim.diagnostic.setloclist, "[D]iagnostic loclist")
-- }}}
@ -83,6 +73,12 @@ function M.setup()
vim.keymap.set({ "n", "v" }, "<f11>", '"+', { desc = "Use global clipboard" }) -- Use global clipboard with *cp*
M.nmap("<f12>", ":silent write<cr>", "Save current file") -- Save using *ji*
-- }}}
-- {{{ Shift-Enter for not continuing the current comment
-- This does not preserve intendation. Not sure what a better solution would look like.
vim.keymap.set("i", "<S-CR>", function()
vim.paste({ "", "" }, -1)
end, { desc = "Insert newline without continuing the current comment" })
-- }}}
-- {{{ Allow quiting basic buffers with "q"
vim.api.nvim_create_autocmd("FileType", {
pattern = { "help" },
@ -97,12 +93,6 @@ function M.setup()
end,
})
-- }}}
-- {{{ Shift-Enter for not continuing the current comment
-- This does not preserve intendation. Not sure what a better solution would look like.
vim.keymap.set("i", "<S-CR>", function()
vim.paste({ "", "" }, -1)
end, { desc = "Insert newline without continuing the current comment" })
-- }}}
return M
end