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.

52 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
  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("n", "J", "mzJ`z")
  17. vim.keymap.set("n", "<C-d>", "<C-d>zz")
  18. vim.keymap.set("n", "<C-u>", "<C-u>zz")
  19. vim.keymap.set("n", "n", "nzzzv")
  20. vim.keymap.set("n", "N", "Nzzzv")
  21. vim.keymap.set("x", "<leader>p", [["_dP]])
  22. vim.keymap.set({ "n", "v" }, "<leader>y", [["+y]])
  23. vim.keymap.set("n", "<leader>Y", [["+Y]])
  24. vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true })
  25. vim.keymap.set("n", "<leader>X", "<cmd>!chmod -x %<CR>", { silent = true })
  26. -- execute file
  27. vim.keymap.set("n", "<leader>r", "<cmd>so ~/.config/nvim/init.lua<CR>")
  28. vim.keymap.set("n", "<leader>e", "<cmd>!%:p<CR>", { silent = true })
  29. vim.keymap.set("n", "<leader>vz", "<cmd>e ~/.zshrc<CR>");
  30. vim.keymap.set("n", "<leader>vc", "<cmd>e ~/.config/nvim<CR>");
  31. if os.getenv("TMUX") ~= nil then
  32. vim.keymap.set("n", "<C-f>", [[<cmd>silent !tmux neww tmuxs\; setenv WORKSPACES $WORKSPACES \;<CR>]])
  33. vim.keymap.set("n", "<C-y>", [[<cmd>silent !tmux neww cht.sh<CR>]])
  34. else
  35. local function unavailable()
  36. print("Not in a tmux session")
  37. end
  38. vim.keymap.set("n", "<C-f>", unavailable)
  39. vim.keymap.set("n", "<C-y>", unavailable)
  40. end