local bind = require("keymap.bind") local map_cr = bind.map_cr local map_cu = bind.map_cu local map_cmd = bind.map_cmd local map_callback = bind.map_callback local core_map = { -- Suckless ["n|"] = map_cr("normal za"):with_noremap():with_silent():with_desc("edit: Toggle code fold"), ["n|"] = map_cu("write"):with_noremap():with_silent():with_desc("edit: Save file"), ["n|Y"] = map_cmd("y$"):with_desc("edit: Yank text to EOL"), ["n|D"] = map_cmd("d$"):with_desc("edit: Delete text to EOL"), ["n|n"] = map_cmd("nzzzv"):with_noremap():with_desc("edit: Next search result"), ["n|N"] = map_cmd("Nzzzv"):with_noremap():with_desc("edit: Prev search result"), ["n|J"] = map_cmd("mzJ`z"):with_noremap():with_desc("edit: Join next line"), ["n|"] = map_callback(function() _flash_esc_or_noh() end) :with_noremap() :with_silent() :with_desc("edit: Clear search highlight"), ["n|"] = map_cmd("h"):with_noremap():with_desc("window: Focus left"), ["n|"] = map_cmd("l"):with_noremap():with_desc("window: Focus right"), ["n|"] = map_cmd("j"):with_noremap():with_desc("window: Focus down"), ["n|"] = map_cmd("k"):with_noremap():with_desc("window: Focus up"), ["t|h"] = map_cmd("wincmd h"):with_silent():with_noremap():with_desc("window: Focus left"), ["t|l"] = map_cmd("wincmd l"):with_silent():with_noremap():with_desc("window: Focus right"), ["t|j"] = map_cmd("wincmd j"):with_silent():with_noremap():with_desc("window: Focus down"), ["t|k"] = map_cmd("wincmd k"):with_silent():with_noremap():with_desc("window: Focus up"), ["n|"] = map_cr("vertical resize -3"):with_silent():with_desc("window: Resize -3 vertically"), ["n|"] = map_cr("vertical resize +3"):with_silent():with_desc("window: Resize +3 vertically"), ["n|"] = map_cr("resize -3"):with_silent():with_desc("window: Resize -3 horizontally"), ["n|"] = map_cr("resize +3"):with_silent():with_desc("window: Resize +3 horizontally"), ["n|"] = map_cr("wq"):with_desc("edit: Save file and quit"), ["n|"] = map_cr("q!"):with_desc("edit: Force quit"), ["n|o"] = map_cr("setlocal spell! spelllang=en_us"):with_desc("edit: Toggle spell check"), ["n|bn"] = map_cu("enew"):with_noremap():with_silent():with_desc("buffer: New"), ["n|tn"] = map_cr("tabnew"):with_noremap():with_silent():with_desc("tab: Create a new tab"), ["n|tk"] = map_cr("tabnext"):with_noremap():with_silent():with_desc("tab: Move to next tab"), ["n|tj"] = map_cr("tabprevious"):with_noremap():with_silent():with_desc("tab: Move to previous tab"), ["n|to"] = map_cr("tabonly"):with_noremap():with_silent():with_desc("tab: Only keep current tab"), -- Insert mode ["i|"] = map_cmd("u"):with_noremap():with_desc("edit: Delete previous block"), ["i|"] = map_cmd(""):with_noremap():with_desc("edit: Move cursor to left"), ["i|"] = map_cmd("^i"):with_noremap():with_desc("edit: Move cursor to line start"), ["i|"] = map_cmd(":w"):with_desc("edit: Save file"), ["i|"] = map_cmd(":wq"):with_desc("edit: Save file and quit"), -- Command mode ["c|"] = map_cmd(""):with_noremap():with_desc("edit: Left"), ["c|"] = map_cmd(""):with_noremap():with_desc("edit: Right"), ["c|"] = map_cmd(""):with_noremap():with_desc("edit: Home"), ["c|"] = map_cmd(""):with_noremap():with_desc("edit: End"), ["c|"] = map_cmd(""):with_noremap():with_desc("edit: Delete"), ["c|"] = map_cmd(""):with_noremap():with_desc("edit: Backspace"), ["c|"] = map_cmd([[=expand("%:p:h") . "/" ]]) :with_noremap() :with_desc("edit: Complete path of current file"), -- Visual mode ["v|J"] = map_cmd(":m '>+1gv=gv"):with_desc("edit: Move this line down"), ["v|K"] = map_cmd(":m '<-2gv=gv"):with_desc("edit: Move this line up"), ["v|<"] = map_cmd(""] = map_cmd(">gv"):with_desc("edit: Increase indent"), } bind.nvim_load_mapping(core_map)