diff options
Diffstat (limited to 'lua/user/keymaps.lua')
-rw-r--r-- | lua/user/keymaps.lua | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/lua/user/keymaps.lua b/lua/user/keymaps.lua new file mode 100644 index 0000000..3c5fc5b --- /dev/null +++ b/lua/user/keymaps.lua @@ -0,0 +1,50 @@ +local opts = { noremap = true, silent = true } + +local term_opts = { silent = true } + +local keymap = vim.api.nvim_set_keymap + +-- Better window navigation +keymap("n", "<C-h>", "<C-w>h", opts) +keymap("n", "<C-j>", "<C-w>j", opts) +keymap("n", "<C-k>", "<C-w>k", opts) +keymap("n", "<C-l>", "<C-w>l", opts) + + +-- Remap space as leader key +keymap("n", "<Space>", "<Nop>", opts) +vim.g.mapleader = " " +vim.g.maplocalleader = " " + + +-- NERDTree keybindings +keymap("n", "<C-n>", ":NERDTree<CR>", opts) +keymap("n", "<C-t>", ":NERDTreeToggle<CR>", opts) + +-- Resizing windows (like i3) +keymap("n", "<C-Up>", ":resize -2<CR>", opts) +keymap("n", "<C-Down>", ":resize +2<CR>", opts) +keymap("n", "<C-Left>", ":vertical resize -2<CR>", opts) +keymap("n", "<C-Right>", ":vertical resize +2<CR>", opts) + +-- Moving between buffers +keymap("n", "<S-l>", ":bnext<CR>", opts) +keymap("n", "<S-h>", ":bprevious<CR>", opts) + +-- Move text up and down +keymap("n", "<A-j>", "<Esc>:m .+1<CR>==", opts) +keymap("n", "<A-k>", "<Esc>:m .-2<CR>==", opts) + +-- Visual mode -- +keymap("v", "<", "<gv", opts) +keymap("v", ">", ">gv", opts) + +-- Move text up and down +keymap("v", "<A-j>", ":m .+1<CR>==", opts) +keymap("v", "<A-k>", ":m .-2<CR>==", opts) +keymap("v", "p", '"_dP', opts) + +-- Telescope +-- keymap("n", "<leader>f", "<cmd>lua require 'telescope.builtin'.find_files(require('telescope.themes').get_dropdown({previewer = false}))<CR>", opts) +keymap("n", "<leader>f", "<cmd>Telescope find_files<CR>", opts) +-- keymap("n", "<C-t>", "<cmd>Telescope live_grep<CR>", opts) |