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.
 
 

58 lines
1.8 KiB

vim.g.mapleader = " "
vim.keymap.set("n", "j", "gj")
vim.keymap.set("n", "k", "gk")
vim.keymap.set("n", "<C-h>", "<C-w>h")
vim.keymap.set("n", "<C-j>", "<C-w>j")
vim.keymap.set("n", "<C-k>", "<C-w>k")
vim.keymap.set("n", "<C-l>", "<C-w>l")
vim.keymap.set("i", "<A-a>", "ā")
vim.keymap.set("i", "<A-e>", "ē")
vim.keymap.set("i", "<A-i>", "ī")
vim.keymap.set("i", "<A-o>", "ō")
vim.keymap.set("i", "<A-u>", "ū")
vim.keymap.set("n", "<F12>", ":w|:!texbld run compile<CR>")
vim.keymap.set("n", "<F5>", ":w|:!./test.sh<CR>")
-- hacks
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
vim.keymap.set("n", "J", "mzJ`z")
vim.keymap.set("n", "<C-d>", "<C-d>zz")
vim.keymap.set("n", "<C-u>", "<C-u>zz")
vim.keymap.set("n", "n", "nzzzv")
vim.keymap.set("n", "N", "Nzzzv")
vim.keymap.set("x", "<leader>p", [["_dP]])
vim.keymap.set({ "n", "v" }, "<leader>y", [["+y]])
vim.keymap.set("n", "<leader>Y", [["+Y]])
vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true })
vim.keymap.set("n", "<leader>X", "<cmd>!chmod -x %<CR>", { silent = true })
-- execute file
vim.keymap.set("n", "<leader>r", "<cmd>so ~/.config/nvim/init.lua<CR>")
vim.keymap.set("n", "<leader>e", "<cmd>!%:p<CR>", { silent = true })
vim.keymap.set("n", "<leader>vz", "<cmd>e ~/.zshrc<CR>");
vim.keymap.set("n", "<leader>vc", "<cmd>e ~/.config/nvim<CR>");
vim.keymap.set("n", "<leader>fmt", function()
vim.lsp.buf.formatting_sync()
end)
if os.getenv("TMUX") ~= nil then
vim.keymap.set("n", "<C-f>", [[<cmd>silent !tmux neww tmuxs\; setenv WORKSPACES $WORKSPACES \;<CR>]])
vim.keymap.set("n", "<C-y>", [[<cmd>silent !tmux neww ncmpcpp<CR>]])
else
local function unavailable()
print("Not in a tmux session")
end
vim.keymap.set("n", "<C-f>", unavailable)
vim.keymap.set("n", "<C-y>", unavailable)
end