2024-03-20 20:48:32 -05:00
|
|
|
-- This file lists all the global keymaps
|
2024-03-26 22:44:37 -05:00
|
|
|
local map = vim.keymap.set
|
|
|
|
local g = vim.g
|
2024-03-20 20:48:32 -05:00
|
|
|
|
|
|
|
-- Change the leader and localleader
|
2024-03-26 22:44:37 -05:00
|
|
|
g.mapleader = ','
|
|
|
|
g.maplocalleader = ';'
|
2024-03-20 20:48:32 -05:00
|
|
|
|
|
|
|
-- Use ,dd for deleting without putting into buffer
|
2024-03-26 22:44:37 -05:00
|
|
|
map({ 'v', 'n' }, '<leader>d', '"_d', { remap = false })
|
|
|
|
map('n', '<leader>D', '"_D', { remap = false })
|
|
|
|
map('n', '<leader>x', '"_x', { remap = false })
|
2024-03-20 20:48:32 -05:00
|
|
|
|
2024-03-28 04:03:05 -05:00
|
|
|
-- Insert a newline in normal mode by ,o and ,O
|
|
|
|
map('n', '<leader>o', ":<c-u>call append(line('.'), repeat([''], v:count1))<cr>", { remap = false })
|
|
|
|
map('n', '<leader>O', ":<c-u>call append(line('.')-1, repeat([''], v:count1))<cr>", { remap = false })
|
2024-03-20 20:48:32 -05:00
|
|
|
|
|
|
|
-- Use ,u for redo
|
2024-03-26 22:44:37 -05:00
|
|
|
map('n', '<leader>u', "<c-r>", { remap = false })
|
2024-03-20 20:48:32 -05:00
|
|
|
|
2024-03-21 17:29:10 -05:00
|
|
|
-- Find files using fzf by ,f
|
2024-03-26 22:44:37 -05:00
|
|
|
map('n', '<leader>f', ":Files<cr>", { remap = false })
|
2024-03-21 17:29:10 -05:00
|
|
|
|
2024-03-28 03:44:24 -05:00
|
|
|
-- Browser like keymaps
|
2024-03-29 00:17:54 -05:00
|
|
|
map('n', '<leader>k', ":tabnext<cr>", { remap = false })
|
|
|
|
map('n', '<leader>j', ":tabprevious<cr>", { remap = false })
|
2024-03-28 01:57:58 -05:00
|
|
|
map('n', '<leader>w', ":bdelete<cr>", { remap = false })
|
2024-03-28 02:26:33 -05:00
|
|
|
map('n', '<leader>W', ":bdelete!<cr>", { remap = false })
|
|
|
|
map('n', '<leader>t', ":tabnew<cr>", { remap = false })
|
|
|
|
map('n', '<leader>q', ":qa<cr>", { remap = false })
|
|
|
|
map('n', '<leader>Q', ":qa!<cr>", { remap = false })
|
|
|
|
map('n', '<leader>s', ":w<cr>", { remap = false })
|
|
|
|
map('n', '<leader>S', ":x<cr>", { remap = false })
|
2024-03-26 22:44:37 -05:00
|
|
|
|
|
|
|
-- Clear search highlight by Esc in normal mode
|
|
|
|
map('n', '<Esc>', ':noh<cr>', { remap = false })
|
2024-03-20 20:48:32 -05:00
|
|
|
|
2024-03-28 01:57:58 -05:00
|
|
|
-- Find files using fzf by ,f
|
2024-03-29 00:29:50 -05:00
|
|
|
map('n', '<leader>f', ':Files<cr>', { remap = false, silent = true })
|