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.

53 lines
1.7 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. vim.g.mapleader = " "
  2. vim.keymap.set("n", "<C-h>", "<C-w>h")
  3. vim.keymap.set("n", "<C-j>", "<C-w>j")
  4. vim.keymap.set("n", "<C-k>", "<C-w>k")
  5. vim.keymap.set("n", "<C-l>", "<C-w>l")
  6. vim.keymap.set("i", "<A-a>", "ā")
  7. vim.keymap.set("i", "<A-e>", "ē")
  8. vim.keymap.set("i", "<A-i>", "ī")
  9. vim.keymap.set("i", "<A-o>", "ō")
  10. vim.keymap.set("i", "<A-u>", "ū")
  11. vim.keymap.set("n", "<F12>", ":w|:!texbld run compile<CR>")
  12. vim.keymap.set("n", "<F5>", ":w|:!./test.sh<CR>")
  13. -- hacks
  14. vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
  15. vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
  16. vim.keymap.set("v", "gq", "gw")
  17. vim.keymap.set("n", "J", "mzJ`z")
  18. vim.keymap.set("n", "<C-d>", "<C-d>zz")
  19. vim.keymap.set("n", "<C-u>", "<C-u>zz")
  20. vim.keymap.set("n", "n", "nzzzv")
  21. vim.keymap.set("n", "N", "Nzzzv")
  22. vim.keymap.set("x", "<leader>p", [["_dP]])
  23. vim.keymap.set({ "n", "v" }, "<leader>y", [["+y]])
  24. vim.keymap.set("n", "<leader>Y", [["+Y]])
  25. vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true })
  26. vim.keymap.set("n", "<leader>X", "<cmd>!chmod -x %<CR>", { silent = true })
  27. -- execute file
  28. vim.keymap.set("n", "<leader>r", "<cmd>so ~/.config/nvim/init.lua<CR>")
  29. vim.keymap.set("n", "<leader>e", "<cmd>!%:p<CR>", { silent = true })
  30. vim.keymap.set("n", "<leader>vz", "<cmd>e ~/.zshrc<CR>");
  31. vim.keymap.set("n", "<leader>vc", "<cmd>e ~/.config/nvim<CR>");
  32. if os.getenv("TMUX") ~= nil then
  33. vim.keymap.set("n", "<C-f>", [[<cmd>silent !tmux neww tmuxs\; setenv WORKSPACES $WORKSPACES \;<CR>]])
  34. vim.keymap.set("n", "<C-y>", [[<cmd>silent !tmux neww cht.sh<CR>]])
  35. else
  36. local function unavailable()
  37. print("Not in a tmux session")
  38. end
  39. vim.keymap.set("n", "<C-f>", unavailable)
  40. vim.keymap.set("n", "<C-y>", unavailable)
  41. end