diff options
author | nathan11 <thenathansmithsmith@gmail.com> | 2023-07-25 00:52:07 -0600 |
---|---|---|
committer | nathan11 <thenathansmithsmith@gmail.com> | 2023-07-25 00:52:07 -0600 |
commit | 0f8c62f2d18fd86e2bad01a33e5e9beb4e2ef77b (patch) | |
tree | e098cecfe770af08bd77eda320f8a0260c3c68c6 /lua/custom_keybinds.lua |
first commit
Diffstat (limited to 'lua/custom_keybinds.lua')
-rw-r--r-- | lua/custom_keybinds.lua | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/lua/custom_keybinds.lua b/lua/custom_keybinds.lua new file mode 100644 index 0000000..94ffcac --- /dev/null +++ b/lua/custom_keybinds.lua @@ -0,0 +1,37 @@ +local autocmd = vim.api.nvim_create_autocmd +local constants = require("constants") +local rickroll = require("rickroll") + +-- Leader key. +vim.g['mapleader'] = ",." + +-- Next and previous. +vim.keymap.set({"i", "v", "n", "c"}, constants.next_key, "<C-n>") +vim.keymap.set({"i", "v", "n", "c"}, constants.previous_key, "<C-p>") + +-- Bye bye arrows +vim.keymap.set({"i", "n", "v"}, "<Right>", rickroll.rickroll) +vim.keymap.set({"i", "n", "v"}, "<Left>", rickroll.rickroll) +vim.keymap.set({"i", "n", "v"}, "<Up>", rickroll.rickroll) +vim.keymap.set({"i", "n", "v"}, "<Down>", rickroll.rickroll) + +-- Switching windows. +vim.keymap.set("n", "<A-h>", "<C-w><Left>") +vim.keymap.set("n", "<A-j>", "<C-w><Down>") +vim.keymap.set("n", "<A-k>", "<C-w><Up>") +vim.keymap.set("n", "<A-l>", "<C-w><Right>") + +-- Python scripts. +autocmd("Filetype", +{pattern="python", command="nnoremap <silent> <F5> :!python3 %<CR>" +}) + +-- Shell scripts. +autocmd("Filetype", +{pattern="sh", command="nnoremap <silent> <F5> :!./%<CR>" +}) + +-- Lua scripts. +autocmd("Filetype", +{pattern="lua", command="nnoremap <silent> <F5> :!lua %<CR>" +}) |