local u = require "utils" local nmap, map, expr = u.nmap, u.map, u.expr -- map("i", "jk", "") nmap("", "write!") nmap("h", "nohlsearch") nmap("q", "quit!") nmap("w", "write!") nmap("e", "NvimTreeToggle") nmap("/", "lua require[[Comment]].toggle()") map("v", "/", "gc") nmap("ps", "PackerSync") -- Windows for _, k in ipairs { "h", "j", "k", "l" } do nmap(string.format("", k), string.format("wincmd %s", k)) map("t", string.format("", k), string.format("%s", k)) end nmap("", "vertical resize -2") nmap("resize -1") nmap("", "resize +2") nmap("", "vertical resize +2") -- Alternative up/down for arows expr("i", "", 'pumvisible() ? "\\" : "\\"') expr("i", "", 'pumvisible() ? "\\" : "\\"') expr("c", "", 'pumvisible() ? "\\" : "\\"') expr("c", "", 'pumvisible() ? "\\" : "\\"') -- Move line map("i", "", ":m .+1==gi") map("i", "", ":m .-2==gi") map("v", "K", ":move '<-2gv-gv") map("v", "J", ":move '>+1gv-gv") nmap("", ":m .+1==") nmap("", ":m .-2==") -- Telescope nmap("f", "Telescope find_files") nmap("st", "Telescope live_grep") nmap("sT", "Telescope grep_string") nmap("sp", "Telescope projects") nmap("sr", "Telescope oldfiles") nmap("sb", "Telescope git_branches") -- Ultest nmap("tt", "Ultest") nmap("ts", "UltestStop") nmap("tc", "UltestClear") nmap("tn", "UltestNearest") nmap("to", "UltestOutput") nmap("tj", "(ultest-next-fail)") nmap("tk", "(ultest-prev-fail)") -- Buffer nmap("", "BufferLast") nmap("", "BufferClose") nmap("c", "BufferClose!") for i = 1, 9 do nmap(string.format("", i), string.format("BufferGoto %d", i)) end