Neovim configs for 2023. Hopefully they last.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.1 KiB

2 years ago
  1. local function map(mode, lhs, rhs, opts)
  2. local options = { noremap = true }
  3. if opts then
  4. options = vim.tbl_extend("force", options, opts)
  5. end
  6. vim.api.nvim_set_keymap(mode, lhs, rhs, options)
  7. end
  8. vim.g.mapleader = " "
  9. map("n", "j", "gj")
  10. map("n", "k", "gk")
  11. map("n", "<C-h>", "<C-w>h")
  12. map("n", "<C-j>", "<C-w>j")
  13. map("n", "<C-k>", "<C-w>k")
  14. map("n", "<C-l>", "<C-w>l")
  15. map("i", "<A-a>", "ā")
  16. map("i", "<A-e>", "ē")
  17. map("i", "<A-i>", "ī")
  18. map("i", "<A-o>", "ō")
  19. map("i", "<A-u>", "ū")
  20. map("n", "<F12>", ":w|:!texbld run compile<CR>")
  21. map("n", "<F5>", ":w|:!./test.sh<CR>")
  22. -- hacks
  23. vim.keymap.set("x", "<leader>p", [["_dP]])
  24. vim.keymap.set({ "n", "v" }, "<leader>y", [["+y]])
  25. vim.keymap.set("n", "<leader>Y", [["+Y]])
  26. vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true })
  27. vim.keymap.set("n", "<leader>X", "<cmd>!chmod -x %<CR>", { silent = true })
  28. vim.keymap.set("n", "<leader>vc", "<cmd>e ~/.config/nvim<CR>");
  29. vim.keymap.set("n", "<leader>vz", "<cmd>e ~/.zshrc<CR>");
  30. vim.keymap.set("n", "<leader>fmt", function()
  31. vim.lsp.buf.formatting_sync()
  32. end)